jablonka.czprosek.czf

hotsanic

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

 

Line No. Rev Author Line
11simandl#!/usr/bin/env perl
2 
3# $Id: diagrams.pl,v 1.14 2004/05/28 22:19:00 bernisys Exp $
4 
5# include PERL libraries
6use strict;
7use warnings;
8use diagnostics;
9 
10# include HotSaNIC libraries
11use lib "../../lib";
12use lib "./platform";
13use HotSaNICparser;
14use HotSaNICdiagram;
15use common;
16 
17(my $VERSION = '$Revision: 1.14 $') =~ s/.*(\d+\.\d+).*/$1/;
18(my $IDENTIFIER = '$Id: diagrams.pl,v 1.14 2004/05/28 22:19:00 bernisys Exp $') =~ s/.*,v (.*) \$/$1/;
19 
20# read all settings
21#
22my $MODNAME=HotSaNICparser::get_module_name();
23my %CONFIG=HotSaNICparser::get_config("../..");
24my %MODULECONFIG=HotSaNICmod::common::configure();
25 
26my $IMGFMT=lc $CONFIG{"IMAGEFORMAT"};
27 
28my $OUTDIR=$CONFIG{"WEBDIR"}."/".lc $MODNAME;
29if ( ! -e $OUTDIR ) { mkdir $OUTDIR,0755; }
30 
31my ($FORCE,$DEBUGLEVEL,%PLOT)=HotSaNICdiagram::check_args(@ARGV);
32my @OPTIONS=HotSaNICdiagram::get_common_options(%MODULECONFIG,%CONFIG);
33 
34# handle module-specific stuff
35#
36my $LEGEND="accesses";
37 
38push @OPTIONS,(
39 "-v",$LEGEND, # Y-legend
40 "--alt-autoscale-max"); # alternate scaling
41 
42# generate diagrams
43#
44foreach my $entry (@{$MODULECONFIG{ITEM}}) {
45 my (undef,undef,undef,$DB_FILE,$name,$file,$description,$maxin,$maxout)=HotSaNICmod::common::get_names($entry);
46 
47 if (%PLOT) { next if ! defined $PLOT{$name}; }
48 
49 $DB_FILE="./rrd/$DB_FILE.rrd";
50 
51# if database exists, create images...
52 if (-e $DB_FILE) {
53 
54 print "creating images for $name ($description) ...\n";
55 foreach my $range ("1week","1month","1year") {
56 my ($timelong,$time,$build,$fullrange,$DATESTRING)=HotSaNICdiagram::get_diagram_properties($range);
57 
58 my @EXTOPTIONS=("-s","-$range", "--title", "worm-accesses to $name - last $timelong ($DATESTRING)");
59 my @COMMANDS=("DEF:min=$DB_FILE:hits:MIN",
60 "DEF:max=$DB_FILE:hits:MAX",
61 "DEF:avg=$DB_FILE:hits:AVERAGE",
62 "AREA:max#".$MODULECONFIG{COLOR_AREA}.":",
63 "LINE1:max#".$MODULECONFIG{COLOR_LINE_MAX}.":",
64 "AREA:min#ffffff:",
65 "LINE1:min#".$MODULECONFIG{COLOR_LINE_MIN}.":",
66 HotSaNICdiagram::insert_data("LINE2","avg min avg max",$MODULECONFIG{COLOR_LINE_AVERAGE},"$name","min avg max",$LEGEND,1),
67 HotSaNICdiagram::insert_lines(%MODULECONFIG));
68 
69 my %CONF=(RANGE=>$timelong,FILENAME=>"$OUTDIR/$file-$time",FORMAT=>$IMGFMT,INTERVAL=>$build,FORCE=>$FORCE,OPTIONS=>[@OPTIONS,@EXTOPTIONS,@COMMANDS],DEBUGLEVEL=>$DEBUGLEVEL,MODNAME=>$MODNAME);
70 HotSaNICdiagram::graph(%CONF);
71 }
72 }
73 
74 else { print " No database \"$DB_FILE\" found\n Please check if the daemon is running.\n"; }
75 print "\n";
76 }
77 

Powered by WebSVN 2.2.1