rpms/pnp4nagios/devel pnp4nagios-0.4.14-verify_pnp_config.in_rev654.patch, NONE, 1.1 pnp4nagios.spec, 1.8, 1.9

Xavier Bachelot xavierb at fedoraproject.org
Thu Aug 27 21:36:31 UTC 2009


Author: xavierb

Update of /cvs/pkgs/rpms/pnp4nagios/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25728

Modified Files:
	pnp4nagios.spec 
Added Files:
	pnp4nagios-0.4.14-verify_pnp_config.in_rev654.patch 
Log Message:
Ship contrib directory as doc

pnp4nagios-0.4.14-verify_pnp_config.in_rev654.patch:
 verify_pnp_config.in |  463 +++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 355 insertions(+), 108 deletions(-)

--- NEW FILE pnp4nagios-0.4.14-verify_pnp_config.in_rev654.patch ---
--- trunk/contrib/verify_pnp_config.in	2009/05/02 09:17:40	632
+++ trunk/contrib/verify_pnp_config.in	2009/08/26 22:12:22	654
@@ -1,7 +1,9 @@
-#!@PERL@ -w
+#!/usr/bin/perl -w
 #
 # (C) 2008-2009 pnp4nagios.org / Wolfgang Nieder
 #
+# $Id$ 
+#
 # check Nagios/PNP integration settings
 # 2008.09.21: 0.1    initial version
 # 2008.09.23: 0.1.1  precheck / logfile
@@ -16,24 +18,39 @@
 # 2009.02.23: 0.1.10 check perfdata directory / bugfixes
 # 2009.03.06: 0.1.11 check for multiple entries / bugfixes
 # 2009.04.21: 0.1.12 check for Time::HiRes
+# 2009.07.08: 0.1.13 Icinga support / bugfix (templates)
+# 2009.08.05: 0.1.14 bugfixes (Icinga support / non-standard paths)
+# 2009.08.11: 0.1.15 changed Doc-paths
+# 2009.08.18: 0.1.16 added layout option / package detection
 
 use strict;
 use Getopt::Long;
 use File::Find;
 
-my $program = "Check Nagios/PNP integration";
-my $version = "0.1.12";
+my $program = "Check Nagios/Icinga/PNP integration";
+my $version = "0.1.16";
 my $help = 0;
 my $debug = 0;
 my $quiet = 0;
+my $time = 0;
 my $wc = 0;
 my $err = 0;
+my $warn = 0;
+my $crit = 0;
+my $product = lc("nagios");
+my $pnp_version = '@PKG_VERSION@';
+my $install_opts = '@INSTALL_OPTS@';
+my $doc_version = '0.4';
+# 
+# please remove the hash sign (#) on the following line if you're using Icinga
+# or specify "-M icinga"
+# $product = lc("icinga");
+my $prod_name = ucfirst($product);
 my $basedir = '@prefix@';
-$basedir = "/usr/local/nagios" unless (-d "$basedir");
-my $NagiosBase = $basedir if (-d "$basedir");
-my $NagiosBin = "nagios" if (-f "$basedir/bin/nagios");
+my $NagiosBase = "";
+my $NagiosBin = "$product" if (-f "$basedir/bin/$product");
 my $mode = "";
-my $NagiosCfg = "$NagiosBase/etc/nagios.cfg" if (-f "$NagiosBase/etc/nagios.cfg");
+my $NagiosCfg = "";
 my %NagiosCfg = ();
 my $rrdtool = '@RRDTOOL@';
 $rrdtool = "/usr/bin/rrdtool" unless ((-f "$rrdtool") and (-x "$rrdtool"));
@@ -46,6 +63,8 @@
 my %PPcfg = ();
 my $CPcfg = "";	# config.php
 my %CPcfg = ();
+my $RFcfg = "";	# resource.cfg
+my %RFcfg = ();
 my $nFile = "";
 my @CfgFiles = ();
 my %commands = ();
@@ -60,10 +79,12 @@
 my $gid = "";
 my $user = "";
 my $group = "";
-my $language = "";
+my $layout = "";
+my $pkg_mgr = "";
+my $language = "en";
 my $english = "";
 if (exists $ENV{LANG}) {
-	$language = "/de" if ($ENV{LANG} =~ /de/i);
+	$language = "de" if ($ENV{LANG} =~ /de/i);
 }
 my %msg = ();
 
@@ -83,16 +104,25 @@
 	"q|quiet" => \$quiet,
 	"r|rrdtool=s" => \$rrdtool,
 	"R|RRDpath=s" => \$RRDpath,
+	"U|resource=s" => \$RFcfg,
 	"u|user=s" => \$user,
 	"g|group=s" => \$group,
 	"l|logfile=s" => \$LogFile,
 	"o|object=s" => \$Object,
+	"M|monitor=s" => \$product,
+	"L|layout=s" => \$layout,
+	"t|time" => \$time,
 );
 
+if ($pnp_version =~ /^(\d+\.\d+)/) {
+	$doc_version = "$1";
+}
+$product = lc($product);
+$prod_name = ucfirst($product);
 info ("\n\n$program, v$version\n");
 if ($english) {
 	info ("[I] option -e");
-	$language = "";
+	$language = "en";
 }
 message();
 
@@ -115,7 +145,62 @@
 	info ("info","OS","$line");
 }
 info ("info","Perl","$]");
