[pkg-nagios-changes] [Git][nagios-team/pkg-nagios-snmp-plugins][master] 10 commits: check_snmp_int.pl: added ign-admindown, ign-emptyalias options. fixed...

Jan Wagner gitlab at salsa.debian.org
Mon Dec 7 16:40:04 GMT 2020



Jan Wagner pushed to branch master at Debian Nagios Maintainer Group / pkg-nagios-snmp-plugins


Commits:
a815051c by Jan Wagner at 2020-12-07T15:28:22+01:00
check_snmp_int.pl: added ign-admindown, ign-emptyalias options. fixed unitialized variable warning by adding d/p/14_check_snmp_int_ign from upstream

- - - - -
c1ffe3e1 by Jan Wagner at 2020-12-07T15:31:48+01:00
check_snmp_int.pl: Add spaces only if necessary by adding d/p/15_check_snmp_int_spaces from upstream

- - - - -
ef233ba6 by Jan Wagner at 2020-12-07T15:34:21+01:00
check_snmp_win.pl: Add -o option (max message size) by adding d/p/16_check_snmp_win_max_message_size from upstream

- - - - -
085ba7e1 by Jan Wagner at 2020-12-07T15:36:51+01:00
check_snmp_storage.pl: add support for allowing considering OK if no storage found matching given criteria by adding d/p/17_check_snmp_storage_okifempty from upstream

- - - - -
84561d3e by Jan Wagner at 2020-12-07T15:38:56+01:00
check_snmp_int.pl: fix perf_out not defined error by adding d/p/18_check_snmp_int_fix_perf_out

- - - - -
e972bef2 by Jan Wagner at 2020-12-07T15:42:51+01:00
Merge branch 'development' into update_github

- - - - -
8f6cd11f by Jan Wagner at 2020-12-07T15:46:28+01:00
Refreshing patches

- - - - -
476d4488 by Jan Wagner at 2020-12-07T15:49:17+01:00
Merge branch 'development' into update_github

- - - - -
fce5c7b8 by Jan Wagner at 2020-12-07T16:47:56+01:00
Prepare release

- - - - -
5579d164 by Jan Wagner at 2020-12-07T17:03:28+01:00
New changelog

- - - - -


7 changed files:

- debian/changelog
- + debian/patches/14_check_snmp_int_ign
- + debian/patches/15_check_snmp_int_spaces
- + debian/patches/16_check_snmp_win_max_message_size
- + debian/patches/17_check_snmp_storage_okifempty
- + debian/patches/18_check_snmp_int_fix_perf_out
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,17 +1,47 @@
-nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium
+nagios-snmp-plugins (2.1.0-3) UNRELEASED; urgency=medium
 
-  [ Jan Wagner ]
-  *
+  * NOT RELEASED YET
+
+ -- Jan Wagner <waja at cyconet.org>  Mon, 07 Dec 2020 17:03:12 +0100
+
+nagios-snmp-plugins (2.1.0-2) unstable; urgency=medium
 
   [ Debian Janitor ]
   * Use secure copyright file specification URI.
   * debian/copyright: use spaces rather than tabs to start continuation
     lines.
