Forum Discussion
Notifying Nagios that a Node is down/disabled
I wrote a simple perl script for Nagios/Icinga a while ago where you can specify the hostname of the appliance and the pool name you want to monitor. It simply gives you the status of the pool and the number of active nodes.
Usage: check_ltm_pool.pl LTMHOSTNAME POOLNAME
Example output: "OK - Pool: EXAMPLE-POOL / Status: available / Members active: 2 out of 2"
or
"WARNING: Pool EXAMPLE-POOL / Status: available /Members active 1 out of 3"
The script is very quick and dirty written. But maybe you can use it as a start for your own check:
!/usr/bin/perl
Nagios-Check to monitor Big IP 11 Pool and Member availability.
Timo Schlueter (26.04.2012)
Mail: timo@timo.in
use Switch;
my $snmpwalkPath = "/usr/bin/snmpwalk";
my $snmpCommunity = "public";
my $hostname = $ARGV[0];
my $pool_name = $ARGV[1];
my $outputString = "Pool: " . $pool_name . " / ";
my $activeMemberCountOid = "1.3.6.1.4.1.3375.2.2.5.1.2.1.8";
my $availableMemberCountOid = "1.3.6.1.4.1.3375.2.2.5.1.2.1.23";
my $poolAvailabilityCountOid = "1.3.6.1.4.1.3375.2.2.5.5.2.1.2";
my $critCount = 0;
my $warnCount = 0;
my $unknwonCount = 0;
if ($ARGV[0] eq "" || $ARGV[1] eq "") {
print "UNKNOWN - Missing parameters.";
exit 1;
}
$pool_availability = snmpwalkCmd($poolAvailabilityCountOid);
$members_available = snmpwalkCmd($availableMemberCountOid);
$members_active = snmpwalkCmd($activeMemberCountOid);
if ($pool_availability eq "" || $members_available eq "" || $members_active eq "") {
print "UNKNOWN - Invalid pool or snmp problem.";
exit 1;
}
sub snmpwalkCmd {
$pool_oid = $pool_name;
$pool_oid =~ s/(.)/sprintf('.%u', ord($1))/eg;
$output = `$snmpwalkPath -v2c -c $snmpCommunity -m '' -On -Oe $hostname $_[0] | grep $pool_oid`;
@array = split(' ', $output);
@array[$array];
}
switch($pool_availability) {
case 0 {
$outputString .= "Status: not availabie";
$critCount++;
break;
}
case 1 {
$outputString .= "Status: available";
break;
}
else {
$outputString .= "Status: unknown";
$unknownCount++;
break;
}
}
$outputString .= " / ";
if ($members_active == 0) {
$outputString .= "Members active: 0 out of $members_available";
$critCount++;
} else {
if ($members_active < $members_available) {
$outputString .= "Members active: $members_active out of $members_available";
$warnCount++;
} else {
$outputString .= "Members active: $members_active out of $members_available";
}
}
if ($critCount > 0) {
print "CRITICAL - " . $outputString;
exit 2;
}
if ($warnCount > 0) {
print "WARNING - " . $outputString;
exit 1;
}
if ($unknownCount > 0) {
print "UNKNOWN - " . $outputString;
exit 3;
}
print "OK - " . $outputString;
exit 0;
Regards, Timo
- Leon_Johnson_11Oct 01, 2013
Nimbostratus
Great work Timo! You should put this up on http://exchange.nagios.org/ or github. This is the first v11 pool check that I've come across. - Timo_Schlueter_Oct 01, 2013
Nimbostratus
Thank you Leon. I will clean up the code here and there and will put it up on Nagios Exchange. Good idea! - Timo_Schlueter_Oct 08, 2013
Nimbostratus
I did a rewrite of the script above and just uploaded it to Nagios Exchange. I have used it in our productive environment for 5 days now on Big IP version 11.1 without any problems. You can find it here: http://exchange.nagios.org/directory/Plugins/Hardware/Network-Gear/F5/Big-2DIP-Pool-Status-Check/details Some feedback would be great! :)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
