chitambira

gpfs_snmp_failover

Jul 5th, 2012
165
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # This script implements gpfs snmp monitoring failover by changing the defined collector node from a failed node to one of the available nodes.
  3. # The failover scheme uses a callback mechanism triggered by a nodeLeave and the eventNode is its only parameter
  4. # by Benny Chitambira 2012 bchitambira at gmail.com
  5.  
  6. failedNode=$1
  7. defaultNode="quorum_node_1"
  8. standbyNode="quorum_node_2"
  9. activeNode=`/usr/lpp/mmfs/bin/mmlscluster | awk /snmp/'{print $4}'`
  10.  
  11. status1=`mmgetstate -N $defaultNode | awk /$defaultNode/'{ print $3 }'`
  12. status2=`mmgetstate -N $standbyNode | awk /$standbyNode/'{ print $3 }'`
  13.  
  14. #if [[ -z "$activeNode" ]]
  15. #then
  16. # /usr/lpp/mmfs/bin/mmchnode --snmp-agent -N $defaultNode
  17. #fi
  18.  
  19. if [[ "$status1" != "active" && "$status2" == "active" && $activeNode == $defaultNode* ]]
  20. then
  21. echo "***** `date` : Node leave event for $failedNode" >> /callback/snmp_collector_failover.log
  22. echo " Node $defaultNode is not active, status is: $status1" >> /callback/snmp_collector_failover.log
  23. echo " Making node $standbyNode the SNMP collector" >> /callback/snmp_collector_failover.log
  24. /usr/lpp/mmfs/bin/mmchnode --nosnmp-agent -N $defaultNode
  25. /usr/lpp/mmfs/bin/mmchnode --snmp-agent -N $standbyNode
  26. elif [[ "$status1" == "active" && "$status2" != "active" && $activeNode == $standbyNode* ]]
  27. then
  28. echo "***** `date` : Node leave or join event for $failedNode" >> /callback/snmp_collector_failover.log
  29. echo " Node $defaultNode is now $status1" >> /callback/snmp_collector_failover.log
  30. echo " Making node $defaultNode the SNMP collector" >> /callback/snmp_collector_failover.log
  31. /usr/lpp/mmfs/bin/mmchnode --nosnmp-agent -N $standbyNode
  32. /usr/lpp/mmfs/bin/mmchnode --snmp-agent -N $defaultNode
  33. elif [[ "$status1" != "active" && "$status2" != "active" ]]
  34. then
  35. echo "***** `date` : Node leave event for $failedNode" >> /callback/snmp_collector_failover.log
  36. echo " Both default and standby snmp collector nodes are down, nothing to do" >> /callback/snmp_collector_failover.log
  37. else
  38. echo "***** `date` : The collector node $activeNode is active, nothing to do" >> /callback/snmp_collector_failover.log
  39. fi
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×