ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/reports/graphing/graph.pl
(Generate patch)

Comparing experimental/reports/graphing/graph.pl (file contents):
Revision 1.5 by tdb, Mon Mar 11 00:25:35 2002 UTC vs.
Revision 1.6 by tdb, Mon Mar 11 17:06:45 2002 UTC

# Line 11 | Line 11
11   #------------------------------------------------------------
12  
13   ## TODO
14 # allow specification of lower/upper graph bounds
15 #  -- then replace mem/swap/disk "total" line ;)
16 # fix mem/swap issues
17 #  -- should be graphing "in use", not "free"
14   # possibly make more configurable?
15   #  -- allow configurable periods of graphs
16   #  -- comments, types, etc
# Line 67 | Line 63 | foreach my $machine (@rrddirlist) {
63          if($rrd =~ /^(mem)\.rrd$/) {
64              my(@data);
65              my(@rawdata);
66 <            push @data, "AREA:$1:free:free#CCCCFF:free memory";
66 >            # we don't actually want to display free memory,
67 >            # although we need it to do inuse...
68 >            push @data, "NONE:$1:free:free#CCCCFF:free memory";
69              push @data, "LINE2:$1:total:total#0000FF:total memory";
70 +            # calculate inuse
71 +            push @rawdata, "CDEF:inuse=total,free,-";
72 +            # and add it to the graph
73 +            push @rawdata, "AREA:inuse#CCCCFF:memory in use";
74              push @rawdata, "--base=1024";
75              &makegraph($machine, $1, "Memory Usage for $machine", \@data, \@rawdata);
76          }
# Line 91 | Line 93 | foreach my $machine (@rrddirlist) {
93          if($rrd =~ /^(swap)\.rrd$/) {
94              my(@data);
95              my(@rawdata);
96 <            push @data, "AREA:$1:free:free#CCCCFF:free swap";
96 >            # we don't actually want to display free swap,
97 >            # although we need it to do inuse...
98 >            push @data, "NONE:$1:free:free#CCCCFF:free swap";
99              push @data, "LINE2:$1:total:total#0000FF:total swap";
100 +            # calculate inuse
101 +            push @rawdata, "CDEF:inuse=total,free,-";
102 +            # and add it to the graph
103 +            push @rawdata, "AREA:inuse#CCCCFF:swap in use";
104              push @rawdata, "--base=1024";
105              &makegraph($machine, $1, "Swap Usage for $machine", \@data, \@rawdata);
106          }
# Line 149 | Line 157 | foreach my $machine (@rrddirlist) {
157   #              (eg. kernow CPU usage)
158   # $dataref   = a reference to an array containing information for the graph
159   #              elements of format: "gtype:rrdname:dsname:name#colour:comment with spaces"
160 + #              (if gtype is "NONE" only a DEF of 'name' will be defined, no line will be plotted)
161   # $rawcmdref = a reference to an array containing raw rrd commands
162   #              elements a single command each, no spaces
163   #
# Line 166 | Line 175 | sub makegraph() {
175      my(@rrdcmd);
176      foreach my $dataitem (@data) {
177          # dataitem should be: "gtype:rrdname:dsname:name#colour:comment with spaces"
178 +        # (if gtype is "NONE" only a DEF of 'name' will be defined, no line will be plotted)
179          if($dataitem =~ /^(\S+):(\S+):(\S+):(\S+)#(.{6}):(.*)$/) {
180 <            push @rrdcmd, "DEF:$4=$rrddir/$machine/$2.rrd:$3:MAX";
181 <            push @rrdcmd, "$1:$4#$5:$6";
180 >            push @rrdcmd, "DEF:$4=$rrddir/$machine/$2.rrd:$3:AVERAGE";
181 >            if($1 ne "NONE") {
182 >                push @rrdcmd, "$1:$4#$5:$6";
183 >            }
184          }
185      }
186      push @rrdcmd, "--title=$title";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines