jablonka.czprosek.czf

hotsanic

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

 

Line No. Rev Author Line
11simandl#!/usr/bin/env perl
2 
3# $Id: diagrams.pl,v 1.21 2004/05/26 18:16:44 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.21 $') =~ s/.*(\d+\.\d+).*/$1/;
18(my $IDENTIFIER = '$Id: diagrams.pl,v 1.21 2004/05/26 18:16:44 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="bytes/s";
37 
38# common options
39#
40push @OPTIONS,(
41 "-v",$LEGEND, # Y-legend
42 "--alt-autoscale-max"); # alternate scaling
43 
44# generate diagrams
45#
46foreach my $entry (@{$MODULECONFIG{DEV}}) {
47 my (undef,undef,undef,$DB_FILE,$name,$file,$description)=HotSaNICmod::common::get_names($entry);
48 
49 if (%PLOT) { next if ! defined $PLOT{$name}; }
50 
51 $DB_FILE="./rrd/$DB_FILE.rrd";
52 
53# if database exists, create images...
54 if ( -e $DB_FILE) {
55 
56 print "creating images for $name ($description) ...\n";
57 foreach my $range ("1h","6h","1day","1week","1month","1year") {
58 my ($timelong,$time,$build,$fullrange,$DATESTRING)=HotSaNICdiagram::get_diagram_properties($range);
59 
60 my @EXTOPTIONS=("-s","-$fullrange", "--title", "I/O rates on $name - last $timelong ($DATESTRING)");
61 my @COMMANDS;
62 
63 if ($^O =~ /linux/) {
64 @COMMANDS=("DEF:iracc=$DB_FILE:racc:MIN",
65 "DEF:iwacc=$DB_FILE:wacc:MIN",
66 "DEF:irbyt=$DB_FILE:rbyt:MIN",
67 "DEF:iwbyt=$DB_FILE:wbyt:MIN",
68 "DEF:aracc=$DB_FILE:racc:AVERAGE",
69 "DEF:awacc=$DB_FILE:wacc:AVERAGE",
70 "DEF:arbyt=$DB_FILE:rbyt:AVERAGE",
71 "DEF:awbyt=$DB_FILE:wbyt:AVERAGE",
72 "DEF:xracc=$DB_FILE:racc:MAX",
73 "DEF:xwacc=$DB_FILE:wacc:MAX",
74 "DEF:xrbyt=$DB_FILE:rbyt:MAX",
75 "DEF:xwbyt=$DB_FILE:wbyt:MAX",
76 "CDEF:iwbyt_inv=0,iwbyt,-",
77 "CDEF:awbyt_inv=0,awbyt,-",
78 "CDEF:xwbyt_inv=0,xwbyt,-",
79 "AREA:xrbyt#".$MODULECONFIG{COLOR_READ_MINMAX}.":",
80 "AREA:irbyt#".$MODULECONFIG{COLOR_READ_AREA}.":",
81 HotSaNICdiagram::insert_data("LINE1","arbyt irbyt arbyt xrbyt",$MODULECONFIG{COLOR_READ_LINE},"read ","min avg max cur",$LEGEND ,1),
82 HotSaNICdiagram::insert_data("" ,"0 iracc aracc xracc" ,"000000" ," ","min avg max cur","accesses/s",1),
83 "COMMENT:\\s",
84 "AREA:xwbyt_inv#".$MODULECONFIG{COLOR_WRITE_MINMAX}.":",
85 "AREA:iwbyt_inv#".$MODULECONFIG{COLOR_WRITE_AREA}.":",
86 HotSaNICdiagram::insert_data("LINE1","awbyt_inv iwbyt awbyt xwbyt",$MODULECONFIG{COLOR_WRITE_LINE},"write","min avg max cur",$LEGEND ,1),
87 HotSaNICdiagram::insert_data("" ,"0 iwacc awacc xwacc" ,"000000" ," ","min avg max cur","accesses/s",1),
88 HotSaNICdiagram::insert_lines(%MODULECONFIG));
89 }
90 elsif ($^O =~ /bsd/) {
91 @COMMANDS=("DEF:ikbt=$DB_FILE:kbt:MIN",
92 "DEF:akbt=$DB_FILE:kbt:AVERAGE",
93 "DEF:xkbt=$DB_FILE:kbt:MAX",
94 "DEF:ixfr=$DB_FILE:xfr:MIN",
95 "DEF:axfr=$DB_FILE:xfr:AVERAGE",
96 "DEF:xxfr=$DB_FILE:xfr:MAX",
97 "DEF:itime=$DB_FILE:time:MIN",
98 "DEF:atime=$DB_FILE:time:AVERAGE",
99 "DEF:xtime=$DB_FILE:time:MAX",
100 "DEF:imb=$DB_FILE:mb:MIN",
101 "DEF:amb=$DB_FILE:mb:AVERAGE",
102 "DEF:xmb=$DB_FILE:mb:MAX",
103 HotSaNICdiagram::insert_minmax("imb xmb",$MODULECONFIG{COLOR_READ_MINMAX},$MODULECONFIG{COLOR_BORDER},"max/min",$LEGEND,1),
104 HotSaNICdiagram::insert_data("LINE1","amb imb amb xmb",$MODULECONFIG{COLOR_READ_LINE},"Disk Transfer","min avg max cur",$LEGEND,1),
105# HotSaNICdiagram::insert_data("AREA","amb imb amb xmb",$MODULECONFIG{COLOR_WRITE_LINE},"Disk Transfer","min avg max cur",$LEGEND,1),
106# "AREA:amb#FF4040:Disk Transfer\\g",
107# "GPRINT:imb:MIN: min\\:%7.2lf %s",
108# "GPRINT:amb:AVERAGE: avg\\:%7.2lf %s",
109# "GPRINT:xmb:MAX: max\\:%7.2lf %s bytes/s\\n",
110 "COMMENT:\\s",
111 HotSaNICdiagram::insert_lines(%MODULECONFIG));
112 }
113 
114 my %CONF=(RANGE=>$timelong,FILENAME=>"$OUTDIR/$file-$time",FORMAT=>$IMGFMT,INTERVAL=>$build,FORCE=>$FORCE,OPTIONS=>[@OPTIONS,@EXTOPTIONS,@COMMANDS],DEBUGLEVEL=>$DEBUGLEVEL,MODNAME=>$MODNAME);
115 HotSaNICdiagram::graph(%CONF);
116 }
117 }
118 else { print " No database \"$DB_FILE\" found\n Please check if the daemon is running.\n"; }
119 print "\n";
120 }
121exit 0;
122 

Powered by WebSVN 2.2.1