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

Rick99_137765's avatar
Rick99_137765
Icon for Nimbostratus rankNimbostratus
Jul 02, 2014

Need to monitor pool members to see if they are out of the farm

I don't want to re-invent the wheel if someone has already done this, so I'll ask...

 

I need to monitor individual members of a pool to see when / if they come out of the pool - either on their own because the host is having issues, or if someone has taken them out of the pool to do maintenance. (e.g. check the pool and see if any of the members have been taken out of the farm - if so, how many?)

 

I've found some examples that sort of (but not really) come close. Does anyone have anything like this?

 

4 Replies

  • I take it this is not for a typical pool-based health monitor thing, but more for reporting?
  • Hi Kevin, You're right, it really is more for reporting and not for pool-based health monitors. I'm trying to be able to pump this sort of into some sort of monitoring - either Cacti, Nagios or something similar.
  • There's really several ways to do this:

    1. user_alert.conf script and/or iCall to capture, in real time, when nodes go up and down. From there you run a script that sends an alert, syslog message, email, SNMP trap, whatever, per event.

    2. Run a script that periodically checks all of the pool members for their state (up or down) and session (monitor-enabled or user-disabled). The following is a shell of what that could look like:

      !/bin/bash
      
       define pool name
      pool="local-pool";
      
      arr=($(tmsh list ltm pool local-pool |perl -ne 'if (m/([a-zA-Z0-9\.-]+:[^\s]+)\s{/) { print "$1\n"}'));
      
      for x in "${arr[@]}"
      do
          state=`tmsh list ltm pool $pool members { $x { state } } |grep state |awk -F" " '{ print $2 }'`
          session=`tmsh list ltm pool $pool members { $x { session } } |grep session |awk -F" " '{ print $2 }'`
          echo "$x:"
          echo "   state: $state"
          echo "   session: $session"
      done
      
  • Certainly. Replace the TMSH commands with cURL iControl REST calls and reformat the resulting data as required. I'm sure there's probably a much easier version of this, but here's an idea of what the first request might look like:

    curl -sk -u 'admin:admin' -H "Content-Type: application/json" -X GET https://x.x.x.x/mgmt/tm/ltm/pool/local-pool?expandSubcollections=true |sed 's/,/\n/g' |grep "\"name\":" |awk -F"\"name\":" '{ print $2 }' |perl -ne 'if (m/([a-zA-Z0-9\.-]+:[^\s]+)/) { print "$1\n"}' |sed 's/"//g'