nagios-plugins

Marek Marczykowski marmarek w staszic.waw.pl
Sob, 7 Cze 2008, 09:47:28 CEST


Popracowałem trochę nad nagios-plugins:

nagios-plugins-check_disk_smb-zero-cap.patch:
 Sensowne traktowanie zasobów o zerowej pojemności (np, IPC$, przydatne
 do sprawdzania, czy samba działa)

nagios-plugins-check_hpjd-no-paper-out.patch:
 Opcja wyłączająca warninga na "brak papieru".

nagios-plugins-check_pgsql-namedatalen.patch:
 Brakujący include.

nagios-plugins-check_snmp_disk_monitor-bulk.patch:
 Zmiana z pobierania z po 4 rekordy na po 2 (chyba bug w Net::SNMP)

nagios-plugins-check_snmp_procs-fix.patch:
 Poprawki, żeby działało z "use strict"

nagios-plugins-paths.patch:
 Kolejne fixy w contrib (ścieżki do utils.pm)

nagios-plugins.spec.diff:
 Dodanie patchy powyżej, kolejne porządki z ścieżkami do utils.pm i
 uĹźywanie systemowego regex

PS. Nie da się skompilować tej paczki z autoconf-2.62:
+ aclocal -I gl/m4 -I m4
configure.in:44: error: AC_REQUIRE: circular dependency of AC_GNU_SOURCE
gl/m4/extensions.m4:19: AC_USE_SYSTEM_EXTENSIONS is expanded from...
../../lib/autoconf/specific.m4:331: AC_GNU_SOURCE is expanded from...
gl/m4/gnulib-comp.m4:21: gl_EARLY is expanded from...
configure.in:44: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: autom4te failed with exit status: 1

Z 2.61 działa.

-- 
Pozdrawiam,
Marek Marczykowski          |  gg:2873965
marmarek at staszic waw pl  | jid:marmarek at staszic waw pl

-------------- następna część ---------
--- plugins-scripts/check_disk_smb.orig	2008-04-23 12:22:41.792842643 +0000
+++ plugins-scripts/check_disk_smb.pl	2008-04-23 12:23:31.728177767 +0000
@@ -181,7 +181,8 @@
 
 	my ($avail) = ($3*$2)/1024;
 	my ($avail_bytes) = $avail;
-	my ($capper) = int(($3/$1)*100);
+	my ($capper);
+	if ($1!=0) { $capper = int(($3/$1)*100) } else { $capper=100 };
 	my ($mountpt) = "\\\\$host\\$share";
 
 
-------------- następna część ---------
--- plugins/check_hpjd.c	2007-01-28 21:46:41.000000000 +0000
+++ /home/users/marmarek/check_hpjd.c	2008-04-23 12:34:57.605686879 +0000
@@ -72,6 +72,7 @@
 
 char *community = NULL;
 char *address = NULL;
+int nopaperout = 0;
 
 int
 main (int argc, char **argv)
