Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Check the percent of session used on a Netscreen/Juniper firewall through SNMP.
Current Version
Last Release Date
June 23, 2009
Owner
Nagios Exchange
Perlscript
check_netscreen_session plugin for Nagios monitors the number of sessions for a Netscreen/Juniper host
Usage: -H (--hostname) Hostname to query - (required) -C (--community) SNMP read community (defaults to public, used with SNMP v1 and v2c) -v (--snmp_version) 1 for SNMP v1 (default)
2 for SNMP v2c
-p (--port) SNMP port (default 161) -V (--version) Plugin version -h (--help) usage help
Plugin is in perl Requirements: Net-SNMP, perl Net::SNMP module Your firewalls must have SNMP enabled, your monitoring host must be authorized on the firewall.
I found I had to add a 'space' in the perfdata print statement in order for pnp4nagios to process the perfdata correctly -$perfdata = sprintf("| SessActive=%s,SessMax=%s,SessFail=%sn", +$perfdata = sprintf("| SessActive=%s, SessMax=%s, SessFail=%sn", Thanks
--- 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=%sn", + $response->{$snmpnsResSessActive}, + $response->{$snmpnsResSessMaximum}, + $response->{$snmpnsResSessFailed} + ); + $session->close; @@ -160,7 +170,7 @@ } } -print ("$state: $answer"); +print ("$state: $answer $perfdatan"); exit $ERRORS{$state};
Plugin works fine. The diff works well too. (Juniper SSG).
Works fine. I have used on a Nagios Core running on Ubuntu, and on Nagios XI running on centos. I made the following change for Nagios XI to automatically create graphs: 143c143 $answer = sprintf("host '%s', sessions : %s/%s (%2.2f%%)|Current=%s;Maximum=%sn", 147c147,149 $session_used, > $response->{$snmpnsResSessActive}, > $response->{$snmpnsResSessMaximum}
You must be logged in to submit a review.
To:
From:
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!