Ad Widget

Collapse

AIX UserParameter for HACMP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sammiam
    Junior Member
    • May 2013
    • 3

    #1

    AIX UserParameter for HACMP

    Thought I'd share a finding using the UserParameter and using the clstat command for monitoring HACMP in an AIX environment. When you enter the command clstat without any parameters, it will return the status of the HACMP cluster, BUT, will never end, and continue to update. If you specify the "-o" parameter (clstat -o) it will run only once, giving you the output, and then returning to the command prompt.

    I was trying to use the clstat command both, in a script, and also raw in a UserParameter of the zabbix configuration. What I found was interesting, and I share this for those of you who may need to monitor HACMP for AIX.

    The zabbix_agentd will timeout using this command, regardless if it is in a script, or used raw. To correct the timeout problem, you MUST specify TERM="" . I'm not entirely sure why the agent hangs, obviously it has something to do with the terminal setting in the environment.
  • dave_t
    Junior Member
    • Apr 2007
    • 28

    #2
    Monitoring HACMP / PowerHA

    If it's of any interest, this is how I check the cluster state:

    (NOTE: This is one line in the zabbix_agentd.conf)

    UserParameter=Cluster_State,CLUSTER_STATE=`/usr/bin/lssrc -ls clstrmgrES | grep "^Current state" | awk ' { print $NF } '` ; if [ "$CLUSTER_STATE" = "" ] ; then echo 0 ;
    elif [ "$CLUSTER_STATE" = "ST_NOT_CONFIGURED" ] ; then echo 1 ; elif [ "$CLUSTER_STATE" = "ST_INIT" ] ; then echo 2 ; elif [ "$CLUSTER_STATE" = "ST_STABLE" ] ; then ec
    ho 3 ; elif [ "$CLUSTER_STATE" = "ST_JOINING" ] ; then echo 4 ; elif [ "$CLUSTER_STATE" = "ST_VOTING" ] ; then echo 5 ; elif [ "$CLUSTER_STATE" = "ST_BARRIER" ] ; then
    echo 6 ; elif [ "$CLUSTER_STATE" = "ST_CBARRIER" ] ; then echo 7 ; elif [ "$CLUSTER_STATE" = "ST_RP_RUNNING" ] ; then echo 8 ; elif [ "$CLUSTER_STATE" = "ST_RP_FAILED"
    ] ; then echo 9 ; fi



    ...then I use value mapping to identify the state returned by the "ClusterState" UserParameter:
    i.e.

    Name
    PowerHA Cluster State


    Value Map
    0 ⇒ Power HA Not Installed
    1 ⇒ ST_NOT_CONFIGURED
    2 ⇒ ST_INIT
    3 ⇒ ST_STABLE
    4 ⇒ ST_JOINING
    5 ⇒ ST_VOTING
    6 ⇒ ST_BARRIER
    7 ⇒ ST_CBARRIER
    8 ⇒ ST_RP_RUNNING
    9 ⇒ ST_RP_FAILED

    (This way I'm storing an integer in the database, which is more economical that storing the text values received by the output of "lssrc" or "clstat")

    It also makes things sime when setting up Triggers and Actions.

    Based on the config above, I've created a template which I've attached to this post, and will at some point upload to the templates on the wiki with some more documatation

    Hope this helps :-)

    Comment

    • geniepage
      Member
      • Sep 2015
      • 34

      #3
      Originally posted by dave_t
      If it's of any interest, this is how I check the cluster state:

      (NOTE: This is one line in the zabbix_agentd.conf)

      UserParameter=Cluster_State,CLUSTER_STATE=`/usr/bin/lssrc -ls clstrmgrES | grep "^Current state" | awk ' { print $NF } '` ; if [ "$CLUSTER_STATE" = "" ] ; then echo 0 ;
      elif [ "$CLUSTER_STATE" = "ST_NOT_CONFIGURED" ] ; then echo 1 ; elif [ "$CLUSTER_STATE" = "ST_INIT" ] ; then echo 2 ; elif [ "$CLUSTER_STATE" = "ST_STABLE" ] ; then ec
      ho 3 ; elif [ "$CLUSTER_STATE" = "ST_JOINING" ] ; then echo 4 ; elif [ "$CLUSTER_STATE" = "ST_VOTING" ] ; then echo 5 ; elif [ "$CLUSTER_STATE" = "ST_BARRIER" ] ; then
      echo 6 ; elif [ "$CLUSTER_STATE" = "ST_CBARRIER" ] ; then echo 7 ; elif [ "$CLUSTER_STATE" = "ST_RP_RUNNING" ] ; then echo 8 ; elif [ "$CLUSTER_STATE" = "ST_RP_FAILED"
      ] ; then echo 9 ; fi



      ...then I use value mapping to identify the state returned by the "ClusterState" UserParameter:
      i.e.

      Name
      PowerHA Cluster State


      Value Map
      0 ⇒ Power HA Not Installed
      1 ⇒ ST_NOT_CONFIGURED
      2 ⇒ ST_INIT
      3 ⇒ ST_STABLE
      4 ⇒ ST_JOINING
      5 ⇒ ST_VOTING
      6 ⇒ ST_BARRIER
      7 ⇒ ST_CBARRIER
      8 ⇒ ST_RP_RUNNING
      9 ⇒ ST_RP_FAILED

      (This way I'm storing an integer in the database, which is more economical that storing the text values received by the output of "lssrc" or "clstat")

      It also makes things sime when setting up Triggers and Actions.

      Based on the config above, I've created a template which I've attached to this post, and will at some point upload to the templates on the wiki with some more documatation

      Hope this helps :-)
      Great and good job

      Comment

      • dave_t
        Junior Member
        • Apr 2007
        • 28

        #4
        alternative to "clstat"

        Worth also noting that if you don't want to use "lssrc" in its native form, you can always use "qha.sh" (which was written by: Alex Abderrazag IBM UK Ltd) and then parse the output accordingly.

        You need to modify the script slightly to prevent it from looping (which would cause a timeout if you called it from the zabbix_agentd process)

        To do this, just comment out the following from the qha.sh script:

        # while true
        # do
        # COUNT=0
        # echo "\\033[H\\033[2J$VERSION $(date)\n" > /tmp/.aastatus
        # print "\t\tCluster Status for $CLUSTER" >> /tmp/.aastatus
        # for MAC in `odmget HACMPnode |grep name |sort -u | awk '{print $3}' |sed "s:\"::g"`
        # do
        # let COUNT=COUNT+1
        # work $MAC $COUNT $NETWORK $VG
        # done >> /tmp/.aastatus
        # cat /tmp/.aastatus
        # sleep $REFRESH
        # done
        #

        Comment

        Working...