2013-01-04 08:27:05 +00:00
#
# Monitorix - A lightweight system monitoring tool.
#
2016-01-25 17:35:30 +00:00
# Copyright (C) 2005-2016 by Jordi Sanfeliu <jordi@fibranet.cat>
2013-01-04 08:27:05 +00:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
package nfsc ;
use strict ;
use warnings ;
use Monitorix ;
use RRDs ;
use Exporter 'import' ;
our @ EXPORT = qw( nfsc_init nfsc_update nfsc_cgi ) ;
sub nfsc_init {
my $ myself = ( caller ( 0 ) ) [ 3 ] ;
my ( $ package , $ config , $ debug ) = @ _ ;
my $ rrd = $ config - > { base_lib } . $ package . ".rrd" ;
2013-10-28 10:40:06 +00:00
my $ info ;
my @ rra ;
my @ tmp ;
my $ n ;
my @ average ;
my @ min ;
my @ max ;
my @ last ;
2013-01-04 08:27:05 +00:00
if ( grep { $ _ eq $ config - > { os } } ( "FreeBSD" , "OpenBSD" , "NetBSD" ) ) {
logger ( "$myself is not supported yet by your operating system ($config->{os})." ) ;
return ;
}
2013-07-03 15:54:09 +01:00
if ( $ config - > { os } eq "Linux" ) {
if ( ! ( - e "/proc/net/rpc/nfs" ) ) {
logger ( "$myself: it doesn't seems you have a NFS client running in this machine." ) ;
return ;
}
}
2013-10-28 10:40:06 +00:00
if ( - e $ rrd ) {
$ info = RRDs:: info ( $ rrd ) ;
for my $ key ( keys %$ info ) {
if ( index ( $ key , 'rra[' ) == 0 ) {
if ( index ( $ key , '.rows' ) != - 1 ) {
push ( @ rra , substr ( $ key , 4 , index ( $ key , ']' ) - 4 ) ) ;
}
}
}
2013-11-04 15:51:19 +00:00
if ( scalar ( @ rra ) < 12 + ( 4 * $ config - > { max_historic_years } ) ) {
2013-10-28 10:40:06 +00:00
logger ( "$myself: Detected size mismatch between 'max_historic_years' (" . $ config - > { max_historic_years } . ") and $rrd (" . ( ( scalar ( @ rra ) - 12 ) / 4 ) . "). Resizing it accordingly. All historical data will be lost. Backup file created." ) ;
rename ( $ rrd , "$rrd.bak" ) ;
}
}
2013-01-04 08:27:05 +00:00
if ( ! ( - e $ rrd ) ) {
logger ( "Creating '$rrd' file." ) ;
2013-10-28 10:40:06 +00:00
for ( $ n = 1 ; $ n <= $ config - > { max_historic_years } ; $ n + + ) {
push ( @ average , "RRA:AVERAGE:0.5:1440:" . ( 365 * $ n ) ) ;
push ( @ min , "RRA:MIN:0.5:1440:" . ( 365 * $ n ) ) ;
push ( @ max , "RRA:MAX:0.5:1440:" . ( 365 * $ n ) ) ;
push ( @ last , "RRA:LAST:0.5:1440:" . ( 365 * $ n ) ) ;
}
2013-01-04 08:27:05 +00:00
eval {
RRDs:: create ( $ rrd ,
"--step=60" ,
"DS:nfsc_0:COUNTER:120:0:U" ,
"DS:nfsc_1:COUNTER:120:0:U" ,
"DS:nfsc_2:COUNTER:120:0:U" ,
"DS:nfsc_3:COUNTER:120:0:U" ,
"DS:nfsc_4:COUNTER:120:0:U" ,
"DS:nfsc_5:COUNTER:120:0:U" ,
"DS:nfsc_6:COUNTER:120:0:U" ,
"DS:nfsc_7:COUNTER:120:0:U" ,
"DS:nfsc_8:COUNTER:120:0:U" ,
"DS:nfsc_9:COUNTER:120:0:U" ,
"DS:nfsc_10:COUNTER:120:0:U" ,
"DS:nfsc_11:COUNTER:120:0:U" ,
"DS:nfsc_12:COUNTER:120:0:U" ,
"DS:nfsc_13:COUNTER:120:0:U" ,
"DS:nfsc_14:COUNTER:120:0:U" ,
"DS:nfsc_15:COUNTER:120:0:U" ,
"DS:nfsc_16:COUNTER:120:0:U" ,
"DS:nfsc_17:COUNTER:120:0:U" ,
"DS:nfsc_18:COUNTER:120:0:U" ,
"DS:nfsc_19:COUNTER:120:0:U" ,
"DS:nfsc_20:COUNTER:120:0:U" ,
"DS:nfsc_21:COUNTER:120:0:U" ,
"DS:nfsc_22:COUNTER:120:0:U" ,
"DS:nfsc_23:COUNTER:120:0:U" ,
"DS:nfsc_24:COUNTER:120:0:U" ,
"DS:nfsc_25:COUNTER:120:0:U" ,
"DS:nfsc_26:COUNTER:120:0:U" ,
"DS:nfsc_27:COUNTER:120:0:U" ,
"DS:nfsc_28:COUNTER:120:0:U" ,
"DS:nfsc_29:COUNTER:120:0:U" ,
"DS:nfsc_30:COUNTER:120:0:U" ,
"DS:nfsc_31:COUNTER:120:0:U" ,
"DS:nfsc_32:COUNTER:120:0:U" ,
"DS:nfsc_33:COUNTER:120:0:U" ,
"DS:nfsc_34:COUNTER:120:0:U" ,
"DS:nfsc_35:COUNTER:120:0:U" ,
"DS:nfsc_36:COUNTER:120:0:U" ,
"DS:nfsc_37:COUNTER:120:0:U" ,
"DS:nfsc_38:COUNTER:120:0:U" ,
"DS:nfsc_39:COUNTER:120:0:U" ,
"DS:nfsc_40:COUNTER:120:0:U" ,
"DS:nfsc_41:COUNTER:120:0:U" ,
"DS:nfsc_42:COUNTER:120:0:U" ,
"DS:nfsc_43:COUNTER:120:0:U" ,
"DS:nfsc_44:COUNTER:120:0:U" ,
"DS:nfsc_45:COUNTER:120:0:U" ,
"DS:nfsc_46:COUNTER:120:0:U" ,
"DS:nfsc_47:COUNTER:120:0:U" ,
"DS:nfsc_48:COUNTER:120:0:U" ,
"DS:nfsc_49:COUNTER:120:0:U" ,
"DS:nfsc_rpc_1:COUNTER:120:0:U" ,
"DS:nfsc_rpc_2:COUNTER:120:0:U" ,
"DS:nfsc_rpc_3:COUNTER:120:0:U" ,
"DS:nfsc_rpc_4:COUNTER:120:0:U" ,
"DS:nfsc_rpc_5:COUNTER:120:0:U" ,
"RRA:AVERAGE:0.5:1:1440" ,
"RRA:AVERAGE:0.5:30:336" ,
"RRA:AVERAGE:0.5:60:744" ,
2013-10-28 10:40:06 +00:00
@ average ,
2013-01-04 08:27:05 +00:00
"RRA:MIN:0.5:1:1440" ,
"RRA:MIN:0.5:30:336" ,
"RRA:MIN:0.5:60:744" ,
2013-10-28 10:40:06 +00:00
@ min ,
2013-01-04 08:27:05 +00:00
"RRA:MAX:0.5:1:1440" ,
"RRA:MAX:0.5:30:336" ,
"RRA:MAX:0.5:60:744" ,
2013-10-28 10:40:06 +00:00
@ max ,
2013-01-04 08:27:05 +00:00
"RRA:LAST:0.5:1:1440" ,
"RRA:LAST:0.5:30:336" ,
"RRA:LAST:0.5:60:744" ,
2013-10-28 10:40:06 +00:00
@ last ,
2013-01-04 08:27:05 +00:00
) ;
} ;
my $ err = RRDs:: error ;
if ( $@ || $ err ) {
logger ( "$@" ) unless ! $@ ;
if ( $ err ) {
logger ( "ERROR: while creating $rrd: $err" ) ;
if ( $ err eq "RRDs::error" ) {
logger ( "... is the RRDtool Perl package installed?" ) ;
}
}
return ;
}
}
push ( @ { $ config - > { func_update } } , $ package ) ;
logger ( "$myself: Ok" ) if $ debug ;
}
sub nfsc_update {
my $ myself = ( caller ( 0 ) ) [ 3 ] ;
my ( $ package , $ config , $ debug ) = @ _ ;
my $ rrd = $ config - > { base_lib } . $ package . ".rrd" ;
my $ nfsc = $ config - > { nfsc } ;
my @ rpc ;
my @ nfsc ;
my $ n ;
my $ rrdata = "N" ;
if ( $ config - > { os } eq "Linux" ) {
if ( open ( IN , "/proc/net/rpc/nfs" ) ) {
while ( <IN> ) {
if ( /^rpc\s+(\d+)\s+(\d+)\s+(\d+)$/ ) {
@ rpc = ( $ 1 , $ 2 , $ 3 ) ;
}
if ( /^proc$nfsc->{version} / ) {
my @ tmp = split ( ' ' , $ _ ) ;
( undef , undef , @ nfsc ) = @ tmp ;
}
}
close ( IN ) ;
} else {
2013-07-03 15:54:09 +01:00
logger ( "$myself: ERROR: Unable to open '/proc/net/rpc/nfs'. $!." ) ;
2013-01-04 08:27:05 +00:00
return ;
}
}
for ( $ n = 0 ; $ n < 50 ; $ n + + ) {
if ( ! defined ( $ nfsc [ $ n ] ) ) {
$ nfsc [ $ n ] = 0 ;
}
$ rrdata . = ":" . $ nfsc [ $ n ] ;
}
$ rrdata . = ":$rpc[0]:$rpc[1]:$rpc[2]:0:0" ;
RRDs:: update ( $ rrd , $ rrdata ) ;
logger ( "$myself: $rrdata" ) if $ debug ;
my $ err = RRDs:: error ;
logger ( "ERROR: while updating $rrd: $err" ) if $ err ;
}
sub nfsc_cgi {
my ( $ package , $ config , $ cgi ) = @ _ ;
my $ nfsc = $ config - > { nfsc } ;
2014-06-20 09:25:09 +01:00
my @ rigid = split ( ',' , ( $ nfsc - > { rigid } || "" ) ) ;
my @ limit = split ( ',' , ( $ nfsc - > { limit } || "" ) ) ;
2013-01-04 08:27:05 +00:00
my $ tf = $ cgi - > { tf } ;
my $ colors = $ cgi - > { colors } ;
my $ graph = $ cgi - > { graph } ;
my $ silent = $ cgi - > { silent } ;
2013-07-29 17:03:13 +01:00
my $ zoom = "--zoom=" . $ config - > { global_zoom } ;
2015-01-26 18:07:03 +00:00
my % rrd = (
'new' = > \ & RRDs:: graphv ,
'old' = > \ & RRDs:: graph ,
) ;
my $ version = "new" ;
my $ pic ;
my $ picz ;
my $ picz_width ;
my $ picz_height ;
2013-01-04 08:27:05 +00:00
my $ u = "" ;
my $ width ;
my $ height ;
my @ riglim ;
my @ tmp ;
my @ tmpz ;
my @ tmp1 ;
my @ tmp2 ;
my @ tmp1z ;
my @ tmp2z ;
my @ DEF ;
2013-07-03 16:25:14 +01:00
my @ CDEF ;
my @ allvalues ;
my @ allsigns ;
2013-01-04 08:27:05 +00:00
my $ n ;
my $ err ;
my @ AC = (
"#FFA500" ,
"#44EEEE" ,
"#44EE44" ,
"#4444EE" ,
"#448844" ,
"#EE4444" ,
"#EE44EE" ,
"#EEEE44" ,
"#963C74" ,
"#CCCCCC" ,
) ;
my @ LC = (
"#FFA500" ,
"#00EEEE" ,
"#00EE00" ,
"#0000EE" ,
"#448844" ,
"#EE0000" ,
"#EE00EE" ,
"#EEEE00" ,
"#B4B444" ,
"#888888" ,
) ;
2015-01-26 18:07:03 +00:00
$ version = "old" if $ RRDs:: VERSION < 1.3 ;
2013-01-04 08:27:05 +00:00
my $ rrd = $ config - > { base_lib } . $ package . ".rrd" ;
my $ title = $ config - > { graph_title } - > { $ package } ;
2016-01-25 17:35:30 +00:00
my $ IMG_DIR = $ config - > { base_dir } . "/" . $ config - > { imgs_dir } ;
my $ imgfmt_uc = uc ( $ config - > { image_format } ) ;
my $ imgfmt_lc = lc ( $ config - > { image_format } ) ;
2013-01-04 08:27:05 +00:00
my @ nfsv2 = ( "null" , "getattr" , "setattr" , "root" , "lookup" , "readlink" , "read" , "wrcache" , "write" , "create" , "remove" , "rename" , "link" , "symlink" , "mkdir" , "rmdir" , "readdir" , "fsstat" ) ;
my @ nfsv3 = ( "null" , "getattr" , "setattr" , "lookup" , "access" , "readlink" , "read" , "write" , "create" , "mkdir" , "symlink" , "mknod" , "remove" , "rmdir" , "rename" , "link" , "readdir" , "readdirplus" , "fsstat" , "fsinfo" , "pathconf" , "commit" ) ;
my @ nfscv4 = ( "null" , "read" , "write" , "commit" , "open" , "open_conf" , "open_noat" , "open_dgrd" , "close" , "setattr" , "fsinfo" , "renew" , "setclntid" , "confirm" , "lock" , "lockt" , "locku" , "access" , "getattr" , "lookup" , "lookup_root" , "remove" , "rename" , "link" , "symlink" , "create" , "pathconf" , "statfs" , "readlink" , "readdir" , "server_caps" , "delegreturn" , "getacl" , "setacl" , "fs_locations" , "exchange_id" , "create_ses" , "destroy_ses" , "sequence" , "get_lease_t" , "reclaim_comp" , "layoutget" , "layoutcommit" , "layoutreturn" , "getdevlist" , "getdevinfo" , "ds_write" , "ds_commit" ) ;
my @ nfsv ;
# default version is NFS v3
if ( $ nfsc - > { version } eq "2" ) {
@ nfsv = @ nfsv2 ;
} elsif ( $ nfsc - > { version } eq "4" ) {
@ nfsv = @ nfscv4 ;
} else {
@ nfsv = @ nfsv3 ;
}
$ title = ! $ silent ? $ title : "" ;
$ title =~ s/NFS/NFS v$nfsc->{version}/ ;
# text mode
#
if ( lc ( $ config - > { iface_mode } ) eq "text" ) {
if ( $ title ) {
main:: graph_header ( $ title , 2 ) ;
print ( " <tr>\n" ) ;
print ( " <td bgcolor='$colors->{title_bg_color}'>\n" ) ;
}
my ( undef , undef , undef , $ data ) = RRDs:: fetch ( "$rrd" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
"AVERAGE" ,
"-r $tf->{res}" ) ;
$ err = RRDs:: error ;
print ( "ERROR: while fetching $rrd: $err\n" ) if $ err ;
my $ str ;
my $ line1 ;
my $ line2 ;
print ( " <pre style='font-size: 12px; color: $colors->{fg_color}';>\n" ) ;
foreach my $ t ( @ nfsv ) {
$ str = sprintf ( "%12s " , $ t ) ;
$ line1 . = $ str ;
$ line2 . = "-------------" ;
}
$ line1 . = sprintf ( "%12s %12s %12s" , "calls" , "retrans" , "authrefrsh" ) ;
$ line2 . = "-------------" . "-------------" . "-------------" ;
print ( "Time $line1\n" ) ;
print ( "-----$line2\n" ) ;
my $ line ;
my @ row ;
my $ time ;
my $ n2 ;
my @ nfs ;
for ( $ n = 0 , $ time = $ tf - > { tb } ; $ n < ( $ tf - > { tb } * $ tf - > { ts } ) ; $ n + + ) {
$ line = @$ data [ $ n ] ;
undef ( $ line1 ) ;
undef ( @ row ) ;
( @ nfs ) = @$ line [ 0 .. scalar ( @ nfsv ) - 1 ] ;
for ( $ n2 = 0 ; $ n2 < scalar ( @ nfs ) ; $ n2 + + ) {
push ( @ row , $ nfs [ $ n2 ] ) ;
$ line1 . = "%12d " ;
}
push ( @ row , @$ line [ 50 .. 52 ] ) ;
$ line1 . = "%12d %12d %12d " ;
$ time = $ time - ( 1 / $ tf - > { ts } ) ;
printf ( " %2d$tf->{tc} $line1\n" , $ time , @ row ) ;
}
print ( " </pre>\n" ) ;
if ( $ title ) {
print ( " </td>\n" ) ;
print ( " </tr>\n" ) ;
main:: graph_footer ( ) ;
}
print ( " <br>\n" ) ;
return ;
}
# graph mode
#
if ( $ silent eq "yes" || $ silent eq "imagetag" ) {
$ colors - > { fg_color } = "#000000" ; # visible color for text mode
$ u = "_" ;
}
if ( $ silent eq "imagetagbig" ) {
$ colors - > { fg_color } = "#000000" ; # visible color for text mode
$ u = "" ;
}
2016-01-25 17:35:30 +00:00
my $ IMG1 = $ u . $ package . "1." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG2 = $ u . $ package . "2." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG3 = $ u . $ package . "3." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG4 = $ u . $ package . "4." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG5 = $ u . $ package . "5." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG6 = $ u . $ package . "6." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG1z = $ u . $ package . "1z." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG2z = $ u . $ package . "2z." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG3z = $ u . $ package . "3z." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG4z = $ u . $ package . "4z." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG5z = $ u . $ package . "5z." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG6z = $ u . $ package . "6z." . $ tf - > { when } . ".$imgfmt_lc" ;
unlink ( "$IMG_DIR" . "$IMG1" ,
"$IMG_DIR" . "$IMG2" ,
"$IMG_DIR" . "$IMG3" ,
"$IMG_DIR" . "$IMG4" ,
"$IMG_DIR" . "$IMG5" ,
"$IMG_DIR" . "$IMG6" ) ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
unlink ( "$IMG_DIR" . "$IMG1z" ,
"$IMG_DIR" . "$IMG2z" ,
"$IMG_DIR" . "$IMG3z" ,
"$IMG_DIR" . "$IMG4z" ,
"$IMG_DIR" . "$IMG5z" ,
"$IMG_DIR" . "$IMG6z" ) ;
2013-01-04 08:27:05 +00:00
}
if ( $ title ) {
main:: graph_header ( $ title , 2 ) ;
}
2014-06-20 09:25:09 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 0 ] , $ limit [ 0 ] ) } ;
2013-01-04 08:27:05 +00:00
if ( $ title ) {
print ( " <tr>\n" ) ;
print ( " <td valign='top' bgcolor='$colors->{title_bg_color}'>\n" ) ;
}
for ( $ n = 0 ; $ n < 10 ; $ n + + ) {
my $ str = trim ( ( split ( ',' , $ nfsc - > { graph_0 } ) ) [ $ n ] ) || "" ;
if ( grep { $ _ eq $ str } @ nfsv ) {
my ( $ i ) = grep { $ nfsv [ $ _ ] eq $ str } 0 .. $# nfsv ;
push ( @ DEF , "DEF:nfs_$i=$rrd:nfsc_$i:AVERAGE" ) ;
push ( @ tmp , "LINE1:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp , "GPRINT:nfs_$i:LAST: Cur\\: %6.1lf" ) ;
push ( @ tmp , "GPRINT:nfs_$i:AVERAGE: Avg\\: %6.1lf" ) ;
push ( @ tmp , "GPRINT:nfs_$i:MIN: Min\\: %6.1lf" ) ;
push ( @ tmp , "GPRINT:nfs_$i:MAX: Max\\: %6.1lf\\n" ) ;
push ( @ tmpz , "LINE2:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
2013-07-03 16:25:14 +01:00
push ( @ allvalues , "nfs_$i" ) ;
push ( @ allsigns , "+" ) ;
2013-01-04 08:27:05 +00:00
} else {
push ( @ tmp , "COMMENT: \\n" ) ;
}
}
2013-07-03 16:25:14 +01:00
pop ( @ allsigns ) ;
push ( @ CDEF , "CDEF:allvalues=" . join ( ',' , @ allvalues , @ allsigns ) ) ;
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG1" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc1} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ,
"COMMENT: \\n" ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG1: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG1z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc1} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2015-01-26 18:07:03 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG1z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /nfsc1/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
print ( " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2015-01-26 18:07:03 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2016-01-25 17:35:30 +00:00
print ( " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2016-01-25 17:35:30 +00:00
print ( " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
2014-06-20 09:25:09 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 1 ] , $ limit [ 1 ] ) } ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
undef ( @ DEF ) ;
2013-07-03 16:25:14 +01:00
undef ( @ CDEF ) ;
undef ( @ allvalues ) ;
undef ( @ allsigns ) ;
2013-01-04 08:27:05 +00:00
for ( $ n = 0 ; $ n < 10 ; $ n + + ) {
my $ str = trim ( ( split ( ',' , $ nfsc - > { graph_1 } ) ) [ $ n ] ) || "" ;
if ( grep { $ _ eq $ str } @ nfsv ) {
my ( $ i ) = grep { $ nfsv [ $ _ ] eq $ str } 0 .. $# nfsv ;
push ( @ DEF , "DEF:nfs_$i=$rrd:nfsc_$i:AVERAGE" ) ;
push ( @ tmp , "LINE1:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp , "GPRINT:nfs_$i:LAST: Cur\\: %6.1lf" ) ;
push ( @ tmp , "GPRINT:nfs_$i:AVERAGE: Avg\\: %6.1lf" ) ;
push ( @ tmp , "GPRINT:nfs_$i:MIN: Min\\: %6.1lf" ) ;
push ( @ tmp , "GPRINT:nfs_$i:MAX: Max\\: %6.1lf\\n" ) ;
push ( @ tmpz , "LINE2:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
2013-07-03 16:25:14 +01:00
push ( @ allvalues , "nfs_$i" ) ;
push ( @ allsigns , "+" ) ;
2013-01-04 08:27:05 +00:00
} else {
push ( @ tmp , "COMMENT: \\n" ) ;
}
}
2013-07-03 16:25:14 +01:00
pop ( @ allsigns ) ;
push ( @ CDEF , "CDEF:allvalues=" . join ( ',' , @ allvalues , @ allsigns ) ) ;
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG2" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc2} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG2: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG2z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc2} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2015-01-26 18:07:03 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG2z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /nfsc2/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
print ( " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2015-01-26 18:07:03 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2016-01-25 17:35:30 +00:00
print ( " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2016-01-25 17:35:30 +00:00
print ( " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
2013-01-04 09:40:31 +00:00
2013-01-04 08:27:05 +00:00
if ( $ title ) {
print ( " </td>\n" ) ;
print ( " <td valign='top' bgcolor='" . $ colors - > { title_bg_color } . "'>\n" ) ;
}
2014-06-20 09:25:09 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 2 ] , $ limit [ 2 ] ) } ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
undef ( @ tmp1 ) ;
undef ( @ tmp2 ) ;
undef ( @ tmp1z ) ;
undef ( @ tmp2z ) ;
undef ( @ DEF ) ;
2013-07-03 16:25:14 +01:00
undef ( @ CDEF ) ;
undef ( @ allvalues ) ;
undef ( @ allsigns ) ;
2013-01-04 08:27:05 +00:00
for ( $ n = 0 ; $ n < 4 ; $ n + + ) {
my $ str = trim ( ( split ( ',' , $ nfsc - > { graph_2 } ) ) [ $ n ] ) || "" ;
if ( grep { $ _ eq $ str } @ nfsv ) {
my ( $ i ) = grep { $ nfsv [ $ _ ] eq $ str } 0 .. $# nfsv ;
push ( @ DEF , "DEF:nfs_$i=$rrd:nfsc_$i:AVERAGE" ) ;
push ( @ tmp1 , "AREA:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp1 , "GPRINT:nfs_$i:LAST: Current\\: %6.1lf\\n" ) ;
push ( @ tmp2 , "LINE1:nfs_$i$LC[$n]" ) ;
push ( @ tmp1z , "AREA:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp2z , "LINE1:nfs_$i$LC[$n]" ) ;
2013-07-03 16:25:14 +01:00
push ( @ allvalues , "nfs_$i" ) ;
push ( @ allsigns , "+" ) ;
2013-01-04 08:27:05 +00:00
} else {
push ( @ tmp1 , "COMMENT: \\n" ) ;
}
}
@ tmp = ( @ tmp1 , @ tmp2 ) ;
@ tmpz = ( @ tmp1z , @ tmp2z ) ;
2013-07-03 16:25:14 +01:00
pop ( @ allsigns ) ;
push ( @ CDEF , "CDEF:allvalues=" . join ( ',' , @ allvalues , @ allsigns ) ) ;
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { small } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG3" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc3} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG3: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG3z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc3} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2015-01-26 18:07:03 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG3z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /nfsc3/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
print ( " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2015-01-26 18:07:03 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2016-01-25 17:35:30 +00:00
print ( " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2016-01-25 17:35:30 +00:00
print ( " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
2014-06-20 09:25:09 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 3 ] , $ limit [ 3 ] ) } ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
undef ( @ tmp1 ) ;
undef ( @ tmp2 ) ;
undef ( @ tmp1z ) ;
undef ( @ tmp2z ) ;
undef ( @ DEF ) ;
2013-07-03 16:25:14 +01:00
undef ( @ CDEF ) ;
undef ( @ allvalues ) ;
undef ( @ allsigns ) ;
2013-01-04 08:27:05 +00:00
for ( $ n = 0 ; $ n < 4 ; $ n + + ) {
my $ str = trim ( ( split ( ',' , $ nfsc - > { graph_3 } ) ) [ $ n ] ) || "" ;
if ( grep { $ _ eq $ str } @ nfsv ) {
my ( $ i ) = grep { $ nfsv [ $ _ ] eq $ str } 0 .. $# nfsv ;
push ( @ DEF , "DEF:nfs_$i=$rrd:nfsc_$i:AVERAGE" ) ;
push ( @ tmp1 , "AREA:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp1 , "GPRINT:nfs_$i:LAST: Current\\: %6.1lf\\n" ) ;
push ( @ tmp2 , "LINE1:nfs_$i$LC[$n]" ) ;
push ( @ tmp1z , "AREA:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp2z , "LINE1:nfs_$i$LC[$n]" ) ;
2013-07-03 16:25:14 +01:00
push ( @ allvalues , "nfs_$i" ) ;
push ( @ allsigns , "+" ) ;
2013-01-04 08:27:05 +00:00
} else {
push ( @ tmp1 , "COMMENT: \\n" ) ;
}
}
@ tmp = ( @ tmp1 , @ tmp2 ) ;
@ tmpz = ( @ tmp1z , @ tmp2z ) ;
2013-07-03 16:25:14 +01:00
pop ( @ allsigns ) ;
push ( @ CDEF , "CDEF:allvalues=" . join ( ',' , @ allvalues , @ allsigns ) ) ;
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { small } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG4" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc4} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG4: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG4z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc4} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2015-01-26 18:07:03 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG4z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /nfsc4/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
print ( " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG4z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG4 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2015-01-26 18:07:03 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2016-01-25 17:35:30 +00:00
print ( " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG4z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG4 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2016-01-25 17:35:30 +00:00
print ( " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG4 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
2014-06-20 09:25:09 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 4 ] , $ limit [ 4 ] ) } ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
undef ( @ tmp1 ) ;
undef ( @ tmp2 ) ;
undef ( @ tmp1z ) ;
undef ( @ tmp2z ) ;
undef ( @ DEF ) ;
2013-07-03 16:25:14 +01:00
undef ( @ CDEF ) ;
undef ( @ allvalues ) ;
undef ( @ allsigns ) ;
2013-01-04 08:27:05 +00:00
for ( $ n = 0 ; $ n < 4 ; $ n + + ) {
my $ str = trim ( ( split ( ',' , $ nfsc - > { graph_4 } ) ) [ $ n ] ) ;
if ( grep { $ _ eq $ str } @ nfsv ) {
my ( $ i ) = grep { $ nfsv [ $ _ ] eq $ str } 0 .. $# nfsv ;
push ( @ DEF , "DEF:nfs_$i=$rrd:nfsc_$i:AVERAGE" ) ;
push ( @ tmp1 , "AREA:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp1 , "GPRINT:nfs_$i:LAST: Current\\: %6.1lf\\n" ) ;
push ( @ tmp2 , "LINE1:nfs_$i$LC[$n]" ) ;
push ( @ tmp1z , "AREA:nfs_$i$AC[$n]:" . sprintf ( "%-12s" , $ str ) ) ;
push ( @ tmp2z , "LINE1:nfs_$i$LC[$n]" ) ;
2013-07-03 16:25:14 +01:00
push ( @ allvalues , "nfs_$i" ) ;
push ( @ allsigns , "+" ) ;
2013-01-04 08:27:05 +00:00
} else {
push ( @ tmp1 , "COMMENT: \\n" ) ;
}
}
@ tmp = ( @ tmp1 , @ tmp2 ) ;
@ tmpz = ( @ tmp1z , @ tmp2z ) ;
2013-07-03 16:25:14 +01:00
pop ( @ allsigns ) ;
push ( @ CDEF , "CDEF:allvalues=" . join ( ',' , @ allvalues , @ allsigns ) ) ;
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { small } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG5" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc5} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG5: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG5z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc5} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2015-01-26 18:07:03 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
@ DEF ,
2013-07-03 16:25:14 +01:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG5z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /nfsc5/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
print ( " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG5z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG5 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2015-01-26 18:07:03 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2016-01-25 17:35:30 +00:00
print ( " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG5z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG5 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2016-01-25 17:35:30 +00:00
print ( " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG5 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
2014-06-20 09:25:09 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 5 ] , $ limit [ 5 ] ) } ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
2013-07-03 16:25:14 +01:00
undef ( @ CDEF ) ;
2013-01-04 08:27:05 +00:00
push ( @ tmp , "AREA:calls#44EEEE:Calls" ) ;
push ( @ tmp , "GPRINT:calls:LAST: Current\\: %7.1lf\\n" ) ;
push ( @ tmp , "AREA:retrans#EEEE44:Retransmissions" ) ;
push ( @ tmp , "GPRINT:retrans:LAST: Current\\: %7.1lf\\n" ) ;
push ( @ tmp , "AREA:authref#EE4444:Auth Refresh" ) ;
push ( @ tmp , "GPRINT:authref:LAST: Current\\: %7.1lf\\n" ) ;
push ( @ tmp , "LINE1:calls#00EEEE" ) ;
push ( @ tmp , "LINE1:retrans#EEEE00" ) ;
push ( @ tmp , "LINE1:authref#EE0000" ) ;
push ( @ tmpz , "AREA:calls#44EEEE:Calls" ) ;
push ( @ tmpz , "AREA:retrans#EEEE44:Retransmissions" ) ;
push ( @ tmpz , "AREA:authref#EE4444:Auth Refresh" ) ;
push ( @ tmpz , "LINE1:calls#00EEEE" ) ;
push ( @ tmpz , "LINE1:retrans#EEEE00" ) ;
push ( @ tmpz , "LINE1:authref#EE0000" ) ;
2013-07-03 16:25:14 +01:00
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { small } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
push ( @ tmp , "COMMENT: \\n" ) ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG6" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc6} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:calls=$rrd:nfsc_rpc_1:AVERAGE" ,
"DEF:retrans=$rrd:nfsc_rpc_2:AVERAGE" ,
"DEF:authref=$rrd:nfsc_rpc_3:AVERAGE" ,
2013-07-03 16:25:14 +01:00
"CDEF:allvalues=calls,retrans,authref,+,+" ,
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG6: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG6z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_nfsc6} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-01-04 08:27:05 +00:00
"--vertical-label=Requests/s" ,
"--width=$width" ,
"--height=$height" ,
@ riglim ,
2015-01-26 18:07:03 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:calls=$rrd:nfsc_rpc_1:AVERAGE" ,
"DEF:retrans=$rrd:nfsc_rpc_2:AVERAGE" ,
"DEF:authref=$rrd:nfsc_rpc_3:AVERAGE" ,
2013-07-03 16:25:14 +01:00
"CDEF:allvalues=calls,retrans,authref,+,+" ,
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2016-01-25 17:35:30 +00:00
print ( "ERROR: while graphing $IMG_DIR" . "$IMG6z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /nfsc6/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
print ( " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG6z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG6 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2015-01-26 18:07:03 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2016-01-25 17:35:30 +00:00
print ( " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG6z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG6 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2016-01-25 17:35:30 +00:00
print ( " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG6 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
if ( $ title ) {
print ( " </td>\n" ) ;
print ( " </tr>\n" ) ;
main:: graph_footer ( ) ;
}
print ( " <br>\n" ) ;
return ;
}
1 ;