--- projects/cms/source/reports/rrdgraphing/watch.pl 2003/03/10 11:34:43 1.6 +++ projects/cms/source/reports/rrdgraphing/watch.pl 2005/06/29 10:26:40 1.12 @@ -2,7 +2,7 @@ # # i-scream central monitoring system -# http://www.i-scream.org.uk +# http://www.i-scream.org # Copyright (C) 2000-2002 i-scream # # This program is free software; you can redistribute it and/or @@ -22,16 +22,16 @@ # ----------------------------------------------------------- # i-scream graph generation scripts -# http://www.i-scream.org.uk +# http://www.i-scream.org # # Generates rrd databases for i-scream data by connecting to # the i-scream server and collecting data. # # $Author: tdb $ -# $Id: watch.pl,v 1.6 2003/03/10 11:34:43 tdb Exp $ +# $Id: watch.pl,v 1.12 2005/06/29 10:26:40 tdb Exp $ #------------------------------------------------------------ -my($version) = '$Id: watch.pl,v 1.6 2003/03/10 11:34:43 tdb Exp $'; +my($version) = '$Id: watch.pl,v 1.12 2005/06/29 10:26:40 tdb Exp $'; $| = 1; @@ -43,10 +43,11 @@ use RRDs; # define variables that will be read from the config # nb. keep this insync with the config file! -use vars qw{ - $imgdir $rrddir +use vars qw{ + $imgdir $rrddir $maxrrdage $maximgage $deleterrds $deleteimgs - $hex_slash $hex_underscore + $hex_slash $hex_underscore $hex_space $hex_colon $hex_bslash $hex_rbracket + $hex_lbracket $hex_plus $hex_hash $rrdstep $retry_wait $verbose $quiet }; @@ -256,9 +257,14 @@ sub processdata() { ); &updaterrd($machine, "cpu", $date, $rrdstep, \%xmlhash, @data); + # uptime + @data = ( "packet.os.uptime:uptime:GAUGE" ); + &updaterrd($machine, "uptime", $date, $rrdstep, \%xmlhash, @data); + # mem @data = ( "packet.memory.free:free:GAUGE", "packet.memory.total:total:GAUGE", + "packet.memory.cache:cache:GAUGE", ); &updaterrd($machine, "mem", $date, $rrdstep, \%xmlhash, @data); @@ -301,6 +307,9 @@ sub processdata() { my($mount) = $xmlhash{"packet.disk.p$i.attributes.mount"}; $mount =~ s/_/$hex_underscore/g; $mount =~ s/\//$hex_slash/g; + $mount =~ s/\\/$hex_bslash/g; + $mount =~ s/ /$hex_space/g; + $mount =~ s/:/$hex_colon/g; @data = ( "packet.disk.p$i.attributes.total:total:GAUGE", "packet.disk.p$i.attributes.used:used:GAUGE", "packet.disk.p$i.attributes.totalinodes:totalinodes:GAUGE", @@ -314,6 +323,11 @@ sub processdata() { $i = 0; while(defined $xmlhash{"packet.diskio.p$i.attributes.name"}) { my($name) = $xmlhash{"packet.diskio.p$i.attributes.name"}; + $name =~ s/_/$hex_underscore/g; + $name =~ s/\//$hex_slash/g; + $name =~ s/\\/$hex_bslash/g; + $name =~ s/ /$hex_space/g; + $name =~ s/:/$hex_colon/g; @data = ( "packet.diskio.p$i.attributes.rbytes:rbytes:GAUGE", "packet.diskio.p$i.attributes.wbytes:wbytes:GAUGE", ); @@ -325,11 +339,30 @@ sub processdata() { $i = 0; while(defined $xmlhash{"packet.net.p$i.attributes.name"}) { my($name) = $xmlhash{"packet.net.p$i.attributes.name"}; + $name =~ s/_/$hex_underscore/g; + $name =~ s/\//$hex_slash/g; + $name =~ s/\\/$hex_bslash/g; + $name =~ s/ /$hex_space/g; + $name =~ s/:/$hex_colon/g; + $name =~ s/\(/$hex_lbracket/g; + $name =~ s/\)/$hex_rbracket/g; + $name =~ s/\+/$hex_plus/g; + $name =~ s/#/$hex_hash/g; @data = ( "packet.net.p$i.attributes.rx:rx:GAUGE", "packet.net.p$i.attributes.tx:tx:GAUGE", ); - &updaterrd($machine, "net-$name", $date, $rrdstep, \%xmlhash, - @data); + &updaterrd($machine, "net-$name", $date, $rrdstep, \%xmlhash, @data); + ++$i + } + + # mailq + $i = 0; + while(defined $xmlhash{"packet.mailq.p$i.attributes.name"}) { + my($name) = $xmlhash{"packet.mailq.p$i.attributes.name"}; + $name =~ s/\s+//g; + @data = ( "packet.mailq.p$i.attributes.size:size:GAUGE", + ); + &updaterrd($machine, "mailq-$name", $date, $rrdstep, \%xmlhash, @data); ++$i } }