W załączniku kilka łatek na nagios-plugins: nagios-plugins-check_disk_smb-zero-cap.patch: - możliwość sprawdzania zasobu o pojemności 0 (np IPC$) nagios-plugins-check_hpjd-no-paper-out.patch: - dodatkowa opcja, wyłączająca warning o braku papieru nagios-plugins-check_snmp_disk_monitor-bulk.patch: - blukwalk po 2, a nie 4 (workaround na bug w snmp w perlu) nagios-plugins-check_snmp_procs-fix.patch: - zadeklarowanie zmiennych, których się używa... nagios-plugins-paths.patch: - ścieżki do utils.pl
Do tego ostatniego jeszcze sed w specu masowo poprawiający te ścieżki (dla pluginów w contrib/), oraz używanie systemowego regex. -- Pozdrawiam, Marek Marczykowski | gg:2873965 marmarek at staszic waw pl | xmpp:marmarek at staszic waw pl
--- 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";
diff -aru nagios-plugins-1.4.13.orig/plugins/check_hpjd.c
nagios-plugins-1.4.13/plugins/check_hpjd.c
--- plugins/check_hpjd.c 2008-05-07 12:02:42.000000000 +0200
+++ plugins/check_hpjd.c 2008-12-05 15:19:10.746605526 +0100
@@ -70,6 +70,7 @@
char *community = NULL;
char *address = NULL;
+int nopaperout = 0;
int
main (int argc, char **argv)
@@ -243,7 +244,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) {
@@ -318,6 +321,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}
@@ -328,7 +332,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;
@@ -345,6 +349,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);
@@ -404,7 +411,9 @@
printf (" %s\n", "-C, --community=STRING");
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 ("\n");
#ifdef NP_EXTRA_OPTS
@@ -421,6 +430,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);
}
--- 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
--- 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(
--- 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";
Index: nagios-plugins.spec
===================================================================
RCS file: /cvsroot/SPECS/nagios-plugins.spec,v
retrieving revision 1.93
diff -u -r1.93 nagios-plugins.spec
--- nagios-plugins.spec 11 Oct 2008 16:04:56 -0000 1.93
+++ nagios-plugins.spec 5 Dec 2008 14:36:53 -0000
@@ -33,6 +33,11 @@
Patch18: %{name}-configure.patch
Patch19: %{name}-perlautodep.patch
Patch20: %{name}-cosmetic.patch
+Patch21: %{name}-check_hpjd-no-paper-out.patch
+Patch22: %{name}-check_snmp_procs-fix.patch
+Patch23: %{name}-check_disk_smb-zero-cap.patch
+Patch24: %{name}-paths.patch
+Patch25: %{name}-check_snmp_disk_monitor-bulk.patch
#Patch: %{name}-shared.patch # needs finishing
URL: http://www.nagiosplugins.org/
BuildRequires: autoconf
@@ -459,6 +464,11 @@
%patch18 -p1
%patch19 -p1
%patch20 -p1
+%patch21 -p0
+%patch22 -p0
+%patch23 -p0
+%patch24 -p0
+%patch25 -p0
# bring contribs into shape...
cd contrib
@@ -474,6 +484,13 @@
sed -i -e '1s,#!.*/bin/bash,#!/bin/sh,' \
check_smb.sh
+
+sed -i -e "
+ 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 ../plugins-scripts/*.pl
+
mv check_appletalk.{pl,orig}
sed -ne '/---/!p;/---/q' < check_appletalk.orig > check_appletalk.pl
@@ -537,7 +554,8 @@
--with-df-command='/bin/df -P' \
--with-apt-get-command=/usr/bin/apt-get \
--with-qmail-qstat-command=/usr/bin/qmail-qstat \
- --with-mailq-command=/usr/bin/mailq
+ --with-mailq-command=/usr/bin/mailq \
+ --without-included-regex
%{__make}
pgpM8nREADzRR.pgp
Description: PGP signature
_______________________________________________ pld-devel-pl mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-devel-pl
