#!/usr/bin/perl use strict; use CGI::Carp qw/fatalsToBrowser/; use CGI; use RRDs; my $query = CGI::new(); my @wh = (split /,/, $query->param('w')); my @hostsq = (split /,/, $query->param('h')); my $startt = $query->param('s'); my @mode = (split /,/, $query->param('m')); my @when_opt = ('hourly','daily','weekly','monthly','yearly'); my @when; my %hosts; my $now = time; my $endtime; my $basedir = '/var/www/apps/'; unless(defined($mode[0])) { @mode = (); } if(defined($wh[0])) { if($wh[0] eq 'all') { @when = @when_opt; } else { foreach my $whe(@wh) { push(@when,$when_opt[$whe]); } } } else { push(@when,$when_opt[2]); } my %hosts_dev = ( eth => { 'trym' => ['eth0'], 'loke' => ['eth2','eth3'], }, disk => { 'trym' => ['hda'], 'loke' => ['sda','md126_0','md126_1','md126_2','md126_3','md126_4','md126_5','md126'] }, ); if(defined($hostsq[0])) { foreach my $hst(@hostsq) { foreach my $tst(keys %hosts_dev) { @{ $hosts{$tst}{$hst} } = @{ $hosts_dev{$tst}{$hst} }; } } } else { # @hostsq = ('loke','trym'); @hostsq = ('loke'); %hosts = %hosts_dev; } my %start = ( 'hourly' => 3600, 'daily' => 86400, 'weekly' => 604800, 'monthly' => 2419200, 'yearly' => 31536000, ); &starthtml; my $back; my $starttime; foreach my $h(@hostsq) { print '

',$h,'

',"\n"; foreach my $t(@when) { unless(defined($startt)) { $starttime = $now - $start{$t}; $endtime = $starttime + $start{$t}; } else { $back = $startt * $start{$t}; $starttime = $now - $back - $start{$t}; $endtime = $starttime + $start{$t}; } my $curmode; my @tmpmode = @mode; unless(scalar(@tmpmode) > 0) { @tmpmode = ('cpu','mem','disk','eth'); } foreach $curmode(@tmpmode) { if(($curmode eq 'eth') || ($curmode eq 'disk')) { foreach my $d(@{ $hosts{$curmode}{$h} }) { print '

',"\n"; if($curmode eq 'eth') { print &generate_eth("host=$h dev=$d mode=$t start=$starttime end=$endtime"); } if($curmode eq 'disk') { print &generate_disk("host=$h dev=$d mode=$t start=$starttime end=$endtime"); } print '

',"\n"; } } elsif($curmode eq 'cpu') { print '

',"\n"; print &generate_cpu("host=$h mode=$t start=$starttime end=$endtime"),'
'; print &generate_load("host=$h mode=$t start=$starttime end=$endtime"),'
'; print &generate_temp("host=$h mode=$t start=$starttime end=$endtime"); print '

',"\n"; } elsif($curmode eq 'mem') { print '

',"\n"; print &generate_mem("host=$h mode=$t start=$starttime end=$endtime"),'

',"\n"; } elsif($curmode eq 'mail') { print '

',"\n"; print &generate_mail("host=$h mode=$t start=$starttime end=$endtime"),'

',"\n"; } elsif($curmode eq 'http') { print '

',"\n"; print &generate_http("host=$h mode=$t start=$starttime end=$endtime"),'

',"\n"; } else { print '

',"\n"; print &generate_cpu("host=$h mode=$t start=$starttime end=$endtime"),'
'; print &generate_load("host=$h mode=$t start=$starttime end=$endtime"),'
'; print &generate_temp("host=$h mode=$t start=$starttime end=$endtime"),'
'; print &generate_mem("host=$h mode=$t start=$starttime end=$endtime"),'

',"\n"; foreach my $d(@{ $hosts{'eth'}{$h} }) { print &generate_eth("host=$h dev=$d mode=$t start=$starttime end=$endtime"),'
'; } # foreach my $d(@{ $hosts{'disk'}{$h} }) # { my $d = @{ $hosts{'disk'}{$h}}; print &generate_disk("host=$h dev=$d mode=$t start=$starttime end=$endtime"),'
'; # } print '

