Index: Makefile.in =================================================================== --- Makefile.in (.../upstream/pnp-0.4.8) (revision 42) +++ Makefile.in (.../branches/pnp-0.4.8) (revision 42) @@ -96,6 +96,9 @@ install-processperfdata: cd $(SRC_SCRIPTS) && $(MAKE) install +install-man: + cd $(SRC_MAN) && $(MAKE) install + install-init: cd $(SRC_SCRIPTS) && $(MAKE) install-init @@ -124,5 +127,5 @@ @echo "configuration files" @echo "" -fullinstall: install install-init install-config +fullinstall: install install-init install-man install-config install-processperfdata install-html Index: sample-config/pnp/process_perfdata.cfg-sample.in =================================================================== --- sample-config/pnp/process_perfdata.cfg-sample.in (.../upstream/pnp-0.4.8) (revision 42) +++ sample-config/pnp/process_perfdata.cfg-sample.in (.../branches/pnp-0.4.8) (revision 42) @@ -47,3 +47,9 @@ # The supported encodings are ISO-8859-1, UTF-8 and US-ASCII. # http://www.php.net/xml-parser-create XML_ENC = UTF-8 +# +# NORMALIZE_VALUES +# Converting to base unit before storing values in RRD. +# For example kB in Bytes and ms in s +# +# NORMALIZE_VALUES = 1 Index: sample-config/pnp/check_commands/check_nwstat.cfg-sample =================================================================== --- sample-config/pnp/check_commands/check_nwstat.cfg-sample (.../upstream/pnp-0.4.8) (revision 42) +++ sample-config/pnp/check_commands/check_nwstat.cfg-sample (.../branches/pnp-0.4.8) (revision 42) @@ -13,3 +13,9 @@ # Defaults to GAUGE. # # DATATYPE = COUNTER + +# Change the RRD Datatype based on the check_command name. +# Specifiy each datasource +# +# Example for check_iftraffic +# DATATYPES = COUNTER:COUNTER:GAUGE:GAUGE Index: AUTHORS =================================================================== --- AUTHORS (.../upstream/pnp-0.4.8) (revision 42) +++ AUTHORS (.../branches/pnp-0.4.8) (revision 42) @@ -1,3 +1,4 @@ Authors: Jörg Linge pitchfork@pnp4nagios.org Hendrik Bäcker andurin@process-zero.de +Herbert Straub Index: ChangeLog =================================================================== --- ChangeLog (.../upstream/pnp-0.4.8) (revision 42) +++ ChangeLog (.../branches/pnp-0.4.8) (revision 42) @@ -1,6 +1,18 @@ Last changed: $Id: ChangeLog 445 2008-05-01 10:42:41Z pitchfork $ -**SVN Current:** +**Version 0.4.8.1 2008-05-09 Herbert Straub + * process_perfdata.pl: adding normalize_values function + * RRD Datatype definition per DS count + * Removing AC_STRUCT_DIRENT_D_TYPE + * fixing --datadir configure option + * fixing make fullinstall with install-processperfdata install-html + * fixing make-install and add to fullinstall + * add check_hddtemp.php template + * add check_iftraffic.php template + * bug fix process_perfdata.pl: use RRDs detection failed + * add NORMALIZE_VALUES Parameter + * add check_disk_1.php working with NORMALIZE_VALUES + * add helper_functions.php **Version 0.4.8:** 2008/01/05 12:30 * New process_perfdata.pl option -c [--config] to specify an alternate config file. Index: scripts/process_perfdata.pl.in =================================================================== --- scripts/process_perfdata.pl.in (.../upstream/pnp-0.4.8) (revision 42) +++ scripts/process_perfdata.pl.in (.../branches/pnp-0.4.8) (revision 42) @@ -20,6 +20,9 @@ # $Id: process_perfdata.pl.in 442 2008-04-26 09:14:44Z pitchfork $ # +# Portions Copyright (c) 2008 Herbert Straub +# See Changelog for details + if ($< == 0){ print "dont try this as root \n"; exit 1; @@ -45,6 +48,7 @@ LOG_FILE_MAX_SIZE => "10485760" , #Truncate after 10MB LOG_LEVEL => @DEBUG@, XML_ENC => "UTF-8", + NORMALIZE_VALUES => 0, ); my $dstype = "GAUGE"; @@ -53,12 +57,6 @@ # Dont change anything below these Lines ... # -if($conf{USE_RRDs} == 1){ - unless (eval "use RRDs;1") { - $conf{USE_RRDs} = 0; - } -} - # # "rrdtool create" Syntax # @@ -92,6 +90,13 @@ "c=s" => \$opt_c, "config=i" => \$opt_c); parse_config ($opt_c); +if($conf{USE_RRDs} == 1){ + unless (eval "use RRDs;") { + $conf{USE_RRDs} = 0; + print_log ("No CPAN RRDs installed, we can't use it.\n", 2); + } +} + $opt_t=$conf{TIMEOUT}; # Reset Timeout from config file $SIG{'ALRM'} = sub { @@ -440,6 +445,9 @@ sub adjust_template { my $command = shift; my $uom = shift; + my $count = shift; + my $dstype; + my @dstypes; if( $uom eq "c" ){ $dstype = "COUNTER"; print_log("DEBUG: DSTYPE adjust = $dstype",3); @@ -460,6 +468,12 @@ $dstype = uc($2); print_log ("Adapting RRD Datatype to $dstype as defined in $template_cfg",2); } + if ($1 eq "DATATYPES") { + my $spec = uc($2); + while ( $spec =~ /(COUNTER|GAUGE)(:|$)/g ) { + push (@dstypes, $1); + } + } if ($1 eq "CUSTOM_TEMPLATE") { print_log ("Adapting Template using ARG $2",2); my $i = 1; @@ -479,11 +493,25 @@ } } close FH; + + if ( exists $dstypes[$count] ) { + print_log ("Adapting RRD Datatype for DS $count to " . $dstypes[$count] . + " as defined in $template_cfg", 2); + $dstype = $dstypes[$count]; + } elsif ( defined $dstype ) { + print_log ("Adapting RRD Datatype to $dstype as defined in $template_cfg", 2); + } else { + $dstype = "GAUGE"; + print_log ("Using default RRD Datatype $dstype", 2); + } }else{ print_log ("No Custom Template found for $template ($template_cfg) ",2); - print_log ("RRD Datatype is $dstype",2); } print_log ("Template is $template.php",2); + if ( not defined $dstype ) { + $dstype = "GAUGE"; + print_log ("Using default RRD Datatype $dstype", 2); + } return $template,$dstype; } @@ -573,6 +601,12 @@ $p{uom} = "%%"; print_log("DEBUG: $. UOM adjust = $p{uom}",3); } + + # Normalize values + ($p{'value'}, $p{'min'}, $p{'max'}, $p{'warning'}, $p{'critical'}, $p{'uom'}) = + normalize_values($p{'value'}, $p{'min'}, $p{'max'}, $p{'warning'}, + $p{'critical'}, $p{'uom'}); + # # Check for warning and critical ranges # @@ -648,7 +682,7 @@ data2rrd(@perfs) if ( $#perfs >= 0 ); # Process when a new block starts. @perfs=() ; # Clear the perfs array. } - ($p{template}, $dstype) = adjust_template($multi[1],$p{uom}); + ($p{template}, $dstype) = adjust_template($multi[1],$p{uom}, $count); $p{dstype} = $dstype; $p{multi} = $is_multi; $p{label} = cleanup($multi[2]); # store the original label from check_multi header @@ -681,10 +715,9 @@ @perfs=() ; last; } - if($count eq 0 ){ - ( $p{template}, $dstype ) = adjust_template($CHECK_COMMAND, $p{uom}); - } + ( $p{template}, $dstype ) = adjust_template($CHECK_COMMAND, $p{uom}, $count); + $p{multi} = $is_multi; $p{dstype} = $dstype; $p{hostname} = cleanup($HOSTNAME); @@ -724,6 +757,7 @@ # sub print_help { print "Copyright (c) 2005-2008 Joerg Linge \n"; + print "Portions Copyright (c) 2008 Herbert Straub \n"; + print "Portions Copyright (c) 2008 Herbert Straub +For details see +http://www.linuxhacker.at + See our online documentation at: http://pnp4nagios.sourceforge.net or: Index: share/pnp/templates.dist/helper_functions.php =================================================================== --- share/pnp/templates.dist/helper_functions.php (.../upstream/pnp-0.4.8) (revision 0) +++ share/pnp/templates.dist/helper_functions.php (.../branches/pnp-0.4.8) (revision 42) @@ -0,0 +1,41 @@ + 1000000000000) { + $pmax=$size/1000000000000; + } + elseif ($size > 1000000000) { + $pmax=$size/1000000000; + } + elseif ($size > 1000000) { + $pmax=$size/1000000; + } + elseif ($size > 1000) { + $pmax=$size/1000; + } else { + $pmax=$size/1000; + } + return $pmax; +} +function helper_unit ($size) { + if ($size > 1000000000000) { + $pmaxeh='TB'; + } + elseif ($size > 1000000000) { + $pmaxeh='GB'; + } + elseif ($size > 1000000) { + $pmaxeh='MB'; + } + elseif ($size > 1000) { + $pmaxeh='kB'; + } else { + $pmaxeh='B'; + } + return $pmaxeh; +} Index: share/pnp/templates.dist/check_hddtemp.php =================================================================== --- share/pnp/templates.dist/check_hddtemp.php (.../upstream/pnp-0.4.8) (revision 0) +++ share/pnp/templates.dist/check_hddtemp.php (.../branches/pnp-0.4.8) (revision 42) @@ -0,0 +1,86 @@ + +# See http://www.linuxhacker.at +# +if ($WARN[1] == "") { + $WARN[1] = 0; +} +if ($CRIT[1] == "") { + $CRIT[1] = 0; +} + +$opt[1] = "--vertical-label \"Temperatur\" --title \"Temperatur for $hostname / $servicedesc\" "; + +$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE "; +#$def[1] .= "CDEF:x=var1,40,GT,20,10,IF "; +#$def[1] .= "CDEF:x=var1,UN,0,20,IF "; +$def[1] .= "CDEF:x02=var1,UN,0,var1,02,GT,02,var1,IF,IF "; +$def[1] .= "CDEF:x04=var1,UN,0,var1,04,GT,04,var1,IF,IF "; +$def[1] .= "CDEF:x06=var1,UN,0,var1,06,GT,06,var1,IF,IF "; +$def[1] .= "CDEF:x08=var1,UN,0,var1,08,GT,08,var1,IF,IF "; +$def[1] .= "CDEF:x10=var1,UN,0,var1,10,GT,10,var1,IF,IF "; +$def[1] .= "CDEF:x12=var1,UN,0,var1,12,GT,12,var1,IF,IF "; +$def[1] .= "CDEF:x14=var1,UN,0,var1,14,GT,14,var1,IF,IF "; +$def[1] .= "CDEF:x16=var1,UN,0,var1,16,GT,16,var1,IF,IF "; +$def[1] .= "CDEF:x18=var1,UN,0,var1,18,GT,18,var1,IF,IF "; +$def[1] .= "CDEF:x20=var1,UN,0,var1,20,GT,20,var1,IF,IF "; +$def[1] .= "CDEF:x22=var1,UN,0,var1,22,GT,22,var1,IF,IF "; +$def[1] .= "CDEF:x24=var1,UN,0,var1,24,GT,24,var1,IF,IF "; +$def[1] .= "CDEF:x26=var1,UN,0,var1,26,GT,26,var1,IF,IF "; +$def[1] .= "CDEF:x28=var1,UN,0,var1,28,GT,28,var1,IF,IF "; +$def[1] .= "CDEF:x30=var1,UN,0,var1,30,GT,30,var1,IF,IF "; +$def[1] .= "CDEF:x32=var1,UN,0,var1,32,GT,32,var1,IF,IF "; +$def[1] .= "CDEF:x34=var1,UN,0,var1,34,GT,34,var1,IF,IF "; +$def[1] .= "CDEF:x36=var1,UN,0,var1,36,GT,36,var1,IF,IF "; +$def[1] .= "CDEF:x38=var1,UN,0,var1,38,GT,38,var1,IF,IF "; +$def[1] .= "CDEF:x40=var1,UN,0,var1,40,GT,40,var1,IF,IF "; +$def[1] .= "CDEF:x42=var1,UN,0,var1,42,GT,42,var1,IF,IF "; +$def[1] .= "CDEF:x44=var1,UN,0,var1,44,GT,44,var1,IF,IF "; +$def[1] .= "CDEF:x46=var1,UN,0,var1,46,GT,46,var1,IF,IF "; +$def[1] .= "CDEF:x48=var1,UN,0,var1,48,GT,48,var1,IF,IF "; +$def[1] .= "CDEF:x50=var1,UN,0,var1,50,GT,50,var1,IF,IF "; +$def[1] .= "CDEF:x52=var1,UN,0,var1,52,GT,52,var1,IF,IF "; +$def[1] .= "CDEF:x54=var1,UN,0,var1,54,GT,54,var1,IF,IF "; +$def[1] .= "CDEF:x56=var1,UN,0,var1,56,GT,56,var1,IF,IF "; +$def[1] .= "CDEF:x58=var1,UN,0,var1,58,GT,58,var1,IF,IF "; +$def[1] .= "CDEF:x60=var1,UN,0,var1,60,GT,60,var1,IF,IF "; +$def[1] .= "AREA:var1#ff0000:\"Temperatur \" "; +$def[1] .= "AREA:x60#ff0000:\"\" "; +$def[1] .= "AREA:x58#ff0000:\"\" "; +$def[1] .= "AREA:x56#ff0000:\"\" "; +$def[1] .= "AREA:x54#ff0000:\"\" "; +$def[1] .= "AREA:x52#ff0000:\"\" "; +$def[1] .= "AREA:x50#ff0000:\"\" "; +$def[1] .= "AREA:x48#ff1100:\"\" "; +$def[1] .= "AREA:x46#ff2200:\"\" "; +$def[1] .= "AREA:x44#ff3300:\"\" "; +$def[1] .= "AREA:x42#ff5500:\"\" "; +$def[1] .= "AREA:x40#ff7700:\"\" "; +$def[1] .= "AREA:x38#ff9900:\"\" "; +$def[1] .= "AREA:x36#ffaa00:\"\" "; +$def[1] .= "AREA:x34#ffdd00:\"\" "; +$def[1] .= "AREA:x32#ffff00:\"\" "; +$def[1] .= "AREA:x30#ccff00:\"\" "; +$def[1] .= "AREA:x28#aaff00:\"\" "; +$def[1] .= "AREA:x26#99ff00:\"\" "; +$def[1] .= "AREA:x24#66ff00:\"\" "; +$def[1] .= "AREA:x22#22ff00:\"\" "; +$def[1] .= "AREA:x20#00ff44:\"\" "; +$def[1] .= "AREA:x18#00ff55:\"\" "; +$def[1] .= "AREA:x16#00ff66:\"\" "; +$def[1] .= "AREA:x10#00ff77:\"\" "; +$def[1] .= "AREA:x14#00ff88:\"\" "; +$def[1] .= "AREA:x12#00ff99:\"\" "; +$def[1] .= "AREA:x10#00ffaa:\"\" "; +$def[1] .= "AREA:x08#00ffbb:\"\" "; +$def[1] .= "AREA:x06#00ffcc:\"\" "; +$def[1] .= "AREA:x04#00ffdd:\"\" "; +$def[1] .= "AREA:x02#00ffff:\"\" "; +$def[1] .= "LINE1:var1#000000:\"\" "; +$def[1] .= "GPRINT:var1:LAST:\"Last\: %2.0lf C \" "; +$def[1] .= "GPRINT:var1:MAX:\"Max\: %2.0lf C \" "; +$def[1] .= "GPRINT:var1:AVERAGE:\"Average\: %2.0lf C \\n\" "; +$def[1] .= sprintf("COMMENT:\"Warning bei %d C Kritisch bei %d C\\n\" ", + $WARN[1], $CRIT[1]); +?> Index: share/pnp/templates.dist/check_iftraffic.php =================================================================== --- share/pnp/templates.dist/check_iftraffic.php (.../upstream/pnp-0.4.8) (revision 0) +++ share/pnp/templates.dist/check_iftraffic.php (.../branches/pnp-0.4.8) (revision 42) @@ -0,0 +1,27 @@ + +# See http://www.linuxhacker.at +# +$opt[1] = "--vertical-label \"Traffic\" -b 1024 --title \"Interface Traffic for $hostname / $servicedesc\" "; +$def[1] = "DEF:inp=$rrdfile:$DS[3]:AVERAGE " ; +$def[1] .= "DEF:out=$rrdfile:$DS[4]:AVERAGE " ; +$def[1] .= "CDEF:aggsum=inp,out,+ " ; + +$def[1] .= "AREA:aggsum#ff303a:\"sum\" " ; +$def[1] .= "GPRINT:aggsum:LAST:\"%3.2lf %Sb/s last\" " ; +$def[1] .= "GPRINT:aggsum:AVERAGE:\"%3.2lf %Sb/s avg\" " ; +$def[1] .= "GPRINT:aggsum:MAX:\"%3.2lf %Sb/s max\\n\" "; + +$def[1] .= "AREA:inp#6af036:\"in\" " ; +$def[1] .= "GPRINT:inp:LAST:\"%3.2lf %Sb/s last\" " ; +$def[1] .= "GPRINT:inp:AVERAGE:\"%3.2lf %Sb/s avg\" " ; +$def[1] .= "GPRINT:inp:MAX:\"%3.2lf %Sb/s max\\n\" " ; +# +$def[1] .= "AREA:out#70a1f7:\"out\" " ; +$def[1] .= "GPRINT:out:LAST:\"%3.2lf %Sb/s last\" " ; +$def[1] .= "GPRINT:out:AVERAGE:\"%3.2lf %Sb/s avg\" " ; +$def[1] .= "GPRINT:out:MAX:\"%3.2lf %Sb/s max\" "; +?> Index: share/pnp/templates.dist/check_disk_1.php =================================================================== --- share/pnp/templates.dist/check_disk_1.php (.../upstream/pnp-0.4.8) (revision 0) +++ share/pnp/templates.dist/check_disk_1.php (.../branches/pnp-0.4.8) (revision 42) @@ -0,0 +1,35 @@ + +# +# 2007-11-10 Herbert Straub +# - normalized values and units + trend graph +# +include_once ("/etc/pnp4nagios/templates/helper_functions.php"); +$opt[1] = "--vertical-label Bytes --title \"Filesystem $hostname / $servicedesc\" "; +# +# +# Graphen Definitions +$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE "; +$def[1] .= "CDEF:G=var1 "; +$def[1] .= "VDEF:D=G,LSLSLOPE "; +$def[1] .= "VDEF:H=G,LSLINT "; +$def[1] .= "VDEF:F=G,LSLCORREL "; +$def[1] .= "CDEF:E=G,POP,D,COUNT,*,H,+ "; +$def[1] .= "AREA:var1#00f6ff:\"\" "; +$def[1] .= "LINE1:E#FF0000:\"Prognose\" "; +$def[1] .= "LINE1:var1#003300: "; +$def[1] .= sprintf("HRULE:$MAX[1]#003300:\"Kapazitaet %3.2lf %s \" ", + helper_value($MAX[1]), helper_unit($MAX[1])); +$def[1] .= sprintf("HRULE:$WARN[1]#ffff00:\"Warning bei %3.2lf %s \" ", + helper_value($WARN[1]),helper_unit($WARN[1])); +$def[1] .= sprintf("HRULE:$CRIT[1]#ff0000:\"Critical bei %3.2lf %s \" ", + helper_value($CRIT[1]), helper_unit($CRIT[1])); +$def[1] .= "COMMENT:\"\\n\" "; +$def[1] .= sprintf("GPRINT:var1:LAST:\"%%3.2lf %%sB von %3.2lf %s zur Zeit belegt \\n\" ", + helper_value($MAX[1]), helper_unit($MAX[1])); +$def[1] .= "GPRINT:var1:MAX:\"%3.2lf %sB waren maximal belegt \\n\" "; +$def[1] .= "GPRINT:var1:AVERAGE:\"%3.2lf %sB waren im Durchschnitt belegt\" "; +?> Index: configure.ac =================================================================== --- configure.ac (.../upstream/pnp-0.4.8) (revision 42) +++ configure.ac (.../branches/pnp-0.4.8) (revision 42) @@ -1,8 +1,8 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ(2.61) -AC_INIT(pnp, 0.4.8, pnp4nagios-devel@lists.sourceforge.net) +AC_PREREQ(2.59) +AC_INIT(pnp, 0.4.8.1, herbert@linuxhacker.at) AC_CONFIG_SRCDIR(src/) AC_CONFIG_HEADERS(include/config.h:include/config.h.in) AC_PREFIX_DEFAULT(/usr/local/nagios) @@ -11,9 +11,9 @@ AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group]) PKG_NAME=pnp -PKG_VERSION="0.4.8" -PKG_HOME_URL="http://www.pnp4nagios.org/pnp/start" -PKG_REL_DATE="05-01-2008" +PKG_VERSION="0.4.8.1" +PKG_HOME_URL="http://www.linuxhacker.at" +PKG_REL_DATE="2008-05-15" AC_SUBST(PKG_NAME) AC_SUBST(PKG_VERSION) AC_SUBST(PKG_HOME_URL) @@ -30,30 +30,12 @@ LIBEXEC_DIR="$PRE/libexec" fi -if test "$datarootdir" = "\${prefix}/share" ;then - # - # this means datarootdir option is not set - # - if test "$datadir" != "\${datarootdir}" ;then - # - # check the datadir option if set then use it - # - HTML_DIR=$datadir - else - # - # if not fall back to defaults - # - HTML_DIR="$PRE/share/pnp" - fi +if test "$datadir" = "\${prefix}/share" ;then + HTML_DIR="$PRE/share/pnp" else - # - # datarootdir option is set - # - HTML_DIR=$datarootdir + HTML_DIR=$datadir fi - - AC_SUBST(HTML_DIR) AC_SUBST(LIBEXEC_DIR) @@ -89,11 +71,11 @@ AC_TYPE_UID_T # Checks for structure members -#AC_CHECK_MEMBER([struct dirent.d_type], [AC_MSG_RESULT([We successfully have a `dirent_d_type'!])], -# [AC_MSG_ERROR([We need `dirent.d_type'!])], -# [#include ]) +AC_CHECK_MEMBER([struct dirent.d_type], [AC_MSG_RESULT([We successfully have a `dirent_d_type'!])], + [AC_MSG_ERROR([We need `dirent.d_type'!])], + [#include ]) -AC_STRUCT_DIRENT_D_TYPE +#AC_STRUCT_DIRENT_D_TYPE # Checks for library functions. AC_FUNC_FORK