@@ -242,7 +243,9 @@
 			strcpy (errmsg, _("Paper Jam"));
 		}
 		else if (paper_out) {
-			result = STATE_WARNING;
+			if (!nopaperout) {
+				result = STATE_WARNING;
+			}
 			strcpy (errmsg, _("Out of Paper"));
 		}
 		else if (line_status == OFFLINE) {
@@ -317,6 +320,7 @@
 /*  		{"critical",       required_argument,0,'c'}, */
 /*  		{"warning",        required_argument,0,'w'}, */
 /*  		{"port",           required_argument,0,'P'}, */
+		{"nopaperout", no_argument, 0, 'n'},
 		{"version", no_argument, 0, 'V'},
 		{"help", no_argument, 0, 'h'},
 		{0, 0, 0, 0}
@@ -327,7 +331,7 @@
 
 	
 	while (1) {
-		c = getopt_long (argc, argv, "+hVH:C:", longopts, &option);
+		c = getopt_long (argc, argv, "+hnVH:C:", longopts, &option);
 
 		if (c == -1 || c == EOF || c == 1)
 			break;
@@ -344,6 +348,9 @@
 		case 'C':									/* community */
 			community = strscpy (community, optarg);
 			break;
+		case 'n':									/* nopaperout */
+			nopaperout = 1;
+			break;
 		case 'V':									/* version */
 			print_revision (progname, revision);
 			exit (STATE_OK);
@@ -392,17 +399,18 @@
 	printf (COPYRIGHT, copyright, email);
 
 	printf ("%s\n", _("This plugin tests the STATUS of an HP printer with a JetDirect card."));
-  printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin."));
-
-  printf ("\n\n");
+	printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin."));
+	printf ("\n\n");
   
 	print_usage ();
 
 	printf (_(UT_HELP_VRSN));
 
 	printf (" %s\n", "-C, --community=STRING");
-  printf ("    %s", _("The SNMP community name "));
-  printf (_("(default=%s)"), DEFAULT_COMMUNITY);
+	printf ("    %s", _("The SNMP community name "));
+	printf (" %s\n", "-n, --nopaperout");
+	printf (_("(default=%s)"), DEFAULT_COMMUNITY);
+	printf ("    %s\n", "No return WARNING state on \"Out of paper\"");
 
 	printf (_(UT_SUPPORT));
 }
@@ -412,6 +420,6 @@
 void
 print_usage (void)
 {
-  printf (_("Usage:"));
-	printf ("%s -H host [-C community]\n", progname);
+	printf (_("Usage:"));
+	printf ("%s -H host [-C community] [-n]\n", progname);
 }
-------------- następna część ---------
--- plugins/check_pgsql.c.orig	2008-04-23 13:09:19.418439393 +0000
+++ plugins/check_pgsql.c	2008-04-23 13:10:46.118024739 +0000
@@ -44,6 +44,7 @@
 
 #include "netutils.h"
 #include <libpq-fe.h>
+#include <pg_config_manual.h>
 
 #define DEFAULT_DB "template1"
 #define DEFAULT_HOST "127.0.0.1"
-------------- następna część ---------
--- contrib/check_snmp_disk_monitor.pl.orig	2008-04-24 13:28:09.277695884 +0000
+++ contrib/check_snmp_disk_monitor.pl	2008-04-24 13:28:21.135459424 +0000
@@ -111,7 +111,7 @@
 );
 
 # retrieve the data from the remote host
-my( $mps, $alloc, $size, $used ) = $snmp_session->bulkwalk( 0, 4, [['hrStorageDescr'],['hrStorageAllocationUnits'],['hrStorageSize'],['hrStorageUsed']] );
+my( $mps, $alloc, $size, $used ) = $snmp_session->bulkwalk( 0, 2, [['hrStorageDescr'],['hrStorageAllocationUnits'],['hrStorageSize'],['hrStorageUsed']] );
 check_for_errors();
 
 alarm( 0 ); # all done with the network connection
-------------- następna część ---------
--- contrib/check_snmp_procs.pl.orig	2008-04-23 12:13:17.833685899 +0000
+++ contrib/check_snmp_procs.pl	2008-04-23 12:15:18.456846167 +0000
@@ -59,6 +59,7 @@
 my $opt_version;
 my $opt_wanted_procs;
 my $opt_warning;
+my $opt_password;
 
 #
 my $max_no_processes = 999999;
@@ -123,6 +124,8 @@
 	exit $ERRORS{'UNKNOWN'};
 }
 