+if ($mode) {
+	$pkg_mgr = eval "`whereis yum`";
+	if ($pkg_mgr =~/:\s+$/) {
+		$pkg_mgr = eval "`whereis dpkg`";
+		if ($pkg_mgr =~/:\s+$/) {
+			$pkg_mgr = eval "`whereis rpm`";
+		}
+	}
+	($pkg_mgr) = $pkg_mgr =~ /:\s*(\S+)/;
+	if ($pkg_mgr) {
+		info ("info","Package Manager","$pkg_mgr");
+		chk_pkg ("nagios",0,1);
+		chk_pkg ("icinga",0,1);
+		chk_pkg ("pnp4nagios",0,1);
+		chk_pkg ("mod-php5,mod_php5",1,0);
+		chk_pkg ("php,php5",1,1);
+		chk_pkg ("dejavu",1,0);
+		if ($crit) {
+			info ("LinkReqSW");
+			exit 30;
+		}
+	}
+	info ("install_opts","$install_opts") unless ($install_opts =~ /\@INSTALL_OPTS\@/i);
+	info ("PNP-version","$pnp_version") unless ($pnp_version =~ /\@PKG_VERSION\@/i);
+}	
+	
+if ($layout) {
+	info ("info","Layout","$layout");
+	if ($layout =~ /fedora/i) {
+		$basedir = "/usr/share" unless ($NagiosBase);
+		$NagiosCfg = "/etc/nagios/nagios.cfg" unless ($NagiosCfg);
+		$NagiosBin = "/usr/sbin/nagios" unless ($NagiosBin);
+		$RRDpath = "/var/lib/pnp4nagios" unless ($RRDpath);
+	}	
+	elsif ($layout =~ /suse/i) {
+		$basedir = "/usr/share" unless ($NagiosBase);
+		$NagiosCfg = "/etc/nagios/nagios.cfg" unless ($NagiosCfg);
+		$NagiosBin = "/usr/sbin/nagios" unless ($NagiosBin);
+		$RRDpath = "/var/spool/nagios-pnp" unless ($RRDpath);
+	}	
+	elsif ($layout =~ /nagios2/i) {
+		$basedir = "/etc/nagios2" unless ($NagiosBase);
+		$NagiosCfg = "/etc/nagios2/nagios.cfg" unless ($NagiosCfg);
+		$NagiosBin = "/usr/sbin/nagios2" unless ($NagiosBin);
+	}	
+	elsif ($layout =~ /nagios3/i) {
+		$basedir = "/etc/nagios3" unless ($NagiosBase);
+		$NagiosCfg = "/etc/nagios3/nagios.cfg" unless ($NagiosCfg);
+		$NagiosBin = "/usr/sbin/nagios3" unless ($NagiosBin);
+	} else {
+		info ("invOption","$layout");
+	}	
+}	
 
+$basedir = "/usr/local/$product" if ($basedir =~ /^\@prefix\@$/);
+$NagiosBase = $basedir unless ($NagiosBase);
 if (! defined($NagiosBase)) {
 	info ("noBase");
 	exit 3
@@ -125,27 +210,45 @@
 	exit 3
 }
 info ("useBase", "$NagiosBase");
+$NagiosCfg = "$NagiosBase/etc/$product.cfg" unless ($NagiosCfg);
 if (! defined($NagiosCfg)) {
-	info ("noCfg");
-	exit 4
+	if (-f "$NagiosBase/etc/$product.cfg") {
+		$NagiosCfg = "$NagiosBase/etc/$product.cfg";
+	} else {
+		info ("noCfg");
+		exit 4
+	}
 }
 if (! -f "$NagiosCfg") {
 	info ("noCfgFile","$NagiosCfg");
 	exit 5
 }
 info ("useCfg","$NagiosCfg");
+if (! defined($NagiosBin)) {
+	if (-f "$NagiosBase/bin/$product") {
+		$NagiosBin = "$NagiosBase/bin/$product";
+	} else {
+		info ("noBinary", "$product") && exit 6;
+	}
+}
 if ($NagiosBin !~ /^\//) {
 	$NagiosBin = "$NagiosBase/bin/$NagiosBin";
 }
