From 93834c1fa1adf60161163a366a22e95202a6425f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 23:42:03 +0100 Subject: [PATCH] Add 17_protocol_fam to support protocol and IP familiy --- debian/patches/17_protocol_fam | 385 +++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 386 insertions(+) create mode 100644 debian/patches/17_protocol_fam diff --git a/debian/patches/17_protocol_fam b/debian/patches/17_protocol_fam new file mode 100644 index 0000000..e38e4b6 --- /dev/null +++ b/debian/patches/17_protocol_fam @@ -0,0 +1,385 @@ +## 17_protocol_fam by Alice Kærast +## +## DP: Add protocol and IPv[46] + +## From 5369da5d2b3e4351e04f016619736f7d03cbcdfd Mon Sep 17 00:00:00 2001 +## From: Michael Friedrich +## Date: Fri, 5 Jul 2013 21:32:45 +0200 +## Subject: [PATCH] add -P|--protocol= setting tcp/udp and IPv4/IPv6 for +## load/mem/process/storage +## MIME-Version: 1.0 +## Content-Type: text/plain; charset=UTF-8 +## Content-Transfer-Encoding: 8bit +## +## reworked the patches from +## https://sourceforge.net/p/nagios-snmp/feature-requests/27/ +## to make them fit the current patch level, and keep the same output the +## most. +## +## full kudos to Alice Kærast. +--- + check_snmp_load.pl | 26 ++++++++++++++++++++------ + check_snmp_mem.pl | 24 ++++++++++++++++++------ + check_snmp_process.pl | 28 ++++++++++++++++++++-------- + check_snmp_storage.pl | 22 +++++++++++++++++----- + 4 files changed, 75 insertions(+), 25 deletions(-) + +diff --git a/check_snmp_load.pl b/plugins/check_snmp_load.pl +index 71487ec..a1ccc7c 100755 +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl +@@ -95,6 +95,7 @@ + my $o_host = undef; # hostname + my $o_community = undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # protocol + my $o_help= undef; # wan't some help ? + my $o_verb= undef; # verbose mode + my $o_version= undef; # print version +@@ -121,7 +122,7 @@ + sub p_version { print "check_snmp_load version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -153,8 +154,16 @@ sub help { + -L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +--P, --port=PORT ++-p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 ++ ++ Network protocol (Default udp/ipv4) + -w, --warn=INTEGER | INT,INT,INT + 1 value check : warning level for cpu in percent (on one minute) + 3 value check : comma separated level for load or cpu for 1min, 5min, 15min +@@ -197,6 +206,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + 'l:s' => \$o_login, 'login:s' => \$o_login, + 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, +@@ -297,7 +307,8 @@ sub check_options { + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); +@@ -309,7 +320,8 @@ sub check_options { + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } else { +@@ -321,7 +333,8 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + # SNMPV1 login +@@ -330,7 +343,8 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } +diff --git a/check_snmp_mem.pl b/plugins/check_snmp_mem.pl +index 631a39b..6f5425e 100644 +--- a/check_snmp_mem.pl ++++ b/check_snmp_mem.pl +@@ -63,6 +63,7 @@ + my $o_host = undef; # hostname + my $o_community = undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 + my $o_help= undef; # wan't some help ? + my $o_verb= undef; # verbose mode + my $o_version= undef; # print version +@@ -93,7 +94,7 @@ + sub p_version { print "check_snmp_mem version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -129,8 +130,14 @@ sub help { + -L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +--P, --port=PORT ++-p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 + -w, --warn=INTEGER | INT,INT + warning level for memory in percent (0 for no checks) + Default (-N switch) : comma separated level for Real Memory and Swap +@@ -174,6 +181,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + 'l:s' => \$o_login, 'login:s' => \$o_login, + 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, +@@ -270,7 +278,8 @@ sub check_options { + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); +@@ -283,7 +292,8 @@ sub check_options { + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } else { +@@ -295,7 +305,8 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + # SNMPV1 login +@@ -304,7 +315,8 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } +diff --git a/check_snmp_process.pl b/plugins/check_snmp_process.pl +index 9494c7c..7a83432 100755 +--- a/check_snmp_process.pl ++++ b/check_snmp_process.pl +@@ -42,6 +42,7 @@ + my $o_host = undef; # hostname + my $o_community =undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 + my $o_version2 = undef; #use snmp v2c + my $o_descr = undef; # description filter + my $o_warn = 0; # warning limit +@@ -80,7 +81,7 @@ + sub p_version { print "check_snmp_process version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] [-P ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; + } + + sub isnotnum { # Return true if arg is not a number +@@ -166,6 +167,12 @@ sub help { + : Priv protocole (des|aes : default des) + -p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 + -n, --name=NAME + Name of the process (regexp) + No trailing slash ! +@@ -233,6 +240,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + 'l:s' => \$o_login, 'login:s' => \$o_login, + 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, +@@ -240,20 +248,20 @@ sub check_options { + 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, + 'c:s' => \$o_crit, 'critical:s' => \$o_crit, + 'w:s' => \$o_warn, 'warn:s' => \$o_warn, +- 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, ++ 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, + 'n:s' => \$o_descr, 'name:s' => \$o_descr, + 'r' => \$o_noreg, 'noregexp' => \$o_noreg, + 'f' => \$o_path, 'fullpath' => \$o_path, + 'm:s' => \$o_mem, 'memory:s' => \$o_mem, + 'a' => \$o_mem_avg, 'average' => \$o_mem_avg, + 'u:s' => \$o_cpu, 'cpu' => \$o_cpu, +- '2' => \$o_version2, 'v2c' => \$o_version2, +- 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, +- 'g' => \$o_get_all, 'getall' => \$o_get_all, +- 'A' => \$o_param, 'param' => \$o_param, +- 'F' => \$o_perf, 'perfout' => \$o_perf, ++ '2' => \$o_version2, 'v2c' => \$o_version2, ++ 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, ++ 'g' => \$o_get_all, 'getall' => \$o_get_all, ++ 'A' => \$o_param, 'param' => \$o_param, ++ 'F' => \$o_perf, 'perfout' => \$o_perf, + 'd:i' => \$o_delta, 'delta:i' => \$o_delta, +- 'V' => \$o_version, 'version' => \$o_version ++ 'V' => \$o_version, 'version' => \$o_version + ); + if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; +@@ -343,6 +351,7 @@ sub check_options { + -hostname => $o_host, + -version => '3', + -port => $o_port, ++ -domain => $o_domain, + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, +@@ -355,6 +364,7 @@ sub check_options { + -version => '3', + -username => $o_login, + -port => $o_port, ++ -domain => $o_domain, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, +@@ -370,6 +380,7 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, ++ -domain => $o_domain, + -timeout => $o_timeout + ); + } else { +@@ -378,6 +389,7 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, ++ -domain => $o_domain, + -timeout => $o_timeout + ); + } +diff --git a/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +index 31a4015..9725dce 100644 +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl +@@ -62,6 +62,7 @@ + my $o_host = undef; # hostname + my $o_community = undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 + my $o_version2 = undef; #use snmp v2c + my $o_descr = undef; # description filter + my $o_storagetype = undef; # parse storage type also +@@ -98,7 +99,7 @@ + sub p_version { print "$Name version : $Version\n"; } + + sub print_usage { +- print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; ++ print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; + } + + sub round ($$) { +@@ -154,6 +155,12 @@ sub help { + Password for snmpv3 authentication + -p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 + -m, --name=NAME + Name in description OID (can be mounpoints '/home' or 'Swap Space'...) + This is treated as a regexp : -m /var will match /var , /var/log, /opt/var ... +@@ -236,6 +243,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + '2' => \$o_version2, 'v2c' => \$o_version2, + 'l:s' => \$o_login, 'login:s' => \$o_login, +@@ -352,7 +360,8 @@ sub check_options { + -authprotocol => $o_authproto, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); +@@ -366,7 +375,8 @@ sub check_options { + -privprotocol => $o_privproto, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } else { +@@ -379,7 +389,8 @@ sub check_options { + -community => $o_community, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + # SNMPV1 login +@@ -389,7 +400,8 @@ sub check_options { + -community => $o_community, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } +-- +1.8.5.5 + diff --git a/debian/patches/series b/debian/patches/series index e00134b..6ce56d5 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,5 +2,6 @@ 10_fix_net_snmp_version 15_check_snmp_storage_64bit 16_perfdata +17_protocol_fam 50_disable_epn 51_fix_privacy_doc