',"\n"; # print '
',"\n"; } } } # print '
',"\n"; } &endhtml; sub starthtml { print 'Content-type: text/html',"\n\n"; print "","\n"; print '',"\n"; print '',"\n"; print '','Systemstats','',"\n"; print '',"\n\n"; print '',"\n"; print '',"\n\n"; print '',"\n\n"; print '',"\n"; print '
',"\n"; } sub generate_link { my @return; if(defined($query->param('h'))) { foreach my $h(@hostsq) { push(@return,"h=$h"); } } if(defined($_[0])) { if((split /=/,$_[0])[0] eq 'when') { my $tmp = (split /=/,$_[0])[1]; push(@return,"w=$tmp"); } else { foreach my $t(@wh) { push(@return,"w=$t"); } } if((split /=/,$_[0])[0] eq 'mode') { my $tmp = (split /=/,$_[0])[1]; push(@return,"m=$tmp"); } elsif(scalar(@mode) > 0) { my $tstring; $tstring = "m="; my $ci = 0; while($ci < scalar(@mode)) { $tstring .= $mode[$ci]; $ci++; if($ci < scalar(@mode)) { $tstring .= ','; } } push(@return,$tstring); } if(defined($query->param('s'))) { push(@return,"s=".$query->param('s')); } } else { foreach my $t(@wh) { push(@return,"w=$t"); } } my $rstring; my $i = 0; while($i < scalar(@return)) { if($i == 0) { $rstring = $return[$i]; } else # ($i == scalar(@return)) { $rstring .= "&$return[$i]"; } $i++; } return $rstring; } sub generate_hostlink { print '

param('s'))) { print "&s=".$query->param('s'); } print '">'; if(defined($_[0])) { print $_[0]; } else { print 'All'; } print '

