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

Comparing projects/cms/source/reports/rrdgraphing/graph.pl (file contents):
Revision 1.10 by tdb, Sun Oct 13 15:14:00 2002 UTC vs.
Revision 1.11 by tdb, Mon Oct 21 13:02:58 2002 UTC

# Line 2 | Line 2
2  
3   #
4   # i-scream central monitoring system
5 + # http://www.i-scream.org.uk
6   # Copyright (C) 2000-2002 i-scream
7   #
8   # This program is free software; you can redistribute it and/or
# Line 145 | Line 146 | foreach my $machine (@rrddirlist) {
146          if($rrd =~ /^(mem)\.rrd$/) {
147              my(@data);
148              my(@rawdata);
149 <            # we don't actually want to display free memory,
150 <            # although we need it to do inuse...
149 >            # we don't actually want to display free or total memory,
150 >            # although we need it to work out peruse...
151              push @data, "NONE:$1:free:free#CCCCFF:NONE:free memory";
152 <            push @data, "LINE2:$1:total:total#0000FF:NONE:total memory\\n";
153 <            # calculate inuse
154 <            push @rawdata, "CDEF:inuse=total,free,-";
152 >            push @data, "NONE:$1:total:total#0000FF:NONE:total memory\\n";
153 >            # calculate peruse - note that we only use 'free' if it's less than total
154 >            # (this is to avoid negative percentages :)
155 >            push @rawdata, "CDEF:peruse=total,free,total,LT,free,0,IF,-,total,/,100,*";
156              # and add it to the graph
157 <            push @rawdata, "AREA:inuse#CCCCFF:memory in use";
158 <            push @rawdata, "--base=1024";
157 >            push @rawdata, "AREA:peruse#CCCCFF:% memory in use";
158 >            push @rawdata, "--upper-limit=100";
159              # add some nice values to the legend
160 <            &addlegend(\@rawdata, "inuse");
161 <            &makegraph($machine, $1, "Memory Usage for $machine", "megabytes", \@data, \@rawdata);
160 >            &addlegend(\@rawdata, "peruse");
161 >            # put the total memory on the graph so we can map percentages to real values
162 >            push @rawdata, "GPRINT:total:LAST:Current total memory\\: \%.2lf %sMb\\c";
163 >            &makegraph($machine, $1, "Memory Usage for $machine", "% memory in use", \@data, \@rawdata);
164          }
165          if($rrd =~ /^(load)\.rrd$/) {
166              my(@data);
# Line 177 | Line 181 | foreach my $machine (@rrddirlist) {
181          if($rrd =~ /^(swap)\.rrd$/) {
182              my(@data);
183              my(@rawdata);
184 <            # we don't actually want to display free swap,
185 <            # although we need it to do inuse...
184 >            # we don't actually want to display free or total swap,
185 >            # although we need it to work out peruse...
186              push @data, "NONE:$1:free:free#CCCCFF:NONE:free swap";
187 <            push @data, "LINE2:$1:total:total#0000FF:NONE:total swap\\n";
188 <            # calculate inuse
189 <            push @rawdata, "CDEF:inuse=total,free,-";
187 >            push @data, "NONE:$1:total:total#0000FF:NONE:total swap\\n";
188 >            # calculate peruse - note that we only use 'free' if it's less than total
189 >            # (this is to avoid negative percentages :)
190 >            push @rawdata, "CDEF:peruse=total,free,total,LT,free,0,IF,-,total,/,100,*";
191              # and add it to the graph
192 <            push @rawdata, "AREA:inuse#CCCCFF:swap in use";
193 <            push @rawdata, "--base=1024";
192 >            push @rawdata, "AREA:peruse#CCCCFF:% swap in use";
193 >            push @rawdata, "--upper-limit=100";
194              # add some nice values to the legend
195 <            &addlegend(\@rawdata, "inuse");
196 <            &makegraph($machine, $1, "Swap Usage for $machine", "megabytes", \@data, \@rawdata);
195 >            &addlegend(\@rawdata, "peruse");
196 >            # put the total swap on the graph so we can map percentages to real values
197 >            push @rawdata, "GPRINT:total:LAST:Current total swap\\: \%.2lf %sMb\\c";
198 >            &makegraph($machine, $1, "Swap Usage for $machine", "% swap in use", \@data, \@rawdata);
199          }
200          if($rrd =~ /^(users)\.rrd$/) {
201              my(@data);
202              push @data, "AREA:$1:count:count#CCCCFF:OK:user count";
203              &makegraph($machine, $1, "User Count for $machine", "no. of users", \@data);
204          }
205 +        if($rrd =~ /^(paging)\.rrd$/) {
206 +            my(@data);
207 +            push @data, "LINE2:$1:swapins:swapins#00FF00:OK:swap pages in ";
208 +            push @data, "LINE2:$1:swapouts:swapouts#0000FF:OK:swap pages out";
209 +            &makegraph($machine, $1, "Paging on $machine", "pages per second", \@data);
210 +        }
211          if($rrd =~ /^(disk)-(\S+).rrd$/) {
212              my(@data);
213              my(@rawdata);
214 <            push @data, "LINE2:$1-$2:kbytes:kbytes#0000FF:NONE:total size\\n";
215 <            push @data, "AREA:$1-$2:used:used#CCCCFF:OK:used space";
216 <            push @rawdata, "--base=1024";
214 >            # we need this lot for our calculations, but we'll never show them
215 >            push @data, "NONE:$1-$2:kbytes:kbytes#0000FF:NONE:total size\\n";
216 >            push @data, "NONE:$1-$2:used:used#CCCCFF:NONE:used space";
217 >            push @data, "NONE:$1-$2:totalinodes:totalinodes#000000:NONE:total inodes";
218 >            push @data, "NONE:$1-$2:freeinodes:freeinodes#000000:NONE:free inodes";
219 >            # calculate peruse, add it to the graph, and add a legend
220 >            push @rawdata, "CDEF:peruse=used,kbytes,/,100,*";
221 >            push @rawdata, "AREA:peruse#CCCCFF:% disk used  ";
222 >            &addlegend(\@rawdata, "peruse");
223 >            # put the total space on the graph so we can map percentages to real values
224 >            push @rawdata, "GPRINT:kbytes:LAST:Current total space\\: \%.2lf %sKb\\c";
225 >            # calculate perinodeuse, add it to the graph, and add a legend
226 >            push @rawdata, "CDEF:perinodeuse=totalinodes,freeinodes,totalinodes,LT,freeinodes,0,IF,-,totalinodes,/,100,*";
227 >            push @rawdata, "LINE2:perinodeuse#FF4444:% inodes used";
228 >            push @rawdata, "--upper-limit=100";
229 >            &addlegend(\@rawdata, "perinodeuse");
230 >            # put the total inodes on the graph so we can map percentages to real values
231 >            push @rawdata, "GPRINT:totalinodes:LAST:Current total inodes\\: \%.2lf %s\\c";
232 >            # some name tidting
233              my($type) = $1;
234              my($name) = $2;
235              my($nicename) = $2;
236              $nicename =~ s/$hex_slash/\//g;
237              $nicename =~ s/$hex_underscore/_/g;
238 <            &makegraph($machine, "$type-$name", "Disk Usage for $machine on $nicename", "kilobytes", \@data, \@rawdata);
238 >            &makegraph($machine, "$type-$name", "Disk Usage for $machine on $nicename", "% usage", \@data, \@rawdata);
239          }
240          # probably a queue with a name like this :)
241          if($rrd =~ /^(\d+)_0\.rrd$/) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines