#!/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 ($LEGEND,@ITEMS,$name,$range,$descr); my $IOMIN=500; my $FORCE=@ARGV; $LEGEND="accesses"; # generate diagrams # opendir DIR,"rrd"; @ITEMS=grep /\.rrd/,readdir DIR; closedir DIR; #if (! (@ITEMS) ) { print " No database found\n Please check if the daemon is running.\n";next; } # if database exists, create images... foreach my $dev (@ITEMS) { ($name=$dev) =~ s/\.rrd//g; my $description=$name; my $var; my $mode; my $command; 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"; # print "$OUTDIR/$name-$file.$IMGFMT\n"; 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) { # print "make: $make $TEMPNAME $range $CONFIG{'WIDTH'} \n"; my ($prints,$xs,$ys)=RRDs::graph $TEMPNAME, "-i", "-b", "1024", "-s","-$range", "-w",$CONFIG{"WIDTH"}, "-h",$CONFIG{"HEIGHT"}, "-a", uc($IMGFMT), "-l 0", "--title", "$dev - last $descr ($DATESTRING)", "DEF:freq=rrd/$dev:freq:AVERAGE", "DEF:power=rrd/$dev:power:AVERAGE", "DEF:signal=rrd/$dev:signal:AVERAGE", "DEF:temp=rrd/$dev:temp:AVERAGE", "DEF:snr=rrd/$dev:snr:AVERAGE", "DEF:qam=rrd/$dev:qam:AVERAGE", "LINE2:freq#000080:freq", "GPRINT:freq:AVERAGE: avg\\:%3.1lf %s \\g", "GPRINT:freq:MIN: min\\:%3.1lf %s \\g", "GPRINT:freq:MAX: max\\:%3.1lf %s \\g", "GPRINT:freq:LAST: current\\:%3.1lf %s GHz\\n", "LINE2:power#800000:power", "GPRINT:power:AVERAGE: avg\\:%3.1lf %s \\g", "GPRINT:power:MIN: min\\:%3.1lf %s \\g", "GPRINT:power:MAX: max\\:%3.1lf %s \\g", "GPRINT:power:LAST: current\\:%3.1lf %s \\n", "LINE2:signal#008000:signal", "GPRINT:signal:AVERAGE: avg\\:%3.1lf %s \\g", "GPRINT:signal:MIN: min\\:%3.1lf %s \\g", "GPRINT:signal:MAX: max\\:%3.1lf %s \\g", "GPRINT:signal:LAST: current\\:%3.1lf %s \\n", "LINE2:temp#808080:temp", "GPRINT:temp:AVERAGE: avg\\:%3.1lf %s \\g", "GPRINT:temp:MIN: min\\:%3.1lf %s \\g", "GPRINT:temp:MAX: max\\:%3.1lf %s \\g", "GPRINT:temp:LAST: current\\:%3.1lf %s \\n", "LINE2:snr#0000FF:snr", "GPRINT:snr:AVERAGE: avg\\:%3.1lf %s \\g", "GPRINT:snr:MIN: min\\:%3.1lf %s \\g", "GPRINT:snr:MAX: max\\:%3.1lf %s \\g", "GPRINT:snr:LAST: current\\:%3.1lf %s dB\\n", "LINE2:qam#FF0000:qam", "GPRINT:qam:AVERAGE: avg\\:%3.1lf %s \\g", "GPRINT:qam:MIN: min\\:%3.1lf %s \\g", "GPRINT:qam:MAX: max\\:%3.1lf %s \\g", "GPRINT:qam:LAST: current\\:%3.1lf %s \\n", "HRULE:0#000000"; # print "$TEMPNAME >> $FILENAME\n"; rename $TEMPNAME,$FILENAME; # $xs = 0; # $ys = 0; printf " %-7s %d"."x%d %s\n",$descr,$xs,$ys,$FILENAME; } } } print "\n"; exit 0; # if ($ERROR = RRDs::error) { print time," ",$args{MODNAME},": unable to generate `$FILENAME': $ERROR\n"; } #print "pred descr: $descr xs: $xs ys: $ys \n"; WebSVN - hotsanic - Blame - Rev 36 - /trunk/modules/wireless-nec/diagrams.pl
  jablonka.czprosek.czf

hotsanic

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

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1