',"\n"; } sub endhtml { print '
'; print '',"\n\n"; } sub getopts { my %op; my @opts = split(/ /,$_[0]); foreach my $tst(@opts) { my ($o,$v) = split(/=/,$tst); $op{$o} = $v; } return %op; } sub int { my %options = &getopts; unless(defined($options{'start'})) { my %times = ( 'hourly' => 3600, 'daily' => 86400, 'weekly' => 604800, 'monthly' => 2419200, 'yearly' => 31536000, ); $options{'start'} = $now - $times{$options{'mode'}}; } $options{'end'} = $now unless(defined($options{'end'})); $options{'host'} = 'loke' unless(defined($options{'host'})); return %options; } # Load-stats sub generate_load { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#EACC00','#EA8F00','#FF0000','#000000'); my $title = "$mode loadstats for $host"; my $dir = "$basedir/cpustats"; my $infile = "$dir/$host.rrd"; my $outfile = "$dir/$host-load-$mode-$width.png"; my $now = time; RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1000", "-v load", "-s $starttime", "-e $endtime", "-t $title", "--slope-mode", "--alt-autoscale-max", "--lower-limit=0", "--units-exponent=0", "--rigid", "DEF:a=$infile:loadavg1:AVERAGE", "DEF:b=$infile:loadavg5:AVERAGE", "DEF:c=$infile:loadavg15:AVERAGE", "CDEF:d=a,b,c,+,+", "AREA:a$color[0]:1 minute average", "GPRINT:a:LAST: Current\\:%8.2lf", "GPRINT:a:AVERAGE:Average\\:%8.2lf %s", "GPRINT:a:MAX:Maximum\\:%8.2lf %s\\n", "LINE2:b$color[1]:5 minute average", "GPRINT:b:LAST: Current\\:%8.2lf", "GPRINT:b:AVERAGE:Average\\:%8.2lf %s", "GPRINT:b:MAX:Maximum\\:%8.2lf %s\\n", "LINE:c$color[2]:15 minute average", "GPRINT:c:LAST:Current\\:%8.2lf", "GPRINT:c:AVERAGE:Average\\:%8.2lf %s", "GPRINT:c:MAX:Maximum\\:%8.2lf %s\\n", "LINE:a#000000", ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } #Temperature-stats sub generate_temp { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#FF0000','#EAAF00','#F5F800','#00FF00','#0000FF','#00EAFF','#FFFFFF'); my $title = "$mode tempstats for $host"; my $dir = "$basedir/cpustats"; my $infile = "$dir/$host"; my $outfile = "$dir/$host-temp-$mode-$width.png"; RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1000", "-v Temperature Celcius", "-s $starttime", "-e $endtime", "-t $title", "-r", "-A", "--slope-mode", "DEF:CPU0=$infile-0-temp.rrd:temp:AVERAGE", "DEF:CPU1=$infile-1-temp.rrd:temp:AVERAGE", "DEF:CPU2=$infile-2-temp.rrd:temp:AVERAGE", "DEF:CPU3=$infile-3-temp.rrd:temp:AVERAGE", "LINE1:CPU0$color[0]:CPU0", "GPRINT:CPU0:LAST:Current\\:%8.0lf %s", "GPRINT:CPU0:AVERAGE:Average\\:%8.0lf %s", "GPRINT:CPU0:MAX:Maximum\\:%8.0lf %s\\n", "LINE1:CPU1$color[1]:CPU1", "GPRINT:CPU1:LAST:Current\\:%8.0lf %s", "GPRINT:CPU1:AVERAGE:Average\\:%8.0lf %s", "GPRINT:CPU1:MAX:Maximum\\:%8.0lf %s\\n", "LINE1:CPU2$color[2]:CPU2", "GPRINT:CPU2:LAST:Current\\:%8.0lf %s", "GPRINT:CPU2:AVERAGE:Average\\:%8.0lf %s", "GPRINT:CPU2:MAX:Maximum\\:%8.0lf %s\\n", "LINE1:CPU3$color[3]:CPU3", "GPRINT:CPU3:LAST:Current\\:%8.0lf %s", "GPRINT:CPU3:AVERAGE:Average\\:%8.0lf %s", "GPRINT:CPU3:MAX:Maximum\\:%8.0lf %s\\n", ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } # CPU-stats sub generate_cpu { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#FF0000','#EAAF00','#F5F800','#00FF00','#0000FF','#00EAFF','#FFFFFF'); my $title = "$mode cpustats for $host"; my $dir = "$basedir/cpustats"; my $infile = "$dir/$host.rrd"; my $outfile = "$dir/$host-cpu-$mode-$width.png"; RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1000", "-v tics/s", "-s $starttime", "-e $endtime", "-t $title", "-r", "-l 0", "--slope-mode", "DEF:system=$infile:system:AVERAGE", "DEF:user=$infile:user:AVERAGE", "DEF:wait=$infile:iowait:AVERAGE", "DEF:nice=$infile:nice:AVERAGE", "DEF:idle=$infile:idle:AVERAGE", "DEF:irq=$infile:irq:AVERAGE", "DEF:softirq=$infile:softirq:AVERAGE", "AREA:system$color[0]:System", "GPRINT:system:LAST:Current\\:%8.2lf %s", "GPRINT:system:AVERAGE:Average\\:%8.2lf %s", "GPRINT:system:MAX:Maximum\\:%8.2lf %s\\n", "AREA:user$color[1]:User:STACK", "GPRINT:user:LAST: Current\\:%8.2lf %s", "GPRINT:user:AVERAGE:Average\\:%8.2lf %s", "GPRINT:user:MAX:Maximum\\:%8.2lf %s\\n", "AREA:wait$color[2]:Wait:STACK", "GPRINT:wait:LAST: Current\\:%8.2lf %s", "GPRINT:wait:AVERAGE:Average\\:%8.2lf %s", "GPRINT:wait:MAX:Maximum\\:%8.2lf %s\\n", "AREA:nice$color[3]:Nice:STACK", "GPRINT:nice:LAST: Current\\:%8.2lf %s", "GPRINT:nice:AVERAGE:Average\\:%8.2lf %s", "GPRINT:nice:MAX:Maximum\\:%8.2lf %s\\n", "AREA:irq$color[4]:irq:STACK", "GPRINT:irq:LAST: Current\\:%8.2lf %s", "GPRINT:irq:AVERAGE:Average\\:%8.2lf %s", "GPRINT:irq:MAX:Maximum\\:%8.2lf %s\\n", "AREA:softirq$color[5]:sirq:STACK", "GPRINT:softirq:LAST: Current\\:%8.2lf %s", "GPRINT:softirq:AVERAGE:Average\\:%8.2lf %s", "GPRINT:softirq:MAX:Maximum\\:%8.2lf %s\\n", "AREA:idle$color[6]:Idle:STACK", "GPRINT:idle:LAST: Current\\:%8.2lf %s", "GPRINT:idle:AVERAGE:Average\\:%8.2lf %s", "GPRINT:idle:MAX:Maximum\\:%8.2lf %s\\n", ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } # diskstats sub generate_disk { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#4668E466','#EAAF0066'); my $title = "$mode diskstats for $device\@$host"; my $dir = "$basedir/diskstats"; my $infile = "$dir/$host/$device.rrd"; my $outfile = "$dir/$host-$device-$mode-$width.png"; my $devstrread = sprintf($device."(read)"); my $devstrwr = sprintf($device."(write)"); RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1024", "-v B/sec", "-s $starttime", "-e $endtime", "-t $title", "--slope-mode", "--alt-autoscale-max", "DEF:read=$infile:read:AVERAGE", "DEF:write=$infile:write:AVERAGE", "DEF:busy=$infile:util:AVERAGE", "CDEF:readkb=read,1024,*", "CDEF:writekb=write,1024,*", "VDEF:wmax=writekb,MAXIMUM", "VDEF:rmax=writekb,MAXIMUM", # "VDEF:max=wmax # "CDEF:max=readkb,writekb,GT,readkb,writekb,IF", "CDEF:max=read,POP,rmax,wmax,GT,rmax,wmax,IF", "CDEF:busyscale=read,POP,busy,100,/,max,*", "AREA:busyscale#FF333310", "AREA:readkb#4668E466", "LINE:readkb#4668E4:$devstrread", "COMMENT: Current\\:", "GPRINT:readkb:LAST:%3.0lf%sB/sec", "COMMENT:Max\\:", "GPRINT:readkb:MAX:%3.0lf%sB/sec", "COMMENT:Average\\:", "GPRINT:readkb:AVERAGE:%3.0lf%sB/sec", "COMMENT:\\n", "AREA:writekb$color[1]", "LINE1:writekb#EAAF00:$devstrwr", "COMMENT:Current\\:", "GPRINT:writekb:LAST:%3.0lf%sB/sec", "COMMENT:Max\\:", "GPRINT:writekb:MAX:%3.0lf%sB/sec", "COMMENT:Average\\:", "GPRINT:writekb:AVERAGE:%3.0lf%sB/sec", "COMMENT:\\n", # "LINE:busyscale#000000:busy", "LINE:busyscale#FF333350:Busy", "COMMENT:Current\\:", "GPRINT:busy:LAST:%5.1lf%%", "COMMENT:Max\\:", "GPRINT:busy:MAX:%5.1lf%%", "COMMENT:Average\\:", "GPRINT:busy:AVERAGE:%5.1lf%%", ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } # Ethernetstats sub generate_eth { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#00CF0033','#00CF00FF','#00519933','#005199FF'); my $title = "$mode ethstats for $device\@$host"; my $dir = "$basedir/etherstats"; my $infile = "$dir/$host\/$device.rrd"; my $outfile = "$dir/$host-$device-$mode-$width.png"; RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1024", "-v B/s", "-s $starttime", "-e $endtime", "-t $title", "--lower-limit=0", "--alt-autoscale-max", "--slope-mode", "DEF:bytesIn=$infile:bytesIn:AVERAGE", "DEF:bytesOut=$infile:bytesOut:AVERAGE", # "CDEF:bytesOutneg=bytesOut,-1,*", "LINE1:bytesIn$color[1]:In", "AREA:bytesIn$color[0]:", "COMMENT: Current\\:", "GPRINT:bytesIn:LAST:%3.0lf%sB/sec", "COMMENT:Max\\:", "GPRINT:bytesIn:MAX:%3.0lf%sB/sec", "COMMENT:Average\\:", "GPRINT:bytesIn:AVERAGE:%3.0lf%sB/sec", "COMMENT:\\n", "LINE1:bytesOut$color[3]:Out", "AREA:bytesOut$color[2]:", "COMMENT:Current\\:", "GPRINT:bytesOut:LAST:%3.0lf%sB/sec", "COMMENT:Max\\:", "GPRINT:bytesOut:MAX:%3.0lf%sB/sec", "COMMENT:Average\\:", "GPRINT:bytesOut:AVERAGE:%3.0lf%sB/sec" ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } # Memstats sub generate_mem { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#862F2F','#EA8F00','#FFC73B','#74C366'); my $title = "$mode memstats for $host"; my $dir = "$basedir/memstats/"; my $infile = "$dir/$host.rrd"; my $outfile = "$dir/$host-$mode-$width.png"; RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1024", "-v Bytes", "-s $starttime", "-e $endtime", "-t $title", "--slope-mode", "--lower-limit=0", "--alt-autoscale-max", "DEF:total=$infile:total:AVERAGE", "DEF:used=$infile:used:AVERAGE", "DEF:free=$infile:free:AVERAGE", "DEF:buffers=$infile:buffers:AVERAGE", "DEF:cached=$infile:cached:AVERAGE", "AREA:used$color[0]:Used", "COMMENT: Current\\: ", "GPRINT:used:LAST:%8.2lf%siB", "COMMENT: Max\\:", "GPRINT:used:MAX:%8.2lf%siB", "COMMENT:Average\\:", "GPRINT:used:AVERAGE:%8.2lf%siB", "COMMENT:\\n", "AREA:buffers$color[1]:Buffers:STACK", "COMMENT: Current\\: ", "GPRINT:buffers:LAST:%8.2lf%siB", "COMMENT: Max\\:", "GPRINT:buffers:MAX:%8.2lf%siB", "COMMENT:Average\\:", "GPRINT:buffers:AVERAGE:%8.2lf%siB", "COMMENT:\\n", "AREA:cached$color[2]:Cached:STACK", "COMMENT: Current\\: ", "GPRINT:cached:LAST:%8.2lf%siB", "COMMENT: Max\\:", "GPRINT:cached:MAX:%8.2lf%siB", "COMMENT:Average\\:", "GPRINT:cached:AVERAGE:%8.2lf%siB", "COMMENT:\\n", "AREA:free$color[3]:Free:STACK", "COMMENT: Current\\:", "GPRINT:free:LAST:%8.2lf%siB", "COMMENT:Max\\:", "GPRINT:free:MAX:%8.2lf%siB", "COMMENT:Average\\:", "GPRINT:free:AVERAGE:%8.2lf%siB", # "COMMENT:\\n", ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } sub generate_mail { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#ff0000','#00519966','#5900FF99','#6633FF99','#00CF0033','#00CF0066','#cbbfff'); my $title = "$mode mailstats for $host"; my $dir = "$basedir/"; my $infile = "$dir/mail.rrd"; my $outfile = "$dir/$host-mail-$mode-$width.png"; my $now = time; RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1000", "-v mails/10sec", "-s $starttime", "-e $endtime", "-t $title", "--slope-mode", "--alt-autoscale-max", "--lower-limit=0", "--units-exponent=0", "--rigid", "DEF:a=$infile:delivered:AVERAGE", "DEF:b=$infile:spam:AVERAGE", "DEF:c=$infile:temp_reject:AVERAGE", "DEF:d=$infile:reject:AVERAGE", "DEF:e=$infile:bad_rcpt:AVERAGE", "DEF:f=$infile:malware:AVERAGE", "CDEF:rej=f,c,b,+,+", # "CDEF:bad=b,c,d,e,f,+,+,+,+", "CDEF:total=a,b,c,d,e,f,+,+,+,+,+", "AREA:f$color[0]:malware", "AREA:b$color[5]:spam :STACK", "AREA:c$color[4]:temp_reject:STACK", "LINE:rej#00000033", "AREA:e$color[3]:bad_rcpt :STACK", "AREA:d$color[2]:reject :STACK", # "LINE:bad#00000033", "AREA:a$color[1]:Delivered :STACK", "LINE:total#00000033", ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } sub generate_http { my %options = ∫ my $host = $options{'host'}; my $mode = $options{'mode'}; my $starttime = $options{'start'}; my $endtime = $options{'end'}; my $width = $options{'width'}; $width = 600 unless(defined($options{'width'})); my $height = $options{'height'}; $height = 200 unless(defined($options{'height'})); my $device = $options{'dev'}; my @color = ('#00519966','#FF519966','#00CF0033','#6633FF66','#00CF00FF'); my $title = "$mode httpstats for $host"; my $dir = "$basedir/"; my $infile = "$dir/http.rrd"; my $outfile = "$dir/$host-http-$mode-$width.png"; my $now = time; RRDs::graph( "$outfile", "-z", "-w $width", "-h $height", "-b 1024", "-v http traffic", "-s $starttime", "-e $endtime", "-t $title", "--slope-mode", # "--alt-autoscale-max", # "--lower-limit=0", # "--units-exponent=0", "--rigid", "DEF:a=$infile:bytes:AVERAGE", "DEF:b=$infile:codes:AVERAGE", "DEF:c=$infile:responses:AVERAGE", # "VDEF:bytesmax=a,MAXIMUM", # "VDEF:codesmax=b,MAXIMUM", # "VDEF:responsesmax=c,MAXIMUM", "CDEF:B=b,10000,*", "CDEF:C=c,10000,*", "CDEF:total=a,B,C,+,+", # "CDEF:resptot=B,C,+", # "CDEF:test=b,10000,*", "AREA:a$color[2]:Bytes Traffic", "AREA:C$color[0]:Requests:STACK", "AREA:B$color[1]:Non 20x response:STACK", "LINE:a#00000033", "LINE:total#00000033", ); &rrderrorcheck; my $return = "\"$title\"/"; $return = "".$return."" unless(defined($options{'nolink'})); return $return; } sub rrderrorcheck { my $ERR = RRDs::error; print "$ERR\n" if defined($ERR); return 1 unless(defined($ERR)); } 1;