--- projects/cms/source/reports/rrdgraphing/watch.pl 2004/03/04 11:27:30 1.7 +++ 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,21 +22,17 @@ # ----------------------------------------------------------- # 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.7 2004/03/04 11:27:30 tdb Exp $ +# $Id: watch.pl,v 1.12 2005/06/29 10:26:40 tdb Exp $ #------------------------------------------------------------ -BEGIN { - push (@INC, "/usr/local/packages/rrdtool/lib/perl5/site_perl/5.8.2/sun4-solaris"); -} +my($version) = '$Id: watch.pl,v 1.12 2005/06/29 10:26:40 tdb Exp $'; -my($version) = '$Id: watch.pl,v 1.7 2004/03/04 11:27:30 tdb Exp $'; - $| = 1; use strict; @@ -47,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 }; @@ -260,6 +257,10 @@ 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", @@ -306,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", @@ -319,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", ); @@ -330,6 +339,15 @@ 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", ); @@ -341,7 +359,7 @@ sub processdata() { $i = 0; while(defined $xmlhash{"packet.mailq.p$i.attributes.name"}) { my($name) = $xmlhash{"packet.mailq.p$i.attributes.name"}; - $name =~ s/\s+//g; + $name =~ s/\s+//g; @data = ( "packet.mailq.p$i.attributes.size:size:GAUGE", ); &updaterrd($machine, "mailq-$name", $date, $rrdstep, \%xmlhash, @data);