RE: Need help
Posted in 2001
# How about script as follows...
echo `hostname`
echo `date`
onstat -d | awk '
/Dbspaces/,/active/ {
dbs_name[$2] = $NF;
}
/Chunks/,/active/ {
if ( $0 ~ /Chunks/ ) { next };
if ( $0 ~ /address/ ) { next };
if ( $0 ~ /active/ ) { next };
dbs_size[$3] += $5;
dbs_free[$3] += $6;
}
END {
printf("%3s %-18s %9s %9s %6s\\n", " ", "DBS NAME", "SIZE", "FREE",
"%FREE%")
for (i in dbs_size)
{
printf("%3d %-18s %9d %9d %5d\\n", i, dbs_name[i], dbs_size[i],
dbs_free[i], (dbs_free[i] / dbs_size[i]) * 100)
}
}' | sort
-----Original Message-----
From: Brett Randall
[mailto:brett_s_rREMOVECAPITALS@hotmail.com]
Sent: Friday, January 05, 2001 8:34 AM
To: informix-list@iiug.org
Subject: Re: Need help
Tham Huei Hwan wrote:
>
> --------------832E4E2A803A27BDE04C0809
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hi all,
>
> I need to write a simple "perl" script to calculate the
free spaces in
> (%). But I am facing a problem in adding up (chksize) for
the dbsnum =11
> (there are 2 chunks over here). How should add up the 2
chunks ?
Ah, hmmm, ... using "+"? Do you know how to write perl?
Perhaps you
would be better off using sysmaster SMI and SQL.
HTH
Brett Randall
>
> dbsnum name chksize nfree
>
> 1 jkta_root_dbs 512000 344953
> 2 jkta_log_dbs 1024000 4043
> 3 jkta_tmp_dbs1 1024000 1011167
> 4 jkta_tmp_dbs2 1024000 1001103
> 5 gop_dbs1 128000 45975
> 6 gop_dbs2 179200 126211
> 7 gop_dbs3 332800 140117
> 8 sam_dbs1 409600 29184
> 9 sam_dbs2 921600 175717
> 10 sam_dbs3 870400 127687
> 11 sam_dbs4 1024000 19650
> 11 sam_dbs4 665600 354779
> 12 sis_sd_dbs 256000 0
> 13 sis_sd_idx 102400 6959
> 14 sis_sas_dbs 51200 51147
> 15 sis_sas_idx 51200 19803
> 16 sis_gen_dbs 1024000 0
> 17 sis_gen_idx 512000 97133
> 18 sis_gas_dbs 153600 153547
>
<snip>
#include <please_dont_post_mime.plea>
</snip>