-  * Bump debhelper from deprecated 5 to 12.
+  * Bump debhelper from deprecated 5 to 12. (Closes: #965745)
   * Set debhelper-compat version in Build-Depends.
   * Update standards version to 4.5.0, no changes needed.
 
- -- Jan Wagner <waja at cyconet.org>  Wed, 23 Jan 2019 22:34:43 +0100
+  [ Jan Wagner ]
+  * [a75e780] Removing .travis.yml and adding .gitlab-ci.yml
+
+  [ Bas Couwenberg ]
+  * [e989ff9] Bump watch file version to 4.
+  * [b345ea5] Bump Standards-Version to 4.5.1, no changes.
+
+  [ Jan Wagner ]
+  * [a815051] check_snmp_int.pl: added ign-admindown, ign-emptyalias options.
+    fixed unitialized variable warning by adding d/p/14_check_snmp_int_ign
+    from upstream
+  * [c1ffe3e] check_snmp_int.pl: Add spaces only if necessary by adding
+    d/p/15_check_snmp_int_spaces from upstream
+  * [ef233ba] check_snmp_win.pl: Add -o option (max message size) by adding
+    d/p/16_check_snmp_win_max_message_size from upstream
+  * [085ba7e] check_snmp_storage.pl: add support for allowing considering OK if
+    no storage found matching given criteria by adding
+    d/p/17_check_snmp_storage_okifempty from upstream
+  * [84561d3] check_snmp_int.pl: fix perf_out not defined error by adding
+    d/p/18_check_snmp_int_fix_perf_out
+  * [45b2b11] d/control: Updating upstream to
+    https://github.com/SteScho/manubulon-snmp
+  * [f9bf220] d/watch: Updating upstream to
+    https://github.com/SteScho/manubulon-snmp
+  * [8f6cd11] Refreshing patches
+  * [c1f1d25] d/copyright: Removing tabs
+
+ -- Jan Wagner <waja at cyconet.org>  Mon, 07 Dec 2020 15:50:39 +0100
 
 nagios-snmp-plugins (2.1.0-1) unstable; urgency=medium
 


=====================================
debian/patches/14_check_snmp_int_ign
=====================================
@@ -0,0 +1,187 @@
+From 2d11bcf5c884793eb21a946fdd04cf87baf57ad3 Mon Sep 17 00:00:00 2001
+From: Stanislav Datskevych <me at nek0.net>
+Date: Wed, 9 Jan 2019 11:25:39 +0100
+Subject: [PATCH] added ign-admindown, ign-emptyalias options. fixed
+ unitialized variable warning
+
+---
+ plugins/check_snmp_int.pl | 98 +++++++++++++++++++++++++++++++--------
+ 1 file changed, 79 insertions(+), 19 deletions(-)
+
+diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl
+index e938131..721c3b2 100755
+--- a/plugins/check_snmp_int.pl
++++ b/plugins/check_snmp_int.pl
+@@ -35,7 +35,7 @@
+ my $name_table         = '1.3.6.1.2.1.31.1.1.1.1';
+ my $alias_table        = '.1.3.6.1.2.1.31.1.1.1.18';
+ my $oper_table         = '1.3.6.1.2.1.2.2.1.8.';
+-my $admin_table        = '1.3.6.1.2.1.2.2.1.7.';
++my $admin_table        = '1.3.6.1.2.1.2.2.1.7';
+ my $speed_table        = '1.3.6.1.2.1.2.2.1.5.';
+ my $speed_table_64     = '1.3.6.1.2.1.31.1.1.1.15.';
+ my $in_octet_table     = '1.3.6.1.2.1.2.2.1.10.';
+@@ -60,20 +60,22 @@
+ # Globals
+ 
+ # Standard options
+-my $o_host    = undef;    # hostname
+-my $o_port    = 161;      # port
+-my $o_descr   = undef;    # description filter
+-my $o_help    = undef;    # wan't some help ?
+-my $o_admin   = undef;    # admin status instead of oper
+-my $o_inverse = undef;    # Critical when up
+-my $o_dormant = undef;    # Dormant state is OK
+-my $o_down    = undef;    # Down state is OK
+-my $o_verb    = undef;    # verbose mode
+-my $o_version = undef;    # print version
+-my $o_noreg   = undef;    # Do not use Regexp for name
+-my $o_short   = undef;    # set maximum of n chars to be displayed
+-my $o_label   = undef;    # add label before speed (in, out, etc...).
+-my $o_weather = undef;    # output "weathermap" data for NagVis
++my $o_host              = undef;    # hostname
++my $o_port              = 161;      # port
++my $o_descr             = undef;    # description filter
++my $o_help              = undef;    # wan't some help ?
++my $o_admin             = undef;    # admin status instead of oper
++my $o_inverse           = undef;    # Critical when up
++my $o_dormant           = undef;    # Dormant state is OK
++my $o_down              = undef;    # Down state is OK
++my $o_ignore_admindown  = undef;    # Ignore interfaces in admin down state
++my $o_ignore_emptyalias = undef;    # ignore interfaces with empty alias (interface description string)
++my $o_verb              = undef;    # verbose mode
++my $o_version           = undef;    # print version
++my $o_noreg             = undef;    # Do not use Regexp for name
++my $o_short             = undef;    # set maximum of n chars to be displayed
++my $o_label             = undef;    # add label before speed (in, out, etc...).
++my $o_weather           = undef;    # output "weathermap" data for NagVis
+ 
+ # Performance data options
+ my $o_perf  = undef;      # Output performance data
+@@ -224,6 +226,10 @@ sub help {
+    Dormant state is an OK state
+ --down
+    Down state is an OK state
++--ign-admindown
++   Ignore interfaces in Admin down state
++--ign-emptyalias
++   Ignore interfaces having empty alias (port description)
+ -o, --octetlength=INTEGER
+   max-size of the SNMP message, usefull in case of Too Long responses.
+   Be carefull with network filters. Range 484 - 65535, default are
+@@ -358,7 +364,9 @@ sub check_options {
+         'dormant'       => \$o_dormant,
+         'down'          => \$o_down,
+         'W'             => \$o_weather,
+-        'weather'       => \$o_weather
++        'weather'       => \$o_weather,
++        'ign-admindown' => \$o_ignore_admindown,
++        'ign-emptyalias' => \$o_ignore_emptyalias,
+     );
+     if (defined($o_help))    { help();      exit $ERRORS{"UNKNOWN"} }
+     if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} }
+@@ -489,6 +497,14 @@ sub check_options {
+         print_usage();
+         exit $ERRORS{"UNKNOWN"};
+     }
++
++    #### check if --admin and --ign-admindown are put together.
++    #### --ign-admindown expects the open_state of the port to be used
++    if (defined($o_ignore_admindown) && defined($o_admin)) {
++        print "ERROR: --ign-admindown and -a are mutually exclusive. Please select only one.\n\n";
++        print_usage();
++        exit $ERRORS{"UNKNOWN"};
++    }
+ }
+ 
+ ########## MAIN #######
+@@ -616,6 +632,31 @@ sub check_options {
+     $in_octet_table  = $in_octet_table_64;
+ }
+ 
++# If --ign-admindown is set, we need to have admin status table
++my $admin_status_table;
++if (defined($o_ignore_admindown)) {
++    $admin_status_table = $session->get_table(Baseoid => $admin_table);
++
++    if (!defined($admin_status_table)) {
++        printf("ERROR: Admin status table : %s.\n", $session->error);
++        $session->close;
++        exit $ERRORS{"UNKNOWN"};
++    }
++}
++
++# If --ign-emptyalias is set, we need to have aliases table
++my $interfaces_aliases;
++if (defined($o_ignore_emptyalias)) {
++    $interfaces_aliases = $session->get_table(Baseoid => $alias_table);
++
++    if (!defined($interfaces_aliases)) {
++        printf("ERROR: Alias status table : %s.\n", $session->error);
++        $session->close;
++        exit $ERRORS{"UNKNOWN"};
++    }
++}
++
++
+ # Select interface by regexp of exact match
+ # and put the oid to query in an array
+ 
+@@ -623,12 +664,30 @@ sub check_options {
+ foreach my $key (sort { $$resultat{$a} cmp $$resultat{$b} } keys %$resultat) {
+     verb("OID : $key, Desc : $$resultat{$key}");
+ 
++    my $ignore = 0;
++    my $prefix = $query_table . ".";
++    my ($ifindex) = $key =~ /$prefix(\d+)$/;
++
++    # if ign-admindown is set, check the ifIndex against admin status
++    if (defined($o_ignore_admindown)) {
++	my $index = $admin_table . "." . $ifindex;
++        my $admstatus = $$admin_status_table{$index};
++        $ignore = 1 if ($admstatus == 2);
++    }
++
++    # if ign-emptyalias is set, check the ifIndex against alias string
++    if (defined($o_ignore_emptyalias)) {
++	my $index = $alias_table . "." . $ifindex;
++        my $alias = $$interfaces_aliases{$index};
++        $ignore = 1 if ($alias eq "");
++    }
++
+     # test by regexp or exact match
+     my $test
+         = defined($o_noreg)
+         ? $$resultat{$key} eq $o_descr
+         : $$resultat{$key} =~ /$o_descr/;
+-    if ($test) {
++    if ($test && !$ignore) {
+ 
+         # get the index number of the interface
+         my @oid_list = split(/\./, $key);
+@@ -645,7 +704,7 @@ sub check_options {
+             # Get rid of special caracters (specially for Windows)
+             $descr[$num_int] =~ s/[[:cntrl:]]//g;
+             # put the admin or oper oid in an array
+-            $oids[$num_int]= defined ($o_admin) ? $admin_table . $tindex[$num_int] 
++            $oids[$num_int]= defined ($o_admin) ? $admin_table . "." . $tindex[$num_int]
+ 			: $oper_table . $tindex[$num_int];
+ 
+             # Put the performance oid 
+@@ -724,7 +783,7 @@ sub check_options {
+     # Get the status of the current interface
+     my $int_status
+         = defined($o_admin)
+-        ? $$result{ $admin_table . $tindex[$i] }
++        ? $$result{ $admin_table . "." . $tindex[$i] }
+         : $$result{ $oper_table . $tindex[$i] };
+ 
+     # Make the bandwith & error checks if necessary
+@@ -976,6 +1035,7 @@ sub check_options {
+             $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c ";
+         }
+         if (defined($o_perfs)) {
++	    my $speed_real = "" unless (defined($speed_real));
+             $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_speed_bps'=" . $speed_real . " ";
+         }
+         if (defined($o_weather) && $usable_data == 1) {


=====================================
debian/patches/15_check_snmp_int_spaces
=====================================
@@ -0,0 +1,32 @@
+From 8f1c304b82c7bd9f5d1b23faa91ba86b0f99c4e2 Mon Sep 17 00:00:00 2001
+From: PGranado <pgranado at pt.lu>
+Date: Fri, 22 Mar 2019 15:05:32 +0100
+Subject: [PATCH] Add spaces only if necessary, resolving bug #32
+
+---
+ plugins/check_snmp_int.pl | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/plugins/check_snmp_int.pl
++++ b/plugins/check_snmp_int.pl
+@@ -777,7 +777,7 @@
+ # make all checks and output for all interfaces
+ for (my $i = 0; $i < $num_int; $i++) {
+     $print_out .= ", " if (defined($print_out));
+-    $perf_out  .= " "  if (defined($perf_out));
++    
+     my $usable_data = 1;
+ 
+     # Get the status of the current interface
+@@ -785,7 +785,10 @@
+         = defined($o_admin)
+         ? $$result{ $admin_table . "." . $tindex[$i] }
+         : $$result{ $oper_table . $tindex[$i] };
+-
++    
++    # Add spaces only if necessary
++    $perf_out .= " " if (defined ($perf_out) && $int_status==2 ) ;
++    
+     # Make the bandwith & error checks if necessary
+     if (defined($o_checkperf) && $int_status == 1) {
+         $temp_file_name = $descr[$i];


=====================================
debian/patches/16_check_snmp_win_max_message_size
=====================================
@@ -0,0 +1,178 @@
+From dc67e601453a564db68d7921f16fb6ea875f68be Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Mathias=20V=C3=A9drines?= <mvedrines at capensis.fr>
+Date: Fri, 21 Feb 2020 12:18:53 +0100
+Subject: [PATCH] Add -o option (max message size) in check_snmp_win
+
+---
+ plugins/check_snmp_win.pl | 121 +++++++++++++++++++++++---------------
+ 1 file changed, 72 insertions(+), 49 deletions(-)
+
+diff --git a/plugins/check_snmp_win.pl b/plugins/check_snmp_win.pl
+index 148d6eb..c5cb573 100755
+--- a/plugins/check_snmp_win.pl
++++ b/plugins/check_snmp_win.pl
+@@ -47,24 +47,25 @@
+ 
+ my $Name = 'check_snmp_win';
+ 
+-my $o_host      = undef;        # hostname
+-my $o_community = undef;        # community
+-my $o_port      = 161;          # port
+-my $o_version2  = undef;        #use snmp v2c
+-my $o_descr     = undef;        # description filter
+-my @o_descrL    = undef;        # Service descriprion list.
+-my $o_showall   = undef;        # Show all services even if OK
+-my $o_type      = "service";    # Check type (service, ...)
+-my $o_number    = undef;        # Number of service for warn and crit levels
+-my $o_help      = undef;        # wan't some help ?
+-my $o_verb      = undef;        # verbose mode
+-my $o_version   = undef;        # print version
+-my $o_noreg     = undef;        # Do not use Regexp for name
+-my $o_timeout   = 5;            # Default 5s Timeout
++my $o_host        = undef;        # hostname
++my $o_community   = undef;        # community
++my $o_port        = 161;          # port
++my $o_version2    = undef;        # use snmp v2c
++my $o_descr       = undef;        # description filter
++my @o_descrL      = undef;        # Service descriprion list.
++my $o_showall     = undef;        # Show all services even if OK
++my $o_type        = "service";    # Check type (service, ...)
++my $o_number      = undef;        # Number of service for warn and crit levels
++my $o_help        = undef;        # wan't some help ?
++my $o_verb        = undef;        # verbose mode
++my $o_version     = undef;        # print version
++my $o_noreg       = undef;        # Do not use Regexp for name
++my $o_timeout     = 5;            # Default 5s Timeout
++my $o_octetlength = undef;        # SNMP max message size
+ 
+ # SNMP V3 specific
+-my $o_login  = undef;           # snmp v3 login
+-my $o_passwd = undef;           # snmp v3 passwd
++my $o_login  = undef;             # snmp v3 login
++my $o_passwd = undef;             # snmp v3 passwd
+ 
+ # functions
+ 
+@@ -72,7 +73,7 @@
+ 
+ sub print_usage {
+     print
+-"Usage: $Name [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) [-p <port>] -n <name>[,<name2] [-T=service] [-r] [-s] [-N=<n>] [-t <timeout>] [-V]\n";
++"Usage: $Name [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) [-p <port>] -n <name>[,<name2] [-T=service] [-r] [-s] [-N=<n>] [-t <timeout>] [-o <octet_length>] [-V]\n";
+ }
+ 
+ sub isnotnum {                  # Return true if arg is not a number
+@@ -128,6 +129,8 @@ sub help {
+    Do not use regexp to match NAME in service description.
+ -t, --timeout=INTEGER
+    timeout for SNMP in seconds (Default: 5)
++-o, --octetlength=INTEGER
++   SNMP max message size (484-65535)
+ -V, --version
+    prints version number
+ Note :   
+@@ -162,36 +165,38 @@ sub decode_utf8 {    # just replaces UFT8 caracters by "."
+ sub check_options {
+     Getopt::Long::Configure("bundling");
+     GetOptions(
+-        'v'           => \$o_verb,
+-        'verbose'     => \$o_verb,
+-        'h'           => \$o_help,
+-        'help'        => \$o_help,
+-        'H:s'         => \$o_host,
+-        'hostname:s'  => \$o_host,
+-        'p:i'         => \$o_port,
+-        'port:i'      => \$o_port,
+-        'C:s'         => \$o_community,
+-        'community:s' => \$o_community,
+-        'l:s'         => \$o_login,
+-        'login:s'     => \$o_login,
+-        'x:s'         => \$o_passwd,
+-        'passwd:s'    => \$o_passwd,
+-        't:i'         => \$o_timeout,
+-        'timeout:i'   => \$o_timeout,
+-        'n:s'         => \$o_descr,
+-        'name:s'      => \$o_descr,
+-        'r'           => \$o_noreg,
+-        'noregexp'    => \$o_noreg,
+-        'T:s'         => \$o_type,
+-        'type:s'      => \$o_type,
+-        'N:i'         => \$o_number,
+-        'number:i'    => \$o_number,
+-        '2'           => \$o_version2,
+-        'v2c'         => \$o_version2,
+-        's'           => \$o_showall,
+-        'showall'     => \$o_showall,
+-        'V'           => \$o_version,
+-        'version'     => \$o_version
++        'v'             => \$o_verb,
++        'verbose'       => \$o_verb,
++        'h'             => \$o_help,
++        'help'          => \$o_help,
++        'H:s'           => \$o_host,
++        'hostname:s'    => \$o_host,
++        'p:i'           => \$o_port,
++        'port:i'        => \$o_port,
++        'C:s'           => \$o_community,
++        'community:s'   => \$o_community,
++        'l:s'           => \$o_login,
++        'login:s'       => \$o_login,
++        'x:s'           => \$o_passwd,
++        'passwd:s'      => \$o_passwd,
++        't:i'           => \$o_timeout,
++        'timeout:i'     => \$o_timeout,
++        'n:s'           => \$o_descr,
++        'name:s'        => \$o_descr,
++        'r'             => \$o_noreg,
++        'noregexp'      => \$o_noreg,
++        'T:s'           => \$o_type,
++        'type:s'        => \$o_type,
++        'N:i'           => \$o_number,
++        'number:i'      => \$o_number,
++        '2'             => \$o_version2,
++        'v2c'           => \$o_version2,
++        'o:i'           => \$o_octetlength,
++        'octetlength:i' => \$o_octetlength,
++        's'             => \$o_showall,
++        'showall'       => \$o_showall,
++        'V'             => \$o_version,
++        'version'       => \$o_version
+     );
+     if (defined($o_help))    { help();      exit $ERRORS{"UNKNOWN"} }
+     if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} }
+@@ -222,6 +227,13 @@ sub check_options {
+         }
+     }
+ 
++    # Octet length check
++    if (defined($o_octetlength) && (isnotnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484)) {
++        print "octet length must be in range 484 .. 65535\n";
++        print_usage();
++        exit $ERRORS{'UNKNOWN'};
++    }
++
+ }
+ 
+ ########## MAIN #######
+@@ -283,8 +295,19 @@ sub check_options {
+     exit $ERRORS{"UNKNOWN"};
+ }
+ 
+-$session->max_msg_size(5000);
+-verb($session->max_msg_size);
++if (defined($o_octetlength)) {
++    my $oct_resultat = undef;
++    my $oct_test     = $session->max_msg_size();
++    verb(" actual max octets:: $oct_test");
++    $oct_resultat = $session->max_msg_size($o_octetlength);
++    if (!defined($oct_resultat)) {
++        printf("ERROR: Session settings : %s.\n", $session->error);
++        $session->close;
++        exit $ERRORS{"UNKNOWN"};
++    }
++    $oct_test = $session->max_msg_size();
++    verb(" new max octets:: $oct_test");
++}
+ 
+ # Look for process in name or path name table
+ my $resultat = undef;


=====================================
debian/patches/17_check_snmp_storage_okifempty
=====================================
@@ -0,0 +1,61 @@
+From fd5ae19315a26530159f8ab221a190ac52de3195 Mon Sep 17 00:00:00 2001
+From: roa <roa at eurotux.com>
+Date: Mon, 9 Mar 2020 11:56:04 +0000
+Subject: [PATCH] check_snmp_storage.pl: add support for allowing considering
+ OK if no storage found matching given criteria
+
+---
+ plugins/check_snmp_storage.pl | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl
+index 3593f79..887800a 100755
+--- a/plugins/check_snmp_storage.pl
++++ b/plugins/check_snmp_storage.pl
+@@ -73,6 +73,7 @@
+ my $o_sum         = undef;                       # add all storage before testing
+ my $o_index       = undef;                       # Parse index instead of description
+ my $o_negate      = undef;                       # Negate the regexp if set
++my $o_okifempty   = undef;                       # Consider OK if no disks found
+ my $o_timeout     = 5;                           # Default 5s Timeout
+ my $o_perf        = undef;                       # Output performance data
+ my $o_short       = undef;                       # Short output parameters
+@@ -98,7 +99,7 @@
+ 
+ sub print_usage {
+     print
+-"Usage: $Name [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] [-P <protocol>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,<car>]] [-o <octet_length>] [-R <% reserved>]\n";
++"Usage: $Name [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] [-P <protocol>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-O] [-S 0|1[,1,<car>]] [-o <octet_length>] [-R <% reserved>]\n";
+ }
+ 
+ sub round ($$) {
+@@ -180,6 +181,8 @@ sub help {
+ -e, --exclude
+    Select all storages except the one(s) selected by -m
+    No action on storage type selection
++-O, --okifempty
++   Consider OK instead of UNKNOWN if no storage found with given criteria
+ -T, --type=TYPE
+    pl : calculate percent left
+    pu : calculate percent used (Default)
+@@ -279,6 +282,8 @@ sub check_options {
+         'index'         => \$o_index,
+         'e'             => \$o_negate,
+         'exclude'       => \$o_negate,
++        'O'             => \$o_okifempty,
++        'okifempty'     => \$o_okifempty,
+         'V'             => \$o_version,
+         'version'       => \$o_version,
+         'q:s'           => \$o_storagetype,
+@@ -590,7 +595,10 @@ sub check_options {
+     }
+ }
+ verb("storages selected : $num_int");
+-if ($num_int == 0) { print "Unknown storage : $o_descr : ERROR\n"; exit $ERRORS{"UNKNOWN"}; }
++if ($num_int == 0) {
++    if ($o_okifempty) { print "No storage found matching given criteria, but future new disks will be monitored\n"; exit $ERRORS{"OK"}; }
++    else { print "Unknown storage : $o_descr : ERROR\n"; exit $ERRORS{"UNKNOWN"}; }
++}
+ 
+ my $result = undef;
+ 


=====================================
debian/patches/18_check_snmp_int_fix_perf_out
=====================================
@@ -0,0 +1,41 @@
+From effd196f76c4f4e9505b0955b020f8f65f1700a2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pawe=C5=82=20Szafer?= <pszafer at gmail.com>
+Date: Mon, 16 Mar 2020 18:41:49 +0100
+Subject: [PATCH] fix perf_out not defined error
+
+---
+ plugins/check_snmp_int.pl | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/plugins/check_snmp_int.pl
++++ b/plugins/check_snmp_int.pl
+@@ -1053,24 +1053,25 @@
+ 
+ # Check if all interface are OK
+ if ($num_ok == $num_int) {
++    my $is_perf_defined = defined($perf_out) && defined($o_perf);
+     if ($final_status == 0) {
+         print $print_out, ":", $num_ok, " UP: OK";
+-        if (defined($o_perf)) { print " | ", $perf_out; }
++        if ($is_perf_defined) { print " | ", $perf_out; }
+         print "\n";
+         exit $ERRORS{"OK"};
+     } elsif ($final_status == 1) {
+         print $print_out, ":(", $num_ok, " UP): WARNING";
+-        if (defined($o_perf)) { print " | ", $perf_out; }
++        if ($is_perf_defined) { print " | ", $perf_out; }
+         print "\n";
+         exit $ERRORS{"WARNING"};
+     } elsif ($final_status == 2) {
+         print $print_out, ":(", $num_ok, " UP): CRITICAL";
+-        if (defined($o_perf)) { print " | ", $perf_out; }
++        if ($is_perf_defined) { print " | ", $perf_out; }
+         print "\n";
+         exit $ERRORS{"CRITICAL"};
+     } else {
+         print $print_out, ":(", $num_ok, " UP): UNKNOWN";
+-        if (defined($perf_out)) { print " | ", $perf_out; }
++        if ($is_perf_defined) { print " | ", $perf_out; }
+         print "\n";
+         exit $ERRORS{"UNKNOWN"};
+     }


=====================================
debian/patches/series
=====================================
@@ -2,5 +2,10 @@
 11_check_snmp_int_agent_workaround
 12_check_snmp_mem_perf
 13_check_snmp_process_new_features
+14_check_snmp_int_ign
+15_check_snmp_int_spaces
+16_check_snmp_win_max_message_size
+17_check_snmp_storage_okifempty
+18_check_snmp_int_fix_perf_out
 50_disable_epn
 51_fix_privacy_doc



View it on GitLab: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins/-/compare/c1f1d2574f69ad550480c7d1fc6f10adcfaed47b...5579d164c7cc51c5b00db307b78086973eefd2fc

-- 
View it on GitLab: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins/-/compare/c1f1d2574f69ad550480c7d1fc6f10adcfaed47b...5579d164c7cc51c5b00db307b78086973eefd2fc
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nagios-changes/attachments/20201207/baa3d85c/attachment-0001.html>


More information about the pkg-nagios-changes mailing list