-examine ("x;", "Nagios-Binary", "$NagiosBin") && exit 6;
+examine ("x;", "${prod_name}-Binary", "$NagiosBin") && exit 6;
 info ("useBinary","$NagiosBin");
 
 if ($mode) {
-	if ($mode !~ /^default$|^Bulk$|^NPCD$/i) {
+	if ($mode !~ /^default$|^sync$|^Bulk$|^NPCD$/i) {
 		info ("invPNPmode");
 		info ("LinkPNPconfig");
 		exit 7
 	}
+	if ($mode =~ /^default$/) {
+		$mode = "sync";
+		if (($pnp_version =~ /^(\d+\.\d+)/) and ($1 >= 0.6)) {
+			$mode = "NPCD";
+		}
+	}
 	info ("PNPmode","$mode");
 }
 if (($LogFile ne "") and (! -f $LogFile)) {
@@ -156,10 +259,10 @@
 info ("useLog","$LogFile") if ($LogFile);
 
 # get Nagios version 
-my $NagiosVer = `$NagiosBin -V | grep "Nagios "`;
+my $NagiosVer = `$NagiosBin -V | grep "$prod_name " | head -1`;
 chomp $NagiosVer;
-info ("[I] Nagios info: $NagiosVer");
-($NagiosVer) = $NagiosVer =~ /Nagios (\d+)\./;
+info ("[I] $prod_name info: $NagiosVer");
+($NagiosVer) = $NagiosVer =~ /$prod_name .*?(\d+)\./;
 
 # check Nagios Config
 info ("verifyCfg");
@@ -170,6 +273,7 @@
 	info ("LinkNagiosChk");
 	exit 9;
 }
+process_nagios_cfg();
 
 # check rrdtool
 if ($mode) {
@@ -209,9 +313,29 @@
 	if (! $erg) {
 		info ("noHiRes");
 	}
+
+	if ($RFcfg eq "") {
+#		($RFcfg) = $NagiosCfg =~ m#(^.*/)#;
+#		$RFcfg .= "resource.cfg";
+		$RFcfg = $NagiosCfg{"resource_file"};
+	}
+	info ("procFile","$RFcfg");
+	open (RFILE, "$RFcfg") || abort (29, "errOpen", "$RFcfg", "$!");
+	while (<RFILE>) {
+		chomp;
+		s/#.*//;
+		s/\s*$//;
+		next if (/^$/);
+		my ($par, $val) = /^(.*?)=(.*)/;	# shortest string (broker module contains multiple equal signs)
+		if (($par eq "") or ($val eq "")) {
+			info ("oddLine", "$_");
+			next;
+		}
+		$RFcfg{"$par"} .= $val;
+	}
+	close (RFILE);
 }
 
-process_nagios_cfg();
 status_log();
 process_cfg_log();
 
@@ -237,8 +361,8 @@
 	if ($NagiosCfg{"process_performance_data"} !~ /^1$/) {
 		info ("noPerfEna");
 		info ("LinkEnaPerf");
-		if ($mode =~ /default/i) {
-			info ("PNPdefault");
+		if ($mode =~ /sync/i) {
+			info ("PNPsync");
 		} elsif ($mode =~ /NPCD/i) {
 			info ("PNPnpcd");
 		} else {	
@@ -250,15 +374,15 @@
 	info ("LinkEnaPerf");
 }
 
-# check default mode
-if (($NagiosVer >= 3) and (uc($mode) =~ /default/i)) {
+# check sync mode
+if (($NagiosVer >= 3) and (uc($mode) =~ /sync/i)) {
 	if ((exists $NagiosCfg{"enable_environment_macros"}) and ($NagiosCfg{"enable_environment_macros"} !~ /^1$/)) {
 		info ("envMacrosDis");
 		info ("LinkEnaEnv");
 	}
 }
-chk_param ("service_perfdata_command", "default");
-chk_param ("host_perfdata_command", "default");
+chk_param ("service_perfdata_command", "sync");
+chk_param ("host_perfdata_command", "sync");
 
 # check Bulk modes
 chk_param ("service_perfdata_file", "Bulk|NPCD");
@@ -290,6 +414,12 @@
 		info ("invDir", "$RRDpath");
 	} else {
 		info ("RRDpath", "$RRDpath");
+		my $erg = eval "open (TST, \">$RRDpath/testfile\")";
+		if (! $erg) {
+			info ("noWrite","$RRDpath","$NagiosCfg{\"${product}_user\"}");
+		} else {
+			unlink ("$RRDpath/testfile");
+		}
 		find(\&chk_perfdata, "$RRDpath");
 		if ($RRDfile) {
 			info ("RRDcount", $RRDdir, $RRDfile);
@@ -301,11 +431,18 @@
 
 if ($wc == 0) {
 	info ("noErrors");
-} else {
+	print "OK | Errors=0\n" if ($quiet);
+	exit 0
+} elsif ($crit == 0) {
+	info ("Warnings");
+	print "WARNING | Warnings=$warn; Errors=$crit\n" if ($quiet);
+	exit 1
+} else {	
 	info ("Errors");
+	print "CRITICAL | Warnings=$warn; Errors=$crit\n" if ($quiet);
+	exit 2
 }
-print "\n";
-exit $wc;
+exit 3;
 
 #
 # subroutines
@@ -315,7 +452,7 @@
 	return if ($quiet);
 	if ($language =~ /de/i) {
 	print <<EOF1;
-Dieses Script prueft verschiedene Einstellungen/Eintraege in Ihrer Nagios-
+Dieses Script prueft verschiedene Einstellungen/Eintraege in Ihrer $prod_name-
 bzw. PNP-Umgebung, um Ihnen beim Finden von Problemen zu helfen.
 Es kann vor und waehrend der Laufzeit von PNP benutzt werden.
 
@@ -330,7 +467,7 @@
 EOF1
 } else {
 print <<EOF2;
-This script will check certain settings/entries of your Nagios/PNP environ-
+This script will check certain settings/entries of your $prod_name/PNP environ-
 ment to assist you in finding problems when you are using PNP.
 It may be used prior and during operation of PNP.
 
@@ -352,29 +489,40 @@
 	[ -c <config file> ]
 	[ -N <npcd config file> ]
 	[ -P <process_perfdata config file> ]
+	[ -r <rrdtool binary> ]
 	[ -R <perfdata directory>|no ]
+	[ -U <resource config file> ]
+	[ -u <user> ]
+	[ -g <group> ]
+	[ -M <monitoring product> ]
+	[ -L <layout> ]
+	[ -t ]
 	[ -e ]
 	[ -d | -q ]
 	   
 parameters:
 	-h, --help        print these lines
-	-b, --basedir=s   Nagios Base directory (default: $basedir)
-	-B, --binary=s    Nagios binary (default: nagios)
-	-c, --config=s    Nagios main config file (default: $basedir/etc/nagios.cfg)
-	-m, --mode=s      PNP mode ("default", "bulk", "NPCD")
+	-b, --basedir=s   $prod_name Base directory (default: $basedir)
+	-B, --binary=s    $prod_name binary (default: $product)
+	-c, --config=s    $prod_name main config file (default: $basedir/etc/product.cfg)
+	-m, --mode=s      PNP mode ("default", "sync", "bulk", "NPCD")
 	-l, --logfile=s   check configure log file 
 	-N, --npcdcfg=s   PNP config file for NPCD mode (default: $basedir/etc/pnp/npcd.cfg)
 	-P, --ppcfg=s     process_perfdata config file (default: $basedir/etc/pnp/process_perfdata.cfg)
 	-p, --precheck    use config files instead of objects cache
 	-r, --rrdtool=s   specify the location of the RRDtool binary
 	-R, --RRDpath=s   specify the perfdata directory (default: $basedir/share/perfdata) or "no" for no check
+	-U, --resource=s  specify the location of the resource.cfg (default: $basedir/etc/resource.cfg)
+	-M, --monitor=s   specify the monitoring product (default: nagios)
+	-L, --layout=s    specify a layout (Nagios2, Nagios3, SuSE, Fedora)
 	-u, --user=s      user of the perfdata directory
 	-g, --group=s     group of the perfdata directory
 	-q, --quiet       quiet mode, non-zero return code will indicate errors
-	-o, --object=s    Nagios object (host name/service description)
+	-o, --object=s    $prod_name object (host name/service description)
 	                  "Name" : search for matching host name or service desc
 	                  "Name;": search for matching host name
 	                  ";Name": search for service description
+	-t, --time        show warnings if RRDfiles are too old
 	-e, --english     show english messages/links
 	-d, --debug       some debugging output
 EOF3
@@ -406,7 +554,7 @@
 			info ("dupEntry","$key");
 		}
 	}
-	info ("[I] nagios_user=$NagiosCfg{nagios_user}");
+	info ("[I] ${product}_user=$NagiosCfg{\"${product}_user\"}");
 	if ($user) {
 		$uid = getpwnam ($user);
 		if (! $uid) {
@@ -415,10 +563,10 @@
 		}
 		info ("[I] perfdata_user=$user");
 	} else {
-		$uid = getpwnam ($NagiosCfg{nagios_user});
-		$user = $NagiosCfg{nagios_user};
+		$uid = getpwnam ($NagiosCfg{"${product}_user"});
+		$user = $NagiosCfg{"${product}_user"};
 	}
-	info ("[I] nagios_group=$NagiosCfg{nagios_group}");
+	info ("[I] ${product}_group=$NagiosCfg{\"${product}_group\"}");
 	if ($group) {
 		$gid = getgrnam ($group);
 		if (! $gid) {
@@ -427,8 +575,8 @@
 		}
 		info ("[I] perfdata_group=$group");
 	} else {
-		$gid = getgrnam ($NagiosCfg{nagios_group});
-		$group = $NagiosCfg{nagios_group};
+		$gid = getgrnam ($NagiosCfg{"${product}_group"});
+		$group = $NagiosCfg{"${product}_group"};
 	}
 }
 
@@ -473,15 +621,21 @@
 			$StatusLog{"$name"} = $zeile;
 			info ("[D] $zeile") if ($debug);
 			if ($hostname ne "") {
-				next if ($zeile !~ /host_name=$hostname/i);
+				if ($zeile !~ /host_name=$hostname/i) {
+					$zeile = "";
+					next;
+				}	
 			}
 			if ($srvdesc ne "") {
-				next if ($zeile !~ /service_description=$srvdesc/i);
+				if ($zeile !~ /service_description=$srvdesc/i) {
+					$zeile = "";
+					next;
+				}	
 			}
 			if (uc($name) =~ /$Object/i) {
 				$name =~ s/.*?;//;
-				my ($perf_data) = /performance_data\s*=\s*(.*)?#/;
-				if (defined($perf_data)) {
+				my ($perf_data) = $zeile =~ /#performance_data\s*=\s*(.*?)#/;
+				if ($perf_data ne "") {
 					info ("[I] Performance data ($name): $perf_data");
 					$_= $perf_data." ";
 					# try to check for valid performance data according to
@@ -501,6 +655,7 @@
 						} else {
 							info ("[D] Label:>$label<") if ($debug);
 						}
+						s/,/./g;	# change decimal comma 
 						s/^(.*?)[; ]//;
 						my ($value,$uom) = $1 =~ /([-]?[0-9.]+)(.*)/;
 						if (! defined($value)) {
@@ -570,8 +725,8 @@
 	examine ("f;","RRDTOOL",$LogFile{"RRDTOOL"});	
 	examine ("f;","NPCD_LOG",$LogFile{"NPCD_LOG"});	
 
-	examine ("u;","nagios_user",$LogFile{"nagios_user"});	
-	examine ("g;","nagios_grp",$LogFile{"nagios_grp"});	
+	examine ("u;","${product}_user",$LogFile{"${product}_user"});	
+	examine ("g;","${product}_grp",$LogFile{"${product}_grp"});	
 }
 
 # check parameter from nagios.cfg
@@ -598,7 +753,7 @@
 			$chk .= " -d HOSTPERFDATA" if ($param =~ /^host/);
 			if ( $cmd !~ /$chk$/i) {
 				info ("invValue2","$cmd","$param");
-				info ("PNPdefault");
+				info ("PNPsync");
 			}
 		}
 		if ($param =~ /perfdata_file_template/) {
@@ -619,12 +774,14 @@
 			info ("LinkNagiosCfg","$param");
 			return;
 		}
-		if ($NagiosVer >= 3) {
-			info ("noParCfgH","$param");
-		} else {
-			info ("notAdv","$param");
+		if ($prod_name eq "Icinga") {
+			if ($NagiosVer >= 3) {
+				info ("noParCfgH","$param");
+			} else {
+				info ("notAdv","$param");
+			}
+			info ("LinkNagiosCfg","$param");
 		}
-		info ("LinkNagiosCfg","$param");
 	}
 }
 
@@ -645,6 +802,20 @@
 		}
 		($line) = /command_line\s*(.*)/ ;	
 		$commands{"$cmd"} = "$line";
+		next unless (/process_perfdata.pl/);
+		my @cmd = split (/\s+/,$line);
+		for my $i (0..$#cmd) {
+			if ($cmd[$i] =~ /(\$USER\d+\$)/) {
+				if (exists $RFcfg{"$1"}) {		
+					my $val = $RFcfg{"$1"};
+					$cmd[$i] =~ s/\$USER\d+\$/$val/;
+				} else {
+					info ("noRes", "$1");	
+				}
+			}
+			info ("noFile", "$cmd", "$cmd[$i]") unless (-f "$cmd[$i]");
+			last if ($cmd[$i] =~ /perfdata.pl/);
+		}
 	}
 	close (CFILE);
 	if ($debug) {
@@ -685,8 +856,12 @@
 	my $zeile = "";
 	info ("[D] var:>$var<") if ($debug);
 	return if (/^$/);
-	s/^(.*?)[; ]//;
+	s/^(.*?)([; ])//;
 	my $value = $1 || "";
+	if (($value ne "") and ($2 eq " ")) {
+		$_ = " ".$_;
+		return;
+	}
 	$zeile .= "value:>$value< ";
 	if ($value) {
 		if ($value !~ /$pattern/) {
@@ -739,14 +914,10 @@
 #	$template{"${type}STATE"} = 0;
 	$template{"HOSTSTATE"} = 0;
 	$template{"HOSTSTATETYPE"} = 0;
-	if ($type eq "HOST") {
-		$template{"HOSTOUTPUT"} = 0;
-	}
 	if ($type eq "SERVICE") {
 		$template{"SERVICEDESC"} = 0;
 		$template{"SERVICESTATE"} = 0;
 		$template{"SERVICESTATETYPE"} = 0;
-		$template{"SERVICEOUTPUT"} = 0;
 	}
 	info ("chkTemplate","$param");
 	my $val = $NagiosCfg{"$param"};
@@ -806,6 +977,7 @@
 	$NPCDcfg{sleep_time} = 'n;^\d+$;439';	# new since 0.4.8
 	$NPCDcfg{identify_npcd} = "v;0|1;497";	# new since 0.4.11
 	$NPCDcfg{perfdata_file} = "d;;558";
+	$NPCDcfg{perfdata_spool_filename} = "f;;643";
 	$err = 0;
 
 # try to set a file name if variable is unset
@@ -899,7 +1071,7 @@
 	$CPcfg{'$conf[\'allowed_for_host_overview\']'} = 'S;[\S,]+;';
 	$CPcfg{'$conf[\'allowed_for_pages\']'} = 'S;[\S,]+;381';
 	$CPcfg{'$conf[\'overview-range\']'} = 'v;0|1;';
-	$CPcfg{'$conf[\'lang\']'} = 'v;en|de|fr|se|nl;';
+	$CPcfg{'$conf[\'lang\']'} = 'v;en|de|fr|se|nl|es;';
 	$CPcfg{'$conf[\'date_fmt\']'} = "S;.*;279";
 	$CPcfg{'$conf[\'rrd_daemon_opts\']'} = 'S;.*;520';
 	$CPcfg{'$conf[\'enable_recursive_template_search\']'} = 'v;0|1;595';
@@ -1048,7 +1220,6 @@
 sub info {
 	my @par = @_;
 	my $line = "";
-	return if ($quiet);
 	
 	if (exists ($msg{"$par[0]"})) {
 		$line = $msg{"$par[0]"};
@@ -1060,21 +1231,25 @@
 	}
 	if ($line =~ /\[E\]/) {
 		$wc++;
-		$err++;
+		$crit++;
+	}
+	if ($line =~ /\[W\]/) {
+		$wc++;
+		$warn++;
 	}
-	print "$line\n";
+	print "$line\n" unless ($quiet);
 }
 
 # abort script
 sub abort {
-	my ($rc, @par);
+	my ($rc, @par) = @_;
 	info (@par);
 	exit $rc;
 }
 
 # check perfdata dir
 sub chk_perfdata {
-	-d && $RRDdir++;
+	-d && $_ ne "." && $RRDdir++;
 	my $f = "$File::Find::name";
 	return unless (($f =~ /\/$/) or ($f =~ /rrd$|xml$/));
 	if ($uid) {
@@ -1092,6 +1267,19 @@
 	return unless ($f =~ /xml$/);
 	my $rc = 99;
 	my $txt = "no RC found in file";
+	if ($time) {
+		my $max_age = $CPcfg{'$conf[\'max_age\']'};
+		while ($max_age =~ /(\d+)\*(\d+)(\D.*)?/) {
+			if (defined($3)) {	
+				$max_age = $1 * $2."$3";
+			} else {
+				$max_age = $1 * $2;
+			}
+		}	
+		my $old = time() - $max_age;
+		my $age = (stat ($f))[9];
+		info ("RRDold","$f","$max_age") if ($age < $old);
+	}
 	open (F, "$f");
 	while (<F>) {
 		if (/<RC>(\d)<\/RC>/) {
@@ -1105,23 +1293,70 @@
 	info ("RRDrc","$f",$rc, "$txt") if ($rc);
 }
 	
+sub chk_pkg {
+	my ($pkg_names,$req,$exactly) = @_;
+	my @pkg_names = split (/,/,$pkg_names);
+	my $pkg_name = "";
+	my $pkg = "";
+
+	for my $idx (0..$#pkg_names) {
+		next if ($pkg);
+		$pkg_name = $pkg_names[$idx];
+		if ($pkg_mgr =~ /yum/) {
+			if ($exactly) {
+				$pkg = `yum list installed $pkg_name 2>/dev/null | grep "installed"`;
+			} else {
+				$pkg = `yum list installed 2>/dev/null | grep "$pkg_name" | grep "installed"`;
+			}
+			$pkg =~ s/\s+/ /g;
+			$pkg =~ s/ installed//g;
+		} elsif ($pkg_mgr =~ /dpkg/) {
+			if ($exactly) {
+				$pkg = `dpkg -l "$pkg_name" 2>/dev/null | grep "ii"`;
+			} else {
+				$pkg = `dpkg -l 2>/dev/null | grep "$pkg_name" | grep "ii"`;
+			}
+			$pkg =~ s/ii\s+//gs;
+			$pkg =~ s/\s+/ /gs;
+			$pkg =~ s/(\S+ \S+).*/$1/gs;
+		} elsif ($pkg_mgr =~ /rpm/) {
+			if ($exactly) {
+				$pkg = `rpm -qa $pkg_name`;
+			} else {
+				$pkg = `rpm -qa | grep $pkg_name`;
+			}
+		}
+	}
+	$pkg =~ s/\s$//gs;
+	if ($pkg) {
+		info ("Package","$pkg");
+		return 1
+	} else {
+		info ("noPkg","$pkg_names") if ($req);
+		return 0
+	}
+}
+
 # set different messages according to the language
 sub message {
 	$msg{"qd"} = "[E] --quiet and --debug are mutually exclusive";
-	$msg{"noBase"} = "[E] Nagios basedir not found/not specified";
-	$msg{"noBaseDir"} = "[E] Nagios basedir \"%s\" does not exist";
-	$msg{"useBase"} = "[I] using Nagios basedir \"%s\"";
-	$msg{"useBinary"} = "[I] using Nagios binary \"%s\"";
-	$msg{"noCfg"} = "[E] nagios.cfg not specified";
+	$msg{"noBase"} = "[E] $prod_name basedir not found/not specified";
+	$msg{"noBaseDir"} = "[E] $prod_name basedir \"%s\" does not exist";
+	$msg{"useBase"} = "[I] using $prod_name basedir \"%s\"";
+	$msg{"noBinary"} = "[E] binary \"%s\" not found/defined";
+	$msg{"useBinary"} = "[I] using $prod_name binary \"%s\"";
+	$msg{"noCfg"} = "[E] $product.cfg not specified";
 	$msg{"noCfgFile"} = "[E] config file \"%s\" not found";
-	$msg{"useCfg"} = "[I] using Nagios config \"%s\"";
+	$msg{"useCfg"} = "[I] using $prod_name config \"%s\"";
 	$msg{"binExec"} = "[E] File \"%s\" is not executable";
-	$msg{"verifyCfg"} = "[A] verifying Nagios config";
-	$msg{"invPNPmode"} = "[E] no valid mode specified (default, Bulk, NPCD)";
+	$msg{"verifyCfg"} = "[A] verifying $prod_name config";
+	$msg{"invPNPmode"} = "[E] no valid mode specified (sync, Bulk, NPCD, default)";
 	$msg{"PNPmode"} = "[I] PNP mode: \"%s\"";
+	$msg{"Package"} = "[I] Package: \"%s\"";
+	$msg{"noPkg"} = "[E] Package \"%s\" not found";
 	$msg{"useLog"} = "[I] LogFile \"%s\" specified";
-	$msg{"NagiosChkErr"} = "[E] Nagios check found errors";
-	$msg{"NagiosCfgErr"} = "[E] Nagios config contains errors";
+	$msg{"NagiosChkErr"} = "[E] $prod_name check found errors";
+	$msg{"NagiosCfgErr"} = "[E] $prod_name config contains errors";
 	$msg{"verifyRRD"} = "[A] checking RRDtool (%s)";
 	$msg{"info"} = "[I] %s: %s";
 	$msg{"invFile"} = "[E] \"%s\" is not a (regular) file";
@@ -1129,27 +1364,29 @@
 	$msg{"useEntry"} = "[I] using cfg_dir/cfg_file entries";
 	$msg{"useCache"} = "[I] using \"%s\" entries";
 	$msg{"dupEntry"} = "[E] directive \"%s\" is duplicate";
-	$msg{"noPerfEna"} = "[E] no performance data enabled (process_performance_data=1 in nagios.cfg)";
+	$msg{"noPerfEna"} = "[E] no performance data enabled (process_performance_data=1 in $product.cfg)";
 	$msg{"envMacrosDis"} = "[E] environment macros disabled (enable_environment_macros=0)";
 	$msg{"noFonts"} = "[H] dejavu fonts may be missing";
 	$msg{"noErrors"} = "\nNo (obvious) errors found. Happy graphing with PNP";
+	$msg{"Warnings"} = "\nWarnings found. Please check the settings.";
 	$msg{"Errors"} = "\nErrors found. Please check the settings and have a look at the documentation.";
 	$msg{"procFile"} = "[A] processing \"%s\"";
 	$msg{"searchObj"} = "[A] searching for \"%s\"";
 	$msg{"noLabel"} = "[E] no label defined";
 	$msg{"invValue"} = "[E] no valid value";
 	$msg{"invOption"} = "[E] \"%s\" is not a valid option";
-	$msg{"invUOM"} = "[E] \"%s\" doesn''t seem to be a valid UOM";
+	$msg{"invUOM"} = "[E] \"%s\" doesn't seem to be a valid UOM";
 	$msg{"minRev"} = "[W] option \"%s\" is valid starting with revision %s";
 	$msg{"maxRev"} = "[W] option \"%s\" is only valid until revision %s";
 	$msg{"noUser"} = "[E] (%s) user \"%s\" does not exist";
 	$msg{"noGroup"} = "[E] (%s) group \"%s\" does not exist";
 	$msg{"noPerf"} = "[E] There is NO performance data for \"%s\" !";
 	$msg{"noRRDchk"} = "[I] perfdata directory will NOT be checked";
-	$msg{"RRDpath"} = "[A] checking of \"%s\"";
+	$msg{"RRDpath"} = "[A] checking of RRDpath \"%s\"";
 	$msg{"RRDuser"} = "[E] \"%s\": owner is \"%s\" instead of %s";
 	$msg{"RRDgroup"} = "[E] \"%s\": group is \"%s\" instead of %s";
 	$msg{"RRDrc"} = "[E] \"%s\"\n\tRRDtool RC: %s, %s";
+	$msg{"RRDold"} = "[W] \"%s\" is older than %s seconds";
 	$msg{"RRDcount"} = "[I] %s dir(s) with a total of %s rrd file(s)";
 	$msg{"noRRDfiles"} = "[E] %s dir(s) but NO rrd files => NO graphs!";
 	$msg{"useRRDs"} = "[I] RRDs perl module installed";
@@ -1171,67 +1408,74 @@
 	$msg{"missTempVar"} = "[E] variable \"%s\" in template is missing";
 	$msg{"missinvTempVal"} = "[E] value \"%s\" in template is missing";
 	$msg{"noCmd"} = "[E] command_name \"%s\" not found";
-	$msg{"noParCfg"} = "[E] \"%s\" not found in nagios.cfg";
-	$msg{"noParCfgH"} = "[H] \"%s\" not found in nagios.cfg";
+	$msg{"noParCfg"} = "[E] \"%s\" not found in $product.cfg";
+	$msg{"noParCfgH"} = "[H] \"%s\" not found in $product.cfg";
 	$msg{"notAdv"} = "[H] \"%s\" not advisable in Nagios < 3.x";
 	$msg{"invChar"} = "[E] \"%s\" (\"%s\") has invalid format/contains invalid characters";
 	$msg{"undefVal"} = "[E] no (valid) value for \"%s\" defined";
 	$msg{"noNumber"} = "[E] %s not a valid number";
 	$msg{"startEnd"} = "[E] start (%s) is greater than end (%s)";
 	$msg{"noFile"} = "[E] (%s) file \"%s\" is missing";
-	$msg{"noFileYet"} = "[I] (%s) file \"%s\" doesn''t exist (yet)";
+	$msg{"noRes"} = "[E] resource \"%s\" is not defined";
+	$msg{"noFileYet"} = "[I] (%s) file \"%s\" doesn't exist (yet)";
 	$msg{"noDir"} = "[E] (%s) directory \"%s\" is missing";
 	$msg{"noSock"} = "[E] \"%s\" is not a socket";
+	$msg{"noWrite"} = "[E] \"%s\": no write permissions for \"%s\"";
 	$msg{"key"} = "[D] key:\"%s\"";
 	$msg{"keyValue"} = "[D] directive:\"%s\", value:\"%s\"";
 	$msg{"oddLine"} = "[W] \"%s\" looks odd";
 	$msg{"errOpen"} = "[E] open of %s failed, RC=%s";
 
 	$msg{"LinkNagiosChk"} = "[H] http://nagios.sourceforge.net/docs/3_0/verify_config.html";
-	$msg{"LinkReqSW"} = "[H] http://www.pnp4nagios.org/pnp/about#required_software";
-	$msg{"LinkPNPreq"} = "[H] http://www.pnp4nagios.org/pnp/about#requirements";
-	$msg{"PNPdefault"} = "[H] http://www.pnp4nagios.org/pnp$language/config#default_mode";
-	$msg{"PNPbulk"} = "[H] http://www.pnp4nagios.org/pnp$language/config#bulk_mode";
-	$msg{"PNPnpcd"} = "[H] http://www.pnp4nagios.org/pnp$language/config#npcd";
+	$msg{"LinkReqSW"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/about#required_software";
+	$msg{"LinkRRDtool"} = "[H] http://www.rrdtool.org";
+	$msg{"LinkPNPreq"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/about#requirements";
+	$msg{"PNPsync"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/config#default_mode";
+	$msg{"PNPbulk"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/config#bulk_mode";
+	$msg{"PNPnpcd"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/config#npcd";
 	$msg{"NPCDcfgReq"} = "[E] NPCD config file required";
 	$msg{"noNPCDreq"} = "[H] NPCD config file is not required";
 	$msg{"LinkEnaEnv"} = "[H] http://nagios.sourceforge.net/docs/3_0/configmain.html#enable_environment_macros";
 	$msg{"LinkEnaPerf"} = "[H] http://nagios.sourceforge.net/docs/3_0/configmain.html#process_performance_data";
 	$msg{"LinkDevInfo"} = "[H] http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN203";
-	$msg{"LinkPNPconfig"} = "[H] http://www.pnp4nagios.org/pnp$language/config";
-	$msg{"LinkPPcfg"} = "[H] http://www.pnp4nagios.org/pnp$language/config";
-	$msg{"LinkCPcfg"} = "[H] http://www.pnp4nagios.org/pnp$language/webfe";
+	$msg{"LinkPNPconfig"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/config";
+	$msg{"LinkPPcfg"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/config";
+	$msg{"LinkCPcfg"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/webfe";
 	$msg{"LinkNagiosCfg"} = "[H] http://nagios.sourceforge.net/docs/3_0/configmain.html#%s";
 	$msg{"LinkNagiosCfg2"} = "[H] http://nagios.sourceforge.net/docs/3_0/configmain.html#process_performance_data\n    (and following options)";
 	
 	if ($language =~ /de/i) {
-		$msg{"qd"} = "[E]: --quiet und --debug schliessen sich gegenseitig aus";
-		$msg{"noBase"} = "[E]: Nagios-Basisverzeichnis nicht gefunden/angegeben";
-		$msg{"noBaseDir"} = "[E]: Nagios-Basisverzeichnis \"%s\" existiert nicht";
-		$msg{"useBase"} = "[I] benutze Nagios-Basisverzeichnis \"%s\"";
-		$msg{"useBinary"} = "[I] benutze Nagios-Binary \"%s\"";
-		$msg{"noCfg"} = "[E]: nagios.cfg nicht angegeben";
-		$msg{"noCfgFile"} = "[E]: Konfigurationsdatei \"%s\" nicht gefunden";
-		$msg{"useCfg"} = "[I] benutze Nagios-config \"%s\"";
-		$msg{"binExec"} = "[E]: Datei \"%s\" ist nicht ausfuehrbar";
-		$msg{"verifyCfg"} = "[A] verifiziere Nagios-Konfiguration";
-		$msg{"invPNPmode"} = "[E]: kein gueltiger PNP-Modus angegeben (default, Bulk, NPCD)";
+		$msg{"qd"} = "[E] --quiet und --debug schliessen sich gegenseitig aus";
+		$msg{"noBase"} = "[E] ${prod_name}-Basisverzeichnis nicht gefunden/angegeben";
+		$msg{"noBaseDir"} = "[E] ${prod_name}-Basisverzeichnis \"%s\" existiert nicht";
+		$msg{"useBase"} = "[I] benutze ${prod_name}-Basisverzeichnis \"%s\"";
+		$msg{"noBinary"} = "[E] Binary \"%s\" nicht gefunden/definiert";
+		$msg{"useBinary"} = "[I] benutze ${prod_name}-Binary \"%s\"";
+		$msg{"noCfg"} = "[E] $product.cfg nicht angegeben";
+		$msg{"noCfgFile"} = "[E] Konfigurationsdatei \"%s\" nicht gefunden";
+		$msg{"useCfg"} = "[I] benutze ${prod_name}-config \"%s\"";
+		$msg{"binExec"} = "[E] Datei \"%s\" ist nicht ausfuehrbar";
+		$msg{"verifyCfg"} = "[A] verifiziere ${prod_name}-Konfiguration";
+		$msg{"invPNPmode"} = "[E] kein gueltiger PNP-Modus angegeben (sync, Bulk, NPCD, default)";
 		$msg{"PNPmode"} = "[I] PNP-Modus: \"%s\"";
+		$msg{"Package"} = "[I] Paket: \"%s\"";
+		$msg{"noPkg"} = "[E] Paket \"%s\" nicht gefunden";
 		$msg{"NPCDcfgReq"} = "[E] NPCD-Konfigurationsdatei erforderlich";
 		$msg{"noNPCDreq"} = "[H] NPCD-Konfigurationsdatei nicht erforderlich";
 		$msg{"useLog"} = "[I] LogFile \"%s\" angegeben";
-		$msg{"NagiosChkErr"} = "[E] Nagios-Konfigurationspruefung findet Fehler";
-		$msg{"NagiosCfgErr"} = "[E] Nagios-Konfigurationsdatei enthaelt Fehler";
+		$msg{"NagiosChkErr"} = "[E] ${prod_name}-Konfigurationspruefung findet Fehler";
+		$msg{"NagiosCfgErr"} = "[E] ${prod_name}-Konfigurationsdatei enthaelt Fehler";
 		$msg{"verifyRRD"} = "[A] pruefe RRDtool (%s)";
 		$msg{"invFile"} = "[E]: \"%s\" ist keine (regulaere) Datei";
 		$msg{"invDir"} = "[E] Verzeichnis \"%s\" existiert nicht";
 		$msg{"useEntry"} = "[I] benutze cfg_dir/cfg_file-Eintraege";
 		$msg{"useCache"} = "[I] benutze \"%s\"-Eintraege";
 		$msg{"dupEntry"} = "[E] Direktive \"%s\" ist doppelt";
-		$msg{"noPerfEna"} = "[E] keine Performance-Daten aktiviert (process_performance_data=1 in nagios.cfg)";
+		$msg{"noPerfEna"} = "[E] keine Performance-Daten aktiviert (process_performance_data=1 in $product.cfg)";
 		$msg{"envMacrosDis"} = "[E] Environment-Makros deaktiviert (enable_environment_macros=0)";
 		$msg{"noFonts"} = "[H] dejavu-Fonts sind ggf. nicht installiert";
 		$msg{"noErrors"} = "\nKeine (offensichtlichen) Fehler gefunden. Viel Spass mit PNP";
+		$msg{"Warnings"} = "\nWarnungen gefunden.\nBitte ueberpruefen Sie die Einstellungen.";
 		$msg{"Errors"} = "\nFehler gefunden.\nBitte ueberpruefen Sie die Einstellungen und lesen Sie die Dokumentation.";
 		$msg{"procFile"} = "[A] verarbeite \"%s\"";
 		$msg{"searchObj"} = "[A] suche nach \"%s\"";
@@ -1245,9 +1489,10 @@
 		$msg{"noGroup"} = "[E] (%s) Gruppe \"%s\" existiert nicht";
 		$msg{"noPerf"} = "[E] es gibt KEINE Performance-Daten fuer \"%s\"";
 		$msg{"noRRDchk"} = "[I] perfdata-Verzeichnis wird NICHT geprueft";
-		$msg{"RRDpath"} = "[A] pruefen von \"%s\"";
+		$msg{"RRDpath"} = "[A] pruefen von RRDpath \"%s\"";
 		$msg{"RRDuser"} = "[E] \"%s\": Owner ist \"%s\" anstatt %s";
 		$msg{"RRDgroup"} = "[E] \"%s\": Group ist \"%s\" anstatt %s";
+		$msg{"RRDold"} = "[W] \"%s\" ist aelter als %s Sekunden";
 		$msg{"RRDcount"} = "[I] %s Verzeichnis(se) mit insgesamt %s rrd-Datei(en)";
 		$msg{"noRRDfiles"} = "[E] %s Verzeichnis(se) aber KEINE rrd-Dateien => KEINE Graphen!";
 		$msg{"useRRDs"} = "[I] RRDs Perl-Modul installiert";
@@ -1269,27 +1514,29 @@
 		$msg{"missTempVar"} = "[E] Variable \"%s\" im Template fehlt";
 		$msg{"missinvTempVal"} = "[E] Wert \"%s\" im Template fehlt";
 		$msg{"noCmd"} = "[E] command_name \"%s\" nicht gefunden";
-		$msg{"noParCfg"} = "[E] \"%s\" nicht in nagios.cfg gefunden";
-		$msg{"noParCfgH"} = "[H] \"%s\" nicht in nagios.cfg gefunden";
+		$msg{"noParCfg"} = "[E] \"%s\" nicht in $product.cfg gefunden";
+		$msg{"noParCfgH"} = "[H] \"%s\" nicht in $product.cfg gefunden";
 		$msg{"notAdv"} = "[H] \"%s\" wird fuer Nagios < 3.x nicht empfohlen";
 		$msg{"invChar"} = "[E] \"%s\" (%s) hat ein ungueltiges Format/enthaelt ungueltige Zeichen";
 		$msg{"undefVal"} = "[E] kein (gueltiger) Wert fuer \"%s\" definiert";
 		$msg{"noNumber"} = "[E] %s ist keine gueltige Zahl";
 		$msg{"startEnd"} = "[E] Startwert (%s) ist groesser als Endwert (%s)";
 		$msg{"noFile"} = "[E] (%s) Datei \"%s\" fehlt";
+		$msg{"noRes"} = "[E] Ressource \"%s\" ist nicht definiert";
 		$msg{"noFileYet"} = "[I] (%s) Datei \"%s\" existiert (noch) nicht";
 		$msg{"noDir"} = "[E] (%s) Verzeichnis \"%s\" fehlt";
 		$msg{"noSock"} = "[E] \"%s\" ist kein Socket";
+		$msg{"noWrite"} = "[E] \"%s\": keine Schreibberechtigung fuer \"%s\"";
 		$msg{"key"} = "[D] key:\"%s\"";
 		$msg{"keyValue"} = "[D] Direktive:\"%s\", Wert:\"%s\"";
 		$msg{"oddLine"} = "[W] \"%s\" sieht komisch aus";
 		$msg{"errOpen"} = "[E] oeffnen von %s fehlgeschlagen, RC=%s";
 
 		$msg{"LinkNagiosChk"} = "[H] http://www.nagios-wiki.de/nagios/doku3/verify_config";
-		$msg{"LinkReqSW"} = "[H] http://www.pnp4nagios.org/pnp$language/about#benoetigte_software";
-		$msg{"LinkPNPreq"} = "[H] http://www.pnp4nagios.org/pnp$language/about#anforderungen_an_plugins";
-		$msg{"LinkEnaEnv"} = "http://www.nagios-wiki.de/nagios/doku3/#enable_environment_macros";
-		$msg{"LinkEnaPerf"} = "http://www.nagios-wiki.de/nagios/doku3/#process_performance_data";
+		$msg{"LinkReqSW"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/about#benoetigte_software";
+		$msg{"LinkPNPreq"} = "[H] http://docs.pnp4nagios.org/$language/pnp-${doc_version}/about#anforderungen_an_plugins";
+		$msg{"LinkEnaEnv"} = "[H] http://www.nagios-wiki.de/nagios/doku3/#enable_environment_macros";
+		$msg{"LinkEnaPerf"} = "[H] http://www.nagios-wiki.de/nagios/doku3/configmain#process_performance_data";
 		$msg{"LinkNagiosCfg"} = "[H] http://www.nagios-wiki.de/nagios/doku3/configmain#%s";
 		$msg{"LinkNagiosCfg2"} = "[H] http://www.nagios-wiki.de/nagios/doku3/configmain#process_performance_data\n    (und folgende Optionen)";
 	}


Index: pnp4nagios.spec
===================================================================
RCS file: /cvs/pkgs/rpms/pnp4nagios/devel/pnp4nagios.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -r1.8 -r1.9
--- pnp4nagios.spec	27 Aug 2009 20:14:22 -0000	1.8
+++ pnp4nagios.spec	27 Aug 2009 21:36:31 -0000	1.9
@@ -1,6 +1,6 @@
 Name:           pnp4nagios
 Version:        0.4.14
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Nagios performance data analysis tool
 
 Group:          Applications/System
@@ -11,6 +11,7 @@ Source1:        pnp4nagios.logrotate.con
 Source2:        pnp4nagios-npcd.sysvinit
 Source3:        pnp4nagios-README.fedora
 Patch1:         pnp4nagios-0.4.14-change_broker_install_location.patch
+Patch2:         pnp4nagios-0.4.14-verify_pnp_config.in_rev654.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  rrdtool-perl
@@ -30,7 +31,21 @@ and stores them automatically into RRD-d
 
 %prep
 %setup -q -n pnp-%{version}
+
+# Move broker to a better location
 %patch1 -p0
+
+# Update verify_pnp_config script for bugfixes
+%patch2 -p1
+
+# Fix file encoding and end of line
+pushd contrib
+iconv -f iso8859-1 -t utf-8 verify_pnp_config.txt > verify_pnp_config.txt.utf8
+touch -r verify_pnp_config.txt verify_pnp_config.txt.utf8
+mv -f verify_pnp_config.txt.utf8 verify_pnp_config.txt
+sed -i -e "s/\r//" verify_pnp_config.txt
+popd
+
 cp -p %{SOURCE3} README.fedora
 sed -i -e 's/^INSTALL_OPTS="-o $nagios_user -g $nagios_grp"/INSTALL_OPTS=""/' \
     configure
@@ -48,6 +63,9 @@ sed -i -e '/^\t$(MAKE) strip-post-instal
            --with-perfdata-spool-dir=%{_localstatedir}/spool/%{name}/
 make %{?_smp_mflags} all
 
+# Remove unwanted file from the contrib directory
+rm contrib/verify_pnp_config.in 
+
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -89,7 +107,7 @@ fi
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README README.fedora
-%doc README.npcd THANKS TODO
+%doc README.npcd THANKS TODO contrib/
 %dir %{_sysconfdir}/pnp4nagios
 %config(noreplace) %{_sysconfdir}/pnp4nagios/*
 %config(noreplace) %{_sysconfdir}/logrotate.d/pnp4nagios
@@ -106,8 +124,11 @@ fi
 
 
 %changelog
+* Tue Aug 27 2009 Xavier Bachelot <xavier at bachelot.org> 0.4.14-2
+- Ship contrib directory as doc.
+
 * Tue Aug 27 2009 Xavier Bachelot <xavier at bachelot.org> 0.4.14-1
-- Update to 0.4.14.
+- Update to 0.4.14 (RHBZ#518069).
 - Fix typo in README.fedora (RHBZ#490664).
 - Move npcdmod.o to a better place.
 - BR: rrdtool-perl




More information about the scm-commits mailing list