Re: onstat options
Posted in 1997
Mark H. Preston (markp@mamasita.rose.hp.com) wrote:
: Hi,
: What are the best indicators of response time, trans/sec, and general
: load for monitoring an informix database... using the onstat program?
: Any help would be appreciated. Thanks
: Mark~
Hi Mark ...
Here is a sample perl program that measures trans/sec and VP queue
congestion. We cron this to run periodically on busy system sending
output to a log file.
#!/usr/local/bin/perl5
if (! defined(@ARGV[0]))
{
print "Usage: $0 Sample_Interval(Seconds)\\n";
exit 1;
}
if (! defined($ENV{'INFORMIXSERVER'}))
{
print "Error: You must first set the Informix env vars\\n";
exit 1;
}
$sleep_time = @ARGV[0];
sub take_sample
{
$flag = 0;
open(SAMPLE, "onstat -p | ") || die "can't onstat -p : $!";
SAMPLE: while(<SAMPLE>)
{
#print;
@words = split(' ',$_);
if (@words[7] eq "commit")
{
$flag = 1;
next SAMPLE;
}
if ($flag == 1)
{
$sample = @words[7];
last SAMPLE;
}
}
}
#
# Main
#
$ql1 = `onstat -g rea | grep ready | wc -l`;
chop $ql1;
$time1 = time();
&take_sample();
$sample1 = $sample;
sleep($sleep_time);
$time2 = time();
&take_sample();
$sample2 = $sample;
$ts = `date '+%Y/%m/%d %H:%M'`;
chop $ts;
$ql2 = `onstat -g rea | grep ready | wc -l`;
chop $ql2;
print "ql1=$ql1 ql2=$ql2 \\n";
if ($ql2 > $ql1) { $ql = $ql2; }
else { $ql = $ql1; }
printf("%s - Commits: %d Dur: %d TransRate: %5.2f VP_Q_Length: %d\\n",$ts,$sample2-$sample1,$time2-$time1,($sample2-$sample1)/($time2-$time1),$ql);
exit 0
Enjoy,
Bill
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
/*** Hewlett-Packard - CTS/Colorado Springs
/ ***\\ Address: 1900 Garden of the gods Road
/ \\ / Colorado Springs, CO 80907
/* / \\ /**\\ Mailstop: C103G
/***\\ / \\/ \\ http: //hpweb.cs.itc.hp.com/~border
/ \\ \\ Email: border@cs.itc.hp.com
/ Bill Border \\ \\ Phone: (Telnet/719) 590-3402
/ TIS Database Americas Fax: (Telnet/719) 590-3596