Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
basdoorn
bybasdoorn, January 17, 2015
Works great with debian 7.7. I needed IPv6 support so created a patch to add support for it using the -6 or --use-ipv6 parameters, attached below. If it is up to standards, please include it in future versions as more and more systems are using IPv6 (only).
--- check_uptime.pl 2015-01-17 18:30:29.885907443 +0100
+++ check_uptime_w_ipv6.pl 2015-01-17 18:19:23.209912963 +0100
@@ -213,6 +213,7 @@
my $o_warn= undef; # WARNING alert if system has been up for \$o_host,
'p:i' => \$o_port, 'port:i' => \$o_port,
'C:s' => \$o_community, 'community:s' => \$o_community,
- '2' => \$o_version2, 'v2c' => \$o_version2,
+ '2' => \$o_version2, 'v2c' => \$o_version2,
'l:s' => \$o_login, 'login:s' => \$o_login,
'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd,
'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass,
@@ -376,6 +379,7 @@
'label:s' => \$o_label,
'P:s' => \$o_prevperf, 'prev_perfdata:s' => \$o_prevperf,
'T:s' => \$o_type, 'type:s' => \$o_type,
+ '6' => \$o_domain, 'use-ipv6' => \$o_domain,
);
if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}};
if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}};
@@ -445,11 +449,19 @@
sub create_snmp_session {
my ($session,$error);
+ # Check IPv6
+ if (defined ($o_domain)) {
+ $o_domain="udp/ipv6";
+ } else {
+ $o_domain="udp/ipv4";
+ }
+
if ( defined($o_login) && defined($o_passwd)) {
# SNMPv3 login
if (!defined ($o_privpass)) {
verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-version => '3',
-port => $o_port,
@@ -461,6 +473,7 @@
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-version => '3',
-username => $o_login,
@@ -477,6 +490,7 @@
# SNMPv2c Login
verb("SNMP v2c login");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-version => 2,
-community => $o_community,
@@ -487,6 +501,7 @@
# SNMPV1 login
verb("SNMP v1 login");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
--- check_uptime.pl 2015-01-17 18:30:29.885907443 +0100
+++ check_uptime_w_ipv6.pl 2015-01-17 18:19:23.209912963 +0100
@@ -213,6 +213,7 @@
my $o_warn= undef; # WARNING alert if system has been up for \$o_host,
'p:i' => \$o_port, 'port:i' => \$o_port,
'C:s' => \$o_community, 'community:s' => \$o_community,
- '2' => \$o_version2, 'v2c' => \$o_version2,
+ '2' => \$o_version2, 'v2c' => \$o_version2,
'l:s' => \$o_login, 'login:s' => \$o_login,
'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd,
'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass,
@@ -376,6 +379,7 @@
'label:s' => \$o_label,
'P:s' => \$o_prevperf, 'prev_perfdata:s' => \$o_prevperf,
'T:s' => \$o_type, 'type:s' => \$o_type,
+ '6' => \$o_domain, 'use-ipv6' => \$o_domain,
);
if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}};
if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}};
@@ -445,11 +449,19 @@
sub create_snmp_session {
my ($session,$error);
+ # Check IPv6
+ if (defined ($o_domain)) {
+ $o_domain="udp/ipv6";
+ } else {
+ $o_domain="udp/ipv4";
+ }
+
if ( defined($o_login) && defined($o_passwd)) {
# SNMPv3 login
if (!defined ($o_privpass)) {
verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-version => '3',
-port => $o_port,
@@ -461,6 +473,7 @@
} else {
verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-version => '3',
-username => $o_login,
@@ -477,6 +490,7 @@
# SNMPv2c Login
verb("SNMP v2c login");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-version => 2,
-community => $o_community,
@@ -487,6 +501,7 @@
# SNMPV1 login
verb("SNMP v1 login");
($session, $error) = Net::SNMP->session(
+ -domain => $o_domain,
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
The plugin did not process the status for me correctly as it was always selecting the SCSI/MEGARAID line_str to match on due to a comparison error. Line 110 is as follows in the download:
if ($interface eq 'megaraid'.",".$number or 'scsi'){
Replace this line by the following 2 lines below:
if (!defined($number)) { $number = 0; }
if ($interface eq 'megaraid'.",".$number or $interface eq 'scsi'){
Aside from this the plugin works brilliant!
if ($interface eq 'megaraid'.",".$number or 'scsi'){
Replace this line by the following 2 lines below:
if (!defined($number)) { $number = 0; }
if ($interface eq 'megaraid'.",".$number or $interface eq 'scsi'){
Aside from this the plugin works brilliant!