+my ($longest_wanted, $longest_current);
+
 ($longest_wanted, @wanted_procs) = parse_wanted_procs($opt_verbose, $opt_wanted_procs, $opt_warning, $opt_critical);
 
 $SIG{'ALRM'} = sub {
@@ -240,7 +243,7 @@
 
 	my($verbose, $host, $username, $privpassword, $authprotocol, $authpassword, $community, $port, $oidname, $snmp_version) = @_;
 	my(%process_list, %process_pid_list, $result);
-	my $process_list_longest = 1, $not_done = 1;
+	my ($process_list_longest, $not_done) = (1, 1);
 	my(@args, @oids, $oid, $name);
 
 	($session, $error) = Net::SNMP->session(
-------------- następna część ---------
--- contrib/check_snmp_disk_monitor.pl  2008-04-23 14:27:47.390299906 +0000
+++ contrib/check_snmp_disk_monitor.pl~ 2008-04-23 13:27:18.000000000 +0000
@@ -7,7 +7,7 @@

 use strict;
 require 5.6.0;
-use lib qw( /opt/nagios/libexec );
+use lib qw( /usr/lib/nagios/plugins );
 use utils qw(%ERRORS $TIMEOUT &print_revision &support &usage);
 use SNMP 5.0;
 use Getopt::Long;
--- contrib/check_snmp_procs.pl.orig    2008-04-23 12:13:17.833685899 +0000
+++ contrib/check_snmp_procs.pl 2008-04-23 12:15:18.456846167 +0000
@@ -32,10 +32,10 @@
 #    make it work with snmp version 3
 #    Suggestions???
 #
-#use strict;
+use strict;
 use Getopt::Long;
 use Net::SNMP qw (oid_lex_sort oid_base_match SNMP_VERSION_1);
-use lib "/usr/local/nagios/libexec";
+use lib "/usr/lib/nagios/plugins";
 use utils qw(%ERRORS &print_revision &support &usage);

 my $PROGNAME="check_snmp_procs";

-------------- następna część ---------
Index: nagios-plugins.spec
===================================================================
RCS file: /cvsroot/SPECS/nagios-plugins.spec,v
retrieving revision 1.89
diff -u -r1.89 nagios-plugins.spec
--- nagios-plugins.spec	25 May 2008 19:43:23 -0000	1.89
+++ nagios-plugins.spec	7 Jun 2008 07:09:03 -0000
@@ -32,6 +32,12 @@
 Patch16:	%{name}-check_disk_local_option.patch
 Patch17:	%{name}-check_ldap_pointer.patch
 Patch18:	%{name}-misc_typos.patch
+Patch19:		%{name}-check_hpjd-no-paper-out.patch
+Patch20:		%{name}-check_snmp_procs-fix.patch
+Patch21:	%{name}-check_disk_smb-zero-cap.patch
+Patch22:	%{name}-check_pgsql-namedatalen.patch
+Patch23:	%{name}-paths.patch
+Patch24:	%{name}-check_snmp_disk_monitor-bulk.patch
 #Patch: %{name}-shared.patch # needs finishing
 URL:		http://www.nagiosplugins.org/
 BuildRequires:	autoconf
@@ -459,6 +465,12 @@
 %patch16 -p1
 %patch17 -p1
 %patch18 -p1
+%patch19 -p0
+%patch20 -p0
+%patch21 -p0
+%patch22 -p0
+%patch23 -p0
+%patch24 -p0
 
 # bring contribs into shape...
 cd contrib
@@ -479,7 +491,7 @@
 	s,use lib '.*/nagios/libexec/',use lib '%{_pluginlibdir}',
 	s,require '/usr/libexec/nagios/plugins,require '%{_pluginlibdir},
 	s,use lib utils.pm,use lib '%{_pluginlibdir}', # that's there really a typo
-" *.pl
+" *.pl ../plugins-scripts/*.pl
 
 mv check_appletalk.{pl,orig}
 sed -ne '/---/!p;/---/q' < check_appletalk.orig > check_appletalk.pl
@@ -524,7 +536,8 @@
 	--with-snmpget-command=/usr/bin/snmpget \
 	--with-snmpgetnext-command=/usr/bin/snmpgetnext \
 	--with-df-command='/bin/df -P' \
-	--with-mailq=/usr/bin/mailq
+	--with-mailq=/usr/bin/mailq \
+	--without-included-regex
 
 %{__make}
 
-------------- następna część ---------
Załącznik, który nie był tekstem został usunięty...
Name: nie znany
Type: application/pgp-signature
Size: 189 bytes
Desc: nie znany
Url : /mailman/pipermail/pld-devel-pl/attachments/20080607/a968d273/attachment.sig 


Więcej informacji o liście dyskusyjnej pld-devel-pl