#!/usr/bin/env perl # $Id: diagrams.pl,v 1.18 2004/05/27 21:45:20 bernisys Exp $ # include PERL libraries use strict; use warnings; use diagnostics; # include HotSaNIC libraries use lib "../../lib"; use lib "./platform"; use HotSaNICparser; use HotSaNICdiagram; use common; (my $VERSION = '$Revision: 1.18 $') =~ s/.*(\d+\.\d+).*/$1/; (my $IDENTIFIER = '$Id: diagrams.pl,v 1.18 2004/05/27 21:45:20 bernisys Exp $') =~ s/.*,v (.*) \$/$1/; # read all settings # my $MODNAME=HotSaNICparser::get_module_name(); my %CONFIG=HotSaNICparser::get_config("../.."); my %MODULECONFIG=HotSaNICmod::common::configure(); my $IMGFMT=lc $CONFIG{"IMAGEFORMAT"}; my $OUTDIR=$CONFIG{"WEBDIR"}."/".lc $MODNAME; if ( ! -e $OUTDIR ) { mkdir $OUTDIR,0755; } my ($FORCE,$DEBUGLEVEL,%PLOT)=HotSaNICdiagram::check_args(@ARGV); my @OPTIONS=HotSaNICdiagram::get_common_options(%MODULECONFIG,%CONFIG); # handle module-specific stuff # # delete upper & lower border configuration # these will be set separately for each graph # my $old=""; my @newoptions=(); foreach (@OPTIONS) { my $ignore=0; if ( ($_ eq "-u") or ($old eq "-u") ) { $ignore=1; } if ( ($_ eq "-l") or ($old eq "-l") ) { $ignore=1; } $old=$_; push @newoptions,$_ unless $ignore == 1; } @OPTIONS=@newoptions; # generate diagrams # foreach my $entry (@{$MODULECONFIG{SENSOR}}) { my (undef,undef,undef,$DB_FILE,$name,$file,$description,undef,undef,undef,$LEGEND,$MIN,$MAX)=HotSaNICmod::common::get_names($entry); if (%PLOT) { next if ! defined $PLOT{$name}; } $DB_FILE="./rrd/$DB_FILE.rrd"; # if database exists, create images... if ( -e $DB_FILE) { print "creating images for $name ($description) ...\n"; foreach my $range ("1h","6h","1day","1week","1month","1year") { my ($timelong,$time,$build,$fullrange,$DATESTRING)=HotSaNICdiagram::get_diagram_properties($range); my @EXTOPTIONS=("-v",$LEGEND, "-s","-$range", "--title", "$description - last $timelong ($DATESTRING)", "-u", $MAX); my @COMMANDS; if ($range eq "1h") { push @EXTOPTIONS,("-l", 0, "--alt-autoscale-max"); @COMMANDS=("DEF:avg=$DB_FILE:data:AVERAGE", "AREA:avg#".$MODULECONFIG{COLOR_AREA}.":", HotSaNICdiagram::insert_data("LINE1","avg",$MODULECONFIG{COLOR_LINE}," ","min avg max cur",$LEGEND,1)); } else { push @EXTOPTIONS,("-l", $MIN, "--alt-autoscale", "--alt-y-grid"); @COMMANDS=("DEF:avg=$DB_FILE:data:AVERAGE", "DEF:max=$DB_FILE:data:MAX", "DEF:min=$DB_FILE:data:MIN", HotSaNICdiagram::insert_minmax("min max",$MODULECONFIG{COLOR_MINMAX},$MODULECONFIG{COLOR_BORDER},"min/max",$LEGEND,1), HotSaNICdiagram::insert_data("LINE2","avg" ,$MODULECONFIG{COLOR_LINE} ,"average","min avg max",$LEGEND,1)); } if (defined $MIN) { push @COMMANDS,"HRULE:$MIN#".$MODULECONFIG{COLOR_LINE_ALARM_MIN}.":Warning threshold\\: $MIN $LEGEND"; if (defined $MAX) { push @COMMANDS,("HRULE:$MAX#".$MODULECONFIG{COLOR_LINE_ALARM_MAX}.":", "COMMENT:/ $MAX $LEGEND"); } } elsif (defined $MAX) { push @COMMANDS,"HRULE:$MAX#".$MODULECONFIG{COLOR_LINE_ALARM_MAX}.":Warning threshold\\: $MAX $LEGEND"; } push @COMMANDS,HotSaNICdiagram::insert_lines(%MODULECONFIG); my %CONF=(RANGE=>$timelong,FILENAME=>"$OUTDIR/$file-$time",FORMAT=>$IMGFMT,INTERVAL=>$build,FORCE=>$FORCE,OPTIONS=>[@OPTIONS,@EXTOPTIONS,@COMMANDS],DEBUGLEVEL=>$DEBUGLEVEL,MODNAME=>$MODNAME); HotSaNICdiagram::graph(%CONF); } } else { print " No database \"$DB_FILE\" found\n Please check if the daemon is running.\n"; } print "\n"; } exit 0; WebSVN - hotsanic - Blame - Rev 9 - /branches/HotSaNIC-0.5.0-pre6/modules/sensors/diagrams.pl
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [sensors/] [diagrams.pl] - Blame information for rev 9

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1