Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
john_lines
byjohn_lines, July 10, 2014
1 of 1 people found this review helpful
--- check_netscreen_session.orig 2014-07-10 11:30:07.546043211 +0100
+++ check_netscreen_session 2014-07-10 11:48:46.120006720 +0100
@@ -25,6 +25,7 @@
#
# This plugin is based on existing work from warrious users.
# No liability
+# John Lines modifications to report number of session errors and return performance information
use POSIX;
use strict;
@@ -42,12 +43,14 @@
my $state = "UNKNOWN";
my $answer = "";
+my $perfdata = "";
my $snmpkey = 0;
my $community = "public";
my $port = 161;
my @snmpoids;
my $snmpnsResSessActive = '.1.3.6.1.4.1.3224.16.3.2.0';
my $snmpnsResSessMaximum = '.1.3.6.1.4.1.3224.16.3.3.0';
+my $snmpnsResSessFailed = '.1.3.6.1.4.1.3224.16.3.4.0';
my $hostname;
my $session;
my $error;
@@ -87,7 +90,7 @@
}
if ($opt_V) {
- print_revision($PROGNAME,'$Revision: 1.1 $ ');
+ print_revision($PROGNAME,'$Revision: 1.2 $ ');
exit $ERRORS{'OK'};
}
@@ -130,6 +133,7 @@
push(@snmpoids,$snmpnsResSessActive);
push(@snmpoids,$snmpnsResSessMaximum);
+push(@snmpoids,$snmpnsResSessFailed);
if (!defined($response = $session->get_request(@snmpoids))) {
$answer=$session->error;
@@ -140,12 +144,18 @@
}
if($snmpnsResSessMaximum ne 0) {$session_used = 100*($response->{$snmpnsResSessActive}/$response->{$snmpnsResSessMaximum});}
- $answer = sprintf("host '%s', sessions : %s/%s (%2.2f%%)\n",
+ $answer = sprintf("host '%s', sessions : %s/%s (%2.2f%%)",
$hostname,
$response->{$snmpnsResSessActive},
$response->{$snmpnsResSessMaximum},
$session_used
);
+ $perfdata = sprintf("| SessActive=%s,SessMax=%s,SessFail=%s\n",
+ $response->{$snmpnsResSessActive},
+ $response->{$snmpnsResSessMaximum},
+ $response->{$snmpnsResSessFailed}
+ );
+
$session->close;
@@ -160,7 +170,7 @@
}
}
-print ("$state: $answer");
+print ("$state: $answer $perfdata\n");
exit $ERRORS{$state};
+++ check_netscreen_session 2014-07-10 11:48:46.120006720 +0100
@@ -25,6 +25,7 @@
#
# This plugin is based on existing work from warrious users.
# No liability
+# John Lines modifications to report number of session errors and return performance information
use POSIX;
use strict;
@@ -42,12 +43,14 @@
my $state = "UNKNOWN";
my $answer = "";
+my $perfdata = "";
my $snmpkey = 0;
my $community = "public";
my $port = 161;
my @snmpoids;
my $snmpnsResSessActive = '.1.3.6.1.4.1.3224.16.3.2.0';
my $snmpnsResSessMaximum = '.1.3.6.1.4.1.3224.16.3.3.0';
+my $snmpnsResSessFailed = '.1.3.6.1.4.1.3224.16.3.4.0';
my $hostname;
my $session;
my $error;
@@ -87,7 +90,7 @@
}
if ($opt_V) {
- print_revision($PROGNAME,'$Revision: 1.1 $ ');
+ print_revision($PROGNAME,'$Revision: 1.2 $ ');
exit $ERRORS{'OK'};
}
@@ -130,6 +133,7 @@
push(@snmpoids,$snmpnsResSessActive);
push(@snmpoids,$snmpnsResSessMaximum);
+push(@snmpoids,$snmpnsResSessFailed);
if (!defined($response = $session->get_request(@snmpoids))) {
$answer=$session->error;
@@ -140,12 +144,18 @@
}
if($snmpnsResSessMaximum ne 0) {$session_used = 100*($response->{$snmpnsResSessActive}/$response->{$snmpnsResSessMaximum});}
- $answer = sprintf("host '%s', sessions : %s/%s (%2.2f%%)\n",
+ $answer = sprintf("host '%s', sessions : %s/%s (%2.2f%%)",
$hostname,
$response->{$snmpnsResSessActive},
$response->{$snmpnsResSessMaximum},
$session_used
);
+ $perfdata = sprintf("| SessActive=%s,SessMax=%s,SessFail=%s\n",
+ $response->{$snmpnsResSessActive},
+ $response->{$snmpnsResSessMaximum},
+ $response->{$snmpnsResSessFailed}
+ );
+
$session->close;
@@ -160,7 +170,7 @@
}
}
-print ("$state: $answer");
+print ("$state: $answer $perfdata\n");
exit $ERRORS{$state};
byjohn_lines, February 11, 2014
In my systems which run Debian Wheezy I needed to remove the
at the end of the datasend lines i.e.
$smtp->datasend("To: $mailto");
$smtp->datasend("From: $mailfrom");
$smtp->datasend("Subject: $mailsubject");
$smtp->datasend("
");
so that the headers acually are taken as headers.
I also set the subject as:
# $mailsubject = "Nagios Monitoring Alert: $opt_h is $opt_s";
$mailsubject = "$opt_n: $opt_h $opt_D is $opt_s";
which maximises the information in a view of mail messages with just headers, to prioritise dealing with alerts
at the end of the datasend lines i.e.
$smtp->datasend("To: $mailto");
$smtp->datasend("From: $mailfrom");
$smtp->datasend("Subject: $mailsubject");
$smtp->datasend("
");
so that the headers acually are taken as headers.
I also set the subject as:
# $mailsubject = "Nagios Monitoring Alert: $opt_h is $opt_s";
$mailsubject = "$opt_n: $opt_h $opt_D is $opt_s";
which maximises the information in a view of mail messages with just headers, to prioritise dealing with alerts