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.2 by tdb, Sun Mar 10 03:07:08 2002 UTC vs.
Revision 1.3 by tdb, Sun Mar 10 03:19:57 2002 UTC

# Line 51 | Line 51 | foreach my $machine (@rrddirlist) {
51          chomp $rrd;
52          if($rrd =~ /^(cpu)\.rrd$/) {
53              my(@data);
54 <            push @data, "LINE2:$1:idle#00FF00:idle cpu";
55 <            push @data, "LINE2:$1:user#0000FF:user cpu";
56 <            push @data, "LINE2:$1:kernel#00FFFF:kernel cpu";
57 <            push @data, "LINE2:$1:swap#FF00FF:swap cpu";
58 <            push @data, "LINE2:$1:iowait#FF0000:iowait cpu";
54 >            push @data, "LINE2:$1:idle:idle#00FF00:idle cpu";
55 >            push @data, "LINE2:$1:user:user#0000FF:user cpu";
56 >            push @data, "LINE2:$1:kernel:kernel#00FFFF:kernel cpu";
57 >            push @data, "LINE2:$1:swap:swap#FF00FF:swap cpu";
58 >            push @data, "LINE2:$1:iowait:iowait#FF0000:iowait cpu";
59              &makegraph($machine, $1, "CPU Usage for $machine", \@data);
60          }
61          if($rrd =~ /^(mem)\.rrd$/) {
62              my(@data);
63 <            push @data, "LINE2:$1:free#00FF00:free memory";
64 <            push @data, "LINE2:$1:total#0000FF:total memory";
63 >            push @data, "LINE2:$1:free:free#00FF00:free memory";
64 >            push @data, "LINE2:$1:total:total#0000FF:total memory";
65              &makegraph($machine, $1, "Memory Usage for $machine", \@data);
66          }
67          if($rrd =~ /^(load)\.rrd$/) {
68              my(@data);
69 <            push @data, "LINE2:$1:load1#00FF00:1 minute load average";
70 <            push @data, "LINE2:$1:load5#0000FF:5 minute load average";
71 <            push @data, "LINE2:$1:load15#FF0000:15 minute load average";
69 >            push @data, "LINE2:$1:load1:load1#00FF00:1 minute load average";
70 >            push @data, "LINE2:$1:load5:load5#0000FF:5 minute load average";
71 >            push @data, "LINE2:$1:load15:load15#FF0000:15 minute load average";
72              &makegraph($machine, $1, "Loads for $machine", \@data);
73          }
74          if($rrd =~ /^(proc)\.rrd$/) {
75              my(@data);
76 <            push @data, "LINE2:$1:cpu#00FF00:cpu processes";
77 <            push @data, "LINE2:$1:sleeping#0000FF:sleeping processes";
78 <            push @data, "LINE2:$1:stopped#00FFFF:stopped processes";
79 <            push @data, "LINE2:$1:total#FF00FF:total processes";
80 <            push @data, "LINE2:$1:zombie#FF0000:zombie processes";
76 >            push @data, "LINE2:$1:cpu:cpu#00FF00:cpu processes";
77 >            push @data, "LINE2:$1:sleeping:sleeping#0000FF:sleeping processes";
78 >            push @data, "LINE2:$1:stopped:stopped#00FFFF:stopped processes";
79 >            push @data, "LINE2:$1:total:total#FF00FF:total processes";
80 >            push @data, "LINE2:$1:zombie:zombie#FF0000:zombie processes";
81              &makegraph($machine, $1, "Processes on $machine", \@data);
82          }
83          if($rrd =~ /^(swap)\.rrd$/) {
84              my(@data);
85 <            push @data, "LINE2:$1:free#00FF00:free swap";
86 <            push @data, "LINE2:$1:total#0000FF:total swap";
85 >            push @data, "LINE2:$1:free:free#00FF00:free swap";
86 >            push @data, "LINE2:$1:total:total#0000FF:total swap";
87              &makegraph($machine, $1, "Swap Usage for $machine", \@data);
88          }
89          if($rrd =~ /^(users)\.rrd$/) {
90              my(@data);
91 <            push @data, "LINE2:$1:count#00FF00:user count";
91 >            push @data, "LINE2:$1:count:count#00FF00:user count";
92              &makegraph($machine, $1, "User Count for $machine", \@data);
93          }
94          if($rrd =~ /^(disk)-(\S+).rrd$/) {
95              my(@data);
96 <            push @data, "LINE2:$1-$2:kbytes#0000FF:total size";
97 <            push @data, "LINE2:$1-$2:used#00FF00:used";
96 >            push @data, "LINE2:$1-$2:kbytes:kbytes#0000FF:total size";
97 >            push @data, "LINE2:$1-$2:used:used#00FF00:used";
98              my($type) = $1;
99              my($name) = $2;
100              my($nicename) = $2;
# Line 109 | Line 109 | foreach my $machine (@rrddirlist) {
109              my($baserrd) = $1;
110              my($i) = 0;
111              while( -f "$rrddir/$machine/$baserrd\_$i.rrd" ) {
112 <                push @data, "LINE2:$baserrd\_$i:size$i" . &get_colour($i) . ":queue$i size ";
112 >                push @data, "LINE2:$baserrd\_$i:size:size$i" . &get_colour($i) . ":queue$i size ";
113                  ++$i;
114              }
115 <            push @data, "LINE2:$baserrd\_0:total#FF0000:packets/sec - currently";
115 >            push @data, "LINE2:$baserrd\_0:total:total#FF0000:packets/sec - currently";
116              push @rawdata, "GPRINT:total:LAST:%lf %spackets/sec";
117              my($comment);
118              if(-f "$rrddir/$machine/$baserrd.def") {
# Line 136 | Line 136 | foreach my $machine (@rrddirlist) {
136   # $title     = the title for the graph
137   #              (eg. kernow CPU usage)
138   # $dataref   = a reference to an array containing information for the graph
139 < #              elements of format: "gtype:rrdname:name#colour:comment with spaces"
139 > #              elements of format: "gtype:rrdname:dsname:name#colour:comment with spaces"
140   # $rawcmdref = a reference to an array containing raw rrd commands
141   #              elements a single command each, no spaces
142   #
# Line 153 | Line 153 | sub makegraph() {
153      }
154      my(@rrdcmd);
155      foreach my $dataitem (@data) {
156 <        # dataitem should be: "gtype:rrdname:name#colour:comment with spaces"
157 <        if($dataitem =~ /^(\S+):(\S+):(\S+)#(.{6}):(.*)$/) {
158 <            push @rrdcmd, "DEF:$3=$rrddir/$machine/$2.rrd:$3:MAX";
159 <            push @rrdcmd, "$1:$3#$4:$5";
156 >        # dataitem should be: "gtype:rrdname:dsname:name#colour:comment with spaces"
157 >        if($dataitem =~ /^(\S+):(\S+):(\S+):(\S+)#(.{6}):(.*)$/) {
158 >            push @rrdcmd, "DEF:$4=$rrddir/$machine/$2.rrd:$3:MAX";
159 >            push @rrdcmd, "$1:$4#$5:$6";
160          }
161      }
162      push @rrdcmd, "--title=$title";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines