--- projects/cms/source/reports/rrdgraphing/graph.pl 2002/10/21 13:02:58 1.11 +++ projects/cms/source/reports/rrdgraphing/graph.pl 2003/03/10 11:34:43 1.12 @@ -27,7 +27,7 @@ # Generates graphs from rrd databases for i-scream data. # # $Author: tdb $ -# $Id: graph.pl,v 1.11 2002/10/21 13:02:58 tdb Exp $ +# $Id: graph.pl,v 1.12 2003/03/10 11:34:43 tdb Exp $ #------------------------------------------------------------ ## TODO @@ -35,7 +35,7 @@ # -- allow configurable periods of graphs # -- comments, types, etc -my($version) = '$Id: graph.pl,v 1.11 2002/10/21 13:02:58 tdb Exp $'; +my($version) = '$Id: graph.pl,v 1.12 2003/03/10 11:34:43 tdb Exp $'; $| = 1; @@ -156,10 +156,11 @@ foreach my $machine (@rrddirlist) { # and add it to the graph push @rawdata, "AREA:peruse#CCCCFF:% memory in use"; push @rawdata, "--upper-limit=100"; + push @rawdata, "--base=1024"; # add some nice values to the legend &addlegend(\@rawdata, "peruse"); # put the total memory on the graph so we can map percentages to real values - push @rawdata, "GPRINT:total:LAST:Current total memory\\: \%.2lf %sMb\\c"; + push @rawdata, "GPRINT:total:LAST:Current total memory\\: \%.2lf %sb\\c"; &makegraph($machine, $1, "Memory Usage for $machine", "% memory in use", \@data, \@rawdata); } if($rrd =~ /^(load)\.rrd$/) { @@ -191,10 +192,11 @@ foreach my $machine (@rrddirlist) { # and add it to the graph push @rawdata, "AREA:peruse#CCCCFF:% swap in use"; push @rawdata, "--upper-limit=100"; + push @rawdata, "--base=1024"; # add some nice values to the legend &addlegend(\@rawdata, "peruse"); # put the total swap on the graph so we can map percentages to real values - push @rawdata, "GPRINT:total:LAST:Current total swap\\: \%.2lf %sMb\\c"; + push @rawdata, "GPRINT:total:LAST:Current total swap\\: \%.2lf %sb\\c"; &makegraph($machine, $1, "Swap Usage for $machine", "% swap in use", \@data, \@rawdata); } if($rrd =~ /^(users)\.rrd$/) { @@ -204,28 +206,29 @@ foreach my $machine (@rrddirlist) { } if($rrd =~ /^(paging)\.rrd$/) { my(@data); - push @data, "LINE2:$1:swapins:swapins#00FF00:OK:swap pages in "; - push @data, "LINE2:$1:swapouts:swapouts#0000FF:OK:swap pages out"; + push @data, "LINE2:$1:pageins:pageins#00FF00:OK:pages paged in "; + push @data, "LINE2:$1:pageouts:pageouts#0000FF:OK:pages paged out"; &makegraph($machine, $1, "Paging on $machine", "pages per second", \@data); } - if($rrd =~ /^(disk)-(\S+).rrd$/) { + if($rrd =~ /^(disk)-(\S+)\.rrd$/) { my(@data); my(@rawdata); # we need this lot for our calculations, but we'll never show them - push @data, "NONE:$1-$2:kbytes:kbytes#0000FF:NONE:total size\\n"; + push @data, "NONE:$1-$2:total:total#0000FF:NONE:total size\\n"; push @data, "NONE:$1-$2:used:used#CCCCFF:NONE:used space"; push @data, "NONE:$1-$2:totalinodes:totalinodes#000000:NONE:total inodes"; push @data, "NONE:$1-$2:freeinodes:freeinodes#000000:NONE:free inodes"; # calculate peruse, add it to the graph, and add a legend - push @rawdata, "CDEF:peruse=used,kbytes,/,100,*"; + push @rawdata, "CDEF:peruse=used,total,/,100,*"; push @rawdata, "AREA:peruse#CCCCFF:% disk used "; &addlegend(\@rawdata, "peruse"); # put the total space on the graph so we can map percentages to real values - push @rawdata, "GPRINT:kbytes:LAST:Current total space\\: \%.2lf %sKb\\c"; + push @rawdata, "GPRINT:total:LAST:Current total space\\: \%.2lf %sb\\c"; # calculate perinodeuse, add it to the graph, and add a legend push @rawdata, "CDEF:perinodeuse=totalinodes,freeinodes,totalinodes,LT,freeinodes,0,IF,-,totalinodes,/,100,*"; push @rawdata, "LINE2:perinodeuse#FF4444:% inodes used"; push @rawdata, "--upper-limit=100"; + push @rawdata, "--base=1024"; &addlegend(\@rawdata, "perinodeuse"); # put the total inodes on the graph so we can map percentages to real values push @rawdata, "GPRINT:totalinodes:LAST:Current total inodes\\: \%.2lf %s\\c"; @@ -237,6 +240,22 @@ foreach my $machine (@rrddirlist) { $nicename =~ s/$hex_underscore/_/g; &makegraph($machine, "$type-$name", "Disk Usage for $machine on $nicename", "% usage", \@data, \@rawdata); } + if($rrd =~ /^(diskio)-(\S+)\.rrd$/) { + my(@data); + my(@rawdata); + push @data, "LINE2:$1-$2:rbytes:rbytes#00FF00:OK:read bytes "; + push @data, "LINE2:$1-$2:wbytes:wbytes#0000FF:OK:write bytes"; + push @rawdata, "--base=1024"; + &makegraph($machine, "$1-$2", "Disk IO for $machine on $2", "bytes per second", \@data, \@rawdata); + } + if($rrd =~ /^(net)-(\S+)\.rrd$/) { + my(@data); + my(@rawdata); + push @data, "LINE2:$1-$2:rx:rx#00FF00:OK:received bytes "; + push @data, "LINE2:$1-$2:tx:tx#0000FF:OK:transfered bytes"; + push @rawdata, "--base=1024"; + &makegraph($machine, "$1-$2", "Network IO for $machine on $2", "bytes per second", \@data, \@rawdata); + } # probably a queue with a name like this :) if($rrd =~ /^(\d+)_0\.rrd$/) { my(@data); @@ -399,7 +418,6 @@ sub addlegend() { push @$dataref, "GPRINT:$name:LAST:Current\\: \%8.2lf %s"; push @$dataref, "GPRINT:$name:AVERAGE:Average\\: \%8.2lf %s"; push @$dataref, "GPRINT:$name:MAX:Max\\: \%8.2lf %s\\n"; - #push @$dataref, "GPRINT:$name:MIN:Min\\: \%8.2lf %s\\n"; } # hacky subroutine to return a colour