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" |
18 |
|
# possibly make more configurable? |
19 |
|
# -- allow configurable periods of graphs |
20 |
|
# -- comments, types, etc |
55 |
|
chomp $rrd; |
56 |
|
if($rrd =~ /^(cpu)\.rrd$/) { |
57 |
|
my(@data); |
58 |
+ |
my(@rawdata); |
59 |
|
push @data, "LINE2:$1:idle:idle#00FF00:idle cpu"; |
60 |
|
push @data, "LINE2:$1:user:user#0000FF:user cpu"; |
61 |
|
push @data, "LINE2:$1:kernel:kernel#00FFFF:kernel cpu"; |
62 |
|
push @data, "LINE2:$1:swap:swap#FF00FF:swap cpu"; |
63 |
|
push @data, "LINE2:$1:iowait:iowait#FF0000:iowait cpu"; |
64 |
< |
&makegraph($machine, $1, "CPU Usage for $machine", \@data); |
64 |
> |
push @rawdata, "--upper-limit=100"; |
65 |
> |
&makegraph($machine, $1, "CPU Usage for $machine", \@data, \@rawdata); |
66 |
|
} |
67 |
|
if($rrd =~ /^(mem)\.rrd$/) { |
68 |
|
my(@data); |
69 |
< |
push @data, "LINE2:$1:free:free#00FF00:free memory"; |
69 |
> |
my(@rawdata); |
70 |
> |
push @data, "AREA:$1:free:free#CCCCFF:free memory"; |
71 |
|
push @data, "LINE2:$1:total:total#0000FF:total memory"; |
72 |
< |
&makegraph($machine, $1, "Memory Usage for $machine", \@data); |
72 |
> |
push @rawdata, "--base=1024"; |
73 |
> |
&makegraph($machine, $1, "Memory Usage for $machine", \@data, \@rawdata); |
74 |
|
} |
75 |
|
if($rrd =~ /^(load)\.rrd$/) { |
76 |
|
my(@data); |
77 |
< |
push @data, "LINE2:$1:load1:load1#00FF00:1 minute load average"; |
78 |
< |
push @data, "LINE2:$1:load5:load5#0000FF:5 minute load average"; |
79 |
< |
push @data, "LINE2:$1:load15:load15#FF0000:15 minute load average"; |
77 |
> |
push @data, "LINE2:$1:load1:load1#CCCCFF:1 minute load average"; |
78 |
> |
push @data, "LINE2:$1:load5:load5#7777FF:5 minute load average"; |
79 |
> |
push @data, "LINE2:$1:load15:load15#0000FF:15 minute load average"; |
80 |
|
&makegraph($machine, $1, "Loads for $machine", \@data); |
81 |
|
} |
82 |
|
if($rrd =~ /^(proc)\.rrd$/) { |
90 |
|
} |
91 |
|
if($rrd =~ /^(swap)\.rrd$/) { |
92 |
|
my(@data); |
93 |
< |
push @data, "LINE2:$1:free:free#00FF00:free swap"; |
93 |
> |
my(@rawdata); |
94 |
> |
push @data, "AREA:$1:free:free#CCCCFF:free swap"; |
95 |
|
push @data, "LINE2:$1:total:total#0000FF:total swap"; |
96 |
< |
&makegraph($machine, $1, "Swap Usage for $machine", \@data); |
96 |
> |
push @rawdata, "--base=1024"; |
97 |
> |
&makegraph($machine, $1, "Swap Usage for $machine", \@data, \@rawdata); |
98 |
|
} |
99 |
|
if($rrd =~ /^(users)\.rrd$/) { |
100 |
|
my(@data); |
101 |
< |
push @data, "LINE2:$1:count:count#00FF00:user count"; |
101 |
> |
push @data, "AREA:$1:count:count#CCCCFF:user count"; |
102 |
|
&makegraph($machine, $1, "User Count for $machine", \@data); |
103 |
|
} |
104 |
|
if($rrd =~ /^(disk)-(\S+).rrd$/) { |
105 |
|
my(@data); |
106 |
+ |
my(@rawdata); |
107 |
|
push @data, "LINE2:$1-$2:kbytes:kbytes#0000FF:total size"; |
108 |
< |
push @data, "LINE2:$1-$2:used:used#00FF00:used"; |
108 |
> |
push @data, "AREA:$1-$2:used:used#CCCCFF:used"; |
109 |
> |
push @rawdata, "--base=1024"; |
110 |
|
my($type) = $1; |
111 |
|
my($name) = $2; |
112 |
|
my($nicename) = $2; |
113 |
|
$nicename =~ s/$hex_slash/\//g; |
114 |
|
$nicename =~ s/$hex_underscore/_/g; |
115 |
< |
&makegraph($machine, "$type-$name", "Disk Usage for $machine on $nicename", \@data); |
115 |
> |
&makegraph($machine, "$type-$name", "Disk Usage for $machine on $nicename", \@data, \@rawdata); |
116 |
|
} |
117 |
|
# probably a queue with a name like this :) |
118 |
|
if($rrd =~ /^(\d+)_0\.rrd$/) { |
174 |
|
push @rrdcmd, "--title=$title"; |
175 |
|
push @rrdcmd, "--imgformat=PNG"; |
176 |
|
push @rrdcmd, "--lower-limit=0"; |
177 |
+ |
# not entirely convinced this is good... |
178 |
+ |
push @rrdcmd, "--alt-autoscale-max"; |
179 |
|
# add any further raw commands |
180 |
|
push @rrdcmd, @rawcmd; |
181 |
|
RRDs::graph ("$imgdir/$machine/$type-3h.png", "--start=-10800", @rrdcmd); |