140 |
|
push @data, "LINE2:$1:swap:swap#FF00FF:OK:swap cpu "; |
141 |
|
push @data, "LINE2:$1:iowait:iowait#FF0000:OK:iowait cpu"; |
142 |
|
push @rawdata, "--upper-limit=100"; |
143 |
< |
&makegraph($machine, $1, "CPU Usage for $machine", \@data, \@rawdata); |
143 |
> |
&makegraph($machine, $1, "CPU Usage for $machine", "% cpu time", \@data, \@rawdata); |
144 |
|
} |
145 |
|
if($rrd =~ /^(mem)\.rrd$/) { |
146 |
|
my(@data); |
156 |
|
push @rawdata, "--base=1024"; |
157 |
|
# add some nice values to the legend |
158 |
|
&addlegend(\@rawdata, "inuse"); |
159 |
< |
&makegraph($machine, $1, "Memory Usage for $machine", \@data, \@rawdata); |
159 |
> |
&makegraph($machine, $1, "Memory Usage for $machine", "megabytes", \@data, \@rawdata); |
160 |
|
} |
161 |
|
if($rrd =~ /^(load)\.rrd$/) { |
162 |
|
my(@data); |
163 |
|
push @data, "LINE2:$1:load1:load1#CCCCFF:OK: 1 min load average"; |
164 |
|
push @data, "LINE2:$1:load5:load5#7777FF:OK: 5 min load average"; |
165 |
|
push @data, "LINE2:$1:load15:load15#0000FF:OK:15 min load average"; |
166 |
< |
&makegraph($machine, $1, "Loads for $machine", \@data); |
166 |
> |
&makegraph($machine, $1, "Loads for $machine", "load average", \@data); |
167 |
|
} |
168 |
|
if($rrd =~ /^(proc)\.rrd$/) { |
169 |
|
my(@data); |
172 |
|
push @data, "LINE2:$1:stopped:stopped#00FFFF:OK:stopped processes "; |
173 |
|
push @data, "LINE2:$1:total:total#FF00FF:OK:total processes "; |
174 |
|
push @data, "LINE2:$1:zombie:zombie#FF0000:OK:zombie processes "; |
175 |
< |
&makegraph($machine, $1, "Processes on $machine", \@data); |
175 |
> |
&makegraph($machine, $1, "Processes on $machine", "no. of processes", \@data); |
176 |
|
} |
177 |
|
if($rrd =~ /^(swap)\.rrd$/) { |
178 |
|
my(@data); |
188 |
|
push @rawdata, "--base=1024"; |
189 |
|
# add some nice values to the legend |
190 |
|
&addlegend(\@rawdata, "inuse"); |
191 |
< |
&makegraph($machine, $1, "Swap Usage for $machine", \@data, \@rawdata); |
191 |
> |
&makegraph($machine, $1, "Swap Usage for $machine", "megabytes", \@data, \@rawdata); |
192 |
|
} |
193 |
|
if($rrd =~ /^(users)\.rrd$/) { |
194 |
|
my(@data); |
195 |
|
push @data, "AREA:$1:count:count#CCCCFF:OK:user count"; |
196 |
< |
&makegraph($machine, $1, "User Count for $machine", \@data); |
196 |
> |
&makegraph($machine, $1, "User Count for $machine", "no. of users", \@data); |
197 |
|
} |
198 |
|
if($rrd =~ /^(disk)-(\S+).rrd$/) { |
199 |
|
my(@data); |
206 |
|
my($nicename) = $2; |
207 |
|
$nicename =~ s/$hex_slash/\//g; |
208 |
|
$nicename =~ s/$hex_underscore/_/g; |
209 |
< |
&makegraph($machine, "$type-$name", "Disk Usage for $machine on $nicename", \@data, \@rawdata); |
209 |
> |
&makegraph($machine, "$type-$name", "Disk Usage for $machine on $nicename", "kilobytes", \@data, \@rawdata); |
210 |
|
} |
211 |
|
# probably a queue with a name like this :) |
212 |
|
if($rrd =~ /^(\d+)_0\.rrd$/) { |
218 |
|
push @data, "LINE2:$baserrd\_$i:size:size$i" . &get_colour($i) . ":OK:queue$i size "; |
219 |
|
++$i; |
220 |
|
} |
221 |
< |
push @data, "LINE2:$baserrd\_0:total:total#FF0000:OK:packets/sec"; |
221 |
> |
push @data, "LINE2:$baserrd\_0:total:total#FF0000:OK:packets/sec "; |
222 |
|
my($comment); |
223 |
|
if(-f "$rrddir/$machine/$baserrd.def") { |
224 |
|
open(DEF, "$rrddir/$machine/$baserrd.def"); |
226 |
|
chomp $comment if defined $comment; |
227 |
|
} |
228 |
|
$comment = "unknown queue" if not defined $comment; |
229 |
< |
&makegraph($machine, $baserrd, $comment, \@data, \@rawdata); |
229 |
> |
&makegraph($machine, $baserrd, $comment, "", \@data, \@rawdata); |
230 |
|
} |
231 |
|
} |
232 |
|
# have a last check, maybe we can remove the directory now? |
295 |
|
# (eg. cpu) |
296 |
|
# $title = the title for the graph |
297 |
|
# (eg. kernow CPU usage) |
298 |
+ |
# $vlabel = the vertical label to apply to the left side of the graph |
299 |
+ |
# (eg. kb/s) |
300 |
|
# $dataref = a reference to an array containing information for the graph |
301 |
|
# elements of format: "gtype:rrdname:dsname:name#colour:legend:comment with spaces" |
302 |
|
# (if gtype is "NONE" only a DEF of 'name' will be defined, no line will be plotted) |
306 |
|
# |
307 |
|
|
308 |
|
sub makegraph() { |
309 |
< |
my($machine, $type, $title, $dataref, $rawcmdref) = @_; |
309 |
> |
my($machine, $type, $title, $vlabel, $dataref, $rawcmdref) = @_; |
310 |
|
# pass in these arrays by reference |
311 |
|
my(@data) = @$dataref if defined $dataref; |
312 |
|
my(@rawcmd) = @$rawcmdref if defined $rawcmdref; |
335 |
|
push @rrdcmd, "--title=$title"; |
336 |
|
push @rrdcmd, "--imgformat=PNG"; |
337 |
|
push @rrdcmd, "--lower-limit=0"; |
338 |
+ |
push @rrdcmd, "--vertical-label=$vlabel"; |
339 |
|
# not entirely convinced this is good... |
340 |
|
push @rrdcmd, "--alt-autoscale-max"; |
341 |
|
# add any further raw commands |