--- projects/cms/source/reports/rrdgraphing/watch.pl 2002/05/21 16:47:16 1.4 +++ projects/cms/source/reports/rrdgraphing/watch.pl 2005/02/10 17:35:58 1.9 @@ -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.4 2002/05/21 16:47:16 tdb Exp $ +# $Id: watch.pl,v 1.9 2005/02/10 17:35:58 tdb Exp $ #------------------------------------------------------------ -my($version) = '$Id: watch.pl,v 1.4 2002/05/21 16:47:16 tdb Exp $'; +my($version) = '$Id: watch.pl,v 1.9 2005/02/10 17:35:58 tdb Exp $'; $| = 1; @@ -43,10 +43,10 @@ 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 $rrdstep $retry_wait $verbose $quiet }; @@ -256,9 +256,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); @@ -288,18 +293,72 @@ sub processdata() { @data = ( "packet.users.count:count:GAUGE", ); &updaterrd($machine, "users", $date, $rrdstep, \%xmlhash, @data); - + + # paging + @data = ( "packet.pages.pageins:pageins:GAUGE", + "packet.pages.pageouts:pageouts:GAUGE", + ); + &updaterrd($machine, "paging", $date, $rrdstep, \%xmlhash, @data); + # disk my($i) = 0; while(defined $xmlhash{"packet.disk.p$i.attributes.mount"}) { my($mount) = $xmlhash{"packet.disk.p$i.attributes.mount"}; $mount =~ s/_/$hex_underscore/g; $mount =~ s/\//$hex_slash/g; - @data = ( "packet.disk.p$i.attributes.kbytes:kbytes:GAUGE", + $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", + "packet.disk.p$i.attributes.freeinodes:freeinodes:GAUGE", ); &updaterrd($machine, "disk-$mount", $date, $rrdstep, \%xmlhash, @data); ++$i; + } + + # diskio + $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", + ); + &updaterrd($machine, "diskio-$name", $date, $rrdstep, \%xmlhash, @data); + ++$i + } + + # net + $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; + @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); + ++$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 } }