#!/usr/bin/env perl use strict; use warnings; use diagnostics; use lib "../../lib"; use HotSaNICparser; use HotSaNICdiagram; use RRDs; # read global settings # my $MODNAME=HotSaNICparser::get_module_name(); my %CONFIG=HotSaNICparser::get_config("../.."); my $OUTDIR=$CONFIG{"WEBDIR"}."/".lc $MODNAME; if ( ! -e $OUTDIR ) { mkdir $OUTDIR,0755; } my $IMGFMT=lc $CONFIG{"IMAGEFORMAT"}; my $TEMPNAME="$OUTDIR/temp.$IMGFMT"; my (@ITEMS,$name,$range,$descr); my $IOMIN=500; my $FORCE=@ARGV; my $COLOR_READ_LINE="00a000"; my $COLOR_READ_AREA="a0ffa0"; my $COLOR_WRITE_LINE="a00000"; my $COLOR_WRITE_AREA="ffa0a0"; my $COLOR_BETWEEN="c0c0c0"; my $COLOR_WRONGDATA="ffffa0"; # read module-specific settings # foreach (HotSaNICparser::read_settings(".")) { my ($var,$value)=HotSaNICparser::parse_line($_); if ($var eq "DEV") { push @ITEMS,$value; } } my $LEGEND="bytes/s"; # generate diagrams # foreach (@ITEMS) { my ($dev,$description)=split /,/; ($name=$description)=~ s/.*\///g; # if database exists, create images... if ( -e "./rrd/$dev.rrd") { print "creating images for $description...\n"; foreach $range ("1h","6h","1day","1week","1month","1year") { my ($descr,$file,$build,$fullrange,$DATESTRING)=HotSaNICdiagram::get_diagram_properties($range); my $FILENAME="$OUTDIR/$name-$file.$IMGFMT"; my $make=$FORCE; if ($range eq "1h") { $make++; } elsif (! -e "$FILENAME") { $make++; } else { my (undef,undef,undef,undef,undef,undef,undef,undef,undef,$mtime,undef,undef,undef) = stat( "$FILENAME" ); if (time > ($mtime+$build)) { $make++; } } if ($make>0) { my ($prints,$xs,$ys); if ($^O =~ /linux/) { ($prints,$xs,$ys)=RRDs::graph $TEMPNAME, "-i", "-b","1024", "-v", $LEGEND, "-s","-$range", "-w",$CONFIG{"WIDTH"}, "-h",$CONFIG{"HEIGHT"}, "-a", uc($IMGFMT), "-u",$IOMIN, "-l",(-$IOMIN), "--title", "I/O rates on $name - last $descr ($DATESTRING)", "DEF:iracc=rrd/$dev.rrd:racc:MIN", "DEF:iwacc=rrd/$dev.rrd:wacc:MIN", "DEF:irbyt=rrd/$dev.rrd:rbyt:MIN", "DEF:iwbyt=rrd/$dev.rrd:wbyt:MIN", "DEF:aracc=rrd/$dev.rrd:racc:AVERAGE", "DEF:awacc=rrd/$dev.rrd:wacc:AVERAGE", "DEF:arbyt=rrd/$dev.rrd:rbyt:AVERAGE", "DEF:awbyt=rrd/$dev.rrd:wbyt:AVERAGE", "DEF:xracc=rrd/$dev.rrd:racc:MAX", "DEF:xwacc=rrd/$dev.rrd:wacc:MAX", "DEF:xrbyt=rrd/$dev.rrd:rbyt:MAX", "DEF:xwbyt=rrd/$dev.rrd:wbyt:MAX", "CDEF:iwbyt_inv=0,iwbyt,-", "CDEF:awbyt_inv=0,awbyt,-", "CDEF:xwbyt_inv=0,xwbyt,-", "AREA:xrbyt#$COLOR_READ_AREA:", "AREA:irbyt#$COLOR_BETWEEN:", "LINE1:arbyt#$COLOR_READ_LINE:read\\g", "GPRINT:irbyt:MIN: min\\:%7.2lf %s", "GPRINT:arbyt:AVERAGE: avg\\:%7.2lf %s", "GPRINT:xrbyt:MAX: max\\:%7.2lf %s $LEGEND\\n", "GPRINT:iracc:MIN: (min\\:%7.2lf %s", "GPRINT:aracc:AVERAGE: avg\\:%7.2lf %s", "GPRINT:xracc:MAX: max\\:%7.2lf %s accesses/s)\\n", "COMMENT:\\s", "AREA:xwbyt_inv#$COLOR_WRITE_AREA:", "AREA:iwbyt_inv#$COLOR_BETWEEN:", "LINE1:awbyt_inv#$COLOR_WRITE_LINE:write\\g", "GPRINT:iwbyt:MIN: min\\:%7.2lf %s", "GPRINT:awbyt:AVERAGE: avg\\:%7.2lf %s", "GPRINT:xwbyt:MAX: max\\:%7.2lf %s $LEGEND\\n", "GPRINT:iwacc:MIN: (min\\:%7.2lf %s", "GPRINT:awacc:AVERAGE: avg\\:%7.2lf %s", "GPRINT:xwacc:MAX: max\\:%7.2lf %s accesses/s)\\n", "HRULE:0#000000"; } elsif ($^O =~ /bsd/) { ($prints,$xs,$ys)=RRDs::graph $TEMPNAME, "-i", "-b","1024", "-v", $LEGEND, "-s","-$range", "-w",$CONFIG{"WIDTH"}, "-h",$CONFIG{"HEIGHT"}, "-a", uc($IMGFMT), "-u",$IOMIN, "-l",(-$IOMIN), "--title", "I/O rates on $name - last $descr ($DATESTRING)", "DEF:ikbt=rrd/$dev.rrd:kbt:MIN", "DEF:akbt=rrd/$dev.rrd:kbt:AVERAGE", "DEF:xkbt=rrd/$dev.rrd:kbt:MAX", "DEF:ixfr=rrd/$dev.rrd:xfr:MIN", "DEF:axfr=rrd/$dev.rrd:xfr:AVERAGE", "DEF:xxfr=rrd/$dev.rrd:xfr:MAX", "DEF:itime=rrd/$dev.rrd:time:MIN", "DEF:atime=rrd/$dev.rrd:time:AVERAGE", "DEF:xtime=rrd/$dev.rrd:time:MAX", "DEF:imb=rrd/$dev.rrd:mb:MIN", "DEF:amb=rrd/$dev.rrd:mb:AVERAGE", "DEF:xmb=rrd/$dev.rrd:mb:MAX", "AREA:amb#FF4040:Disk Transfer\\g", "GPRINT:imb:MIN: min\\:%7.2lf %s", "GPRINT:amb:AVERAGE: avg\\:%7.2lf %s", "GPRINT:xmb:MAX: max\\:%7.2lf %s bytes/s\\n", "COMMENT:\\s", "HRULE:0#000000"; } rename $TEMPNAME,$FILENAME; printf " %-7s %d"."x%d %s\n",$descr,$xs,$ys,$FILENAME; } } } else { print " No database found\n Please check if the daemon is running.\n";next; } print "\n"; } exit 0; WebSVN - hotsanic - Blame - Rev 36 - /trunk/modules/diskio/diagrams.pl
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [diskio/] [diagrams.pl] - Blame information for rev 36

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1