|
This script is an external plugin script for the Big Brother monitoring system. It uses top to check iowait on the system. The command "top -d4" collects top output for 4 intervals and looks at iowait on the 4th, then sends a report to Big Brother. The alarm points are easily configurable. Page rules are configured on the Big Brother server side. |
#!/usr/bin/perl
#
#
# Date 6/3/2004
# Author - Vic Engle
#
#
#
#
use Sys::Hostname;
$LocalHost=hostname();
#
#
$BBHOME = '/opt/bb/bb';
$IOWAIT = "$BBHOME/tmp/iowait.dat";
$TOP = `/usr/local/bin/top -d4 |/usr/bin/grep iowait >$IOWAIT`;
# Set BigBro vars
$BB = "$BBHOME/bin/bb";
$BBDISP = 'jumpstart.domain_central.local';
$test = 'iowait';
$host = GetBBHostName();
$TIME = localtime(time);
$color = 'green';
open(IO,"<$IOWAIT") or Fail("$!");
$IO = ;
close(IO);
@IO = split(/,/,$IO);
@iowait = split(/\s+/,$IO[3]);
$iowait[1] =~ s/\%//g;
$Message .= "IO Wait on $LocalHost is currently $iowait[1]";
if ($iowait[1] > 85) {
$color = "red";
} elsif ($iowait[1] > 15) {
$color = "yellow";
}
$ENV{"color"} = $color;
system("$BB $BBDISP \"status $host.$test $color $TIME $Message\"");
#print "$BB $BBDISP \"status $host.$test $color $TIME $Message\"";
#
sub GetBBHostName {
open(BBHOSTS,"<$BBHOME/etc/bb-hosts") or die "Failed opening $BBHOME/etc/bb-hosts. ($!)";
@Hosts = ;
@Host = grep(/$LocalHost/,@Hosts);
@Host = split(/\s+/,$Host[0]);
$Host[1] =~ s/\./,/g;
return "$Host[1]";
}
You are visitor number 1871