For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Timo_Schlueter_'s avatar
Timo_Schlueter_
Icon for Nimbostratus rankNimbostratus
Mar 08, 2010

Notifying Nagios that a Node is down/disabled

Hi everyone,

 

 

i'm using Big IP 9.4.5 Build 1049.10 Final and need a advice.

 

In my environment I use Nagios for monitoring every server and service.

 

 

Now, i started using Big IP for balancing LDAP-requests.

 

What I need now is, that Big IP sends a notification/snmp-trap to my Nagios-Server whenever a node is marked as "disabled" or "down" depending on my LDAP-Health-Monitor.

 

 

Is there a simple way to do this?

 

My first thought was to create a nagios-check that checks the Big IP logfiles for some keywords using ssh but I dont really like this solution.

 

 

Has anyone an idea how to configure Big IP for sending out SNMP-Traps to Nagios?

 

 

I'm new to Big IP and i appreciate every advice.

 

 

Thank you.

 

 

Bye,

 

Timo

16 Replies

  • 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_11's avatar
      Leon_Johnson_11
      Icon for Nimbostratus rankNimbostratus
      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_'s avatar
      Timo_Schlueter_
      Icon for Nimbostratus rankNimbostratus
      Thank you Leon. I will clean up the code here and there and will put it up on Nagios Exchange. Good idea!
    • Timo_Schlueter_'s avatar
      Timo_Schlueter_
      Icon for Nimbostratus rankNimbostratus
      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! :)
  • Finally, I've made my own script to check this. It's on github, and I hope it's simple to use.

     

    check_bigip_node_status.sh

     

    I had a problem with F5mibs. I had to copy them on /usr/share/snmp/mibs/

     

    Once I had them, snmpwalk returned human readable lines.

     

    This are sn mibs I have on my system for f5 checks:

     

    /usr/share/snmp/mibs/F5-BIGIP-APM-MIB.txt

     

    /usr/share/snmp/mibs/F5-BIGIP-LOCAL-MIB.txt

     

    /usr/share/snmp/mibs/F5-EM-MIB.txt /usr/share/snmp/mibs/F5-BIGIP-COMMON-MIB.txt

     

    /usr/share/snmp/mibs/F5-BIGIP-SYSTEM-MIB.txt /usr/share/snmp/mibs/F5-BIGIP-GLOBAL-MIB.txt

     

    /usr/share/snmp/mibs/F5-BIGIP-WAM-MIB.txt

     

    Feel free to improve the check script!