DX Application Performance Management

  • 1.  Problem with script to restart application

    Posted Sep 26, 2017 02:28 PM

    Hello everyone, I have a problem in my environment and I would like to know if someone has already experienced something similar: the situation is as follows:
    - I have a script that I use to restart my applications, APM is monitoring the GC and when it reaches the threshold that I have set it executes the script to restart. This script generates a txt file where another script checks the status from time to time, if it is RESTART it restarts the application. My problem is that APM only generates the status of RESTART, it does not generate the status of NORMAL when the application is reinitialized.

     

    #!/bin/sh
    ALERT_STATUS=$2
    AGENT_NAME=$3
    AGENT_INSTANCIA=$AGENT_NAME

    NOME_AGENTE=`echo $AGENT_NAME|awk -F"\|" '{print $(NF-2)}'`
    NOME_AGENTE=`echo $NOME_AGENTE | sed -e "s/]\"//g"`

    NOME_INSTANCIA=`echo $AGENT_INSTANCIA|awk -F"\|" '{print $(NF)}'`
    NOME_INSTANCIA=`echo $NOME_INSTANCIA | sed -e "s/]\"//g"`

    STATUS="INDEFINIDO"
    if [ "$ALERT_STATUS" = "\"3\"" ]; then
            STATUS="RESTART"
            echo Nome_Agente: $NOME_AGENTE >/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo Nome_Instancia: $NOME_INSTANCIA >>/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo STATUS: $STATUS >>/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo `date` " - " Nome_Agente: $NOME_AGENTE - $STATUS >>/opt/appfiles/p_07667_apm/coletor1/mom/logs/restart.log
    elif [ "$ALERT_STATUS" = "\"2\"" ]; then
            STATUS="ALERTA"
            echo Nome_Agente: $NOME_AGENTE >/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo Nome_Instancia: $NOME_INSTANCIA >>/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo STATUS: $STATUS >>/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo `date` " - " Nome_Agente: $NOME_AGENTE - $STATUS >>/opt/appfiles/p_07667_apm/coletor1/mom/logs/restart.log
    else
            STATUS="NORMAL"
            echo Nome_Agente: $NOME_AGENTE >/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo Nome_Instancia: $NOME_INSTANCIA >>/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo STATUS: $STATUS >>/opt/websites/httpd/2.2/p_07667_apmstatus/$NOME_AGENTE-$NOME_INSTANCIA.txt
            echo `date` " - " Nome_Agente: $NOME_AGENTE - $STATUS >>/opt/appfiles/p_07667_apm/coletor1/mom/logs/restart.log
    fi

     

    In my logfile i just have this:

    Qui Set 21 10:09:40 BRT 2017  -  Nome_Agente: xxxxxxx0434 - RESTART
    Qui Set 21 10:09:40 BRT 2017  -  Nome_Agente: xxxxxxx0433 - RESTART
    Qui Set 21 10:10:12 BRT 2017  -  Nome_Agente: xxxxxxx0432 - RESTART
    Qui Set 21 10:16:10 BRT 2017  -  Nome_Agente: xxxxxxx0433 - ALERTA
    Qui Set 21 10:16:25 BRT 2017  -  Nome_Agente: xxxxxxx0432 - ALERTA
    Qui Set 21 10:18:25 BRT 2017  -  Nome_Agente: xxxxxxx0434 - ALERTA

     



  • 2.  Re: Problem with script to restart application

    Broadcom Employee
    Posted Sep 26, 2017 04:15 PM

    Hi, what variables are you passing to the script?



  • 3.  Re: Problem with script to restart application

    Posted Sep 26, 2017 04:19 PM

    - Pass Text to Shell

    - Alert Status

    - Agent Name(s)



  • 4.  Re: Problem with script to restart application

    Broadcom Employee
    Posted Sep 26, 2017 05:05 PM

    Are you using version 10.5.1?  If so what hofix level are  you at?



  • 5.  Re: Problem with script to restart application

    Posted Sep 27, 2017 08:48 AM
    no, in this environment I'm still in version 10.5 without hotfix.


  • 6.  Re: Problem with script to restart application

    Broadcom Employee
    Posted Sep 26, 2017 10:19 PM

    You'll want to know about the state of the change, not when the severity changes. This is similar to how we configure SNMP traps to send event notifications.



  • 7.  Re: Problem with script to restart application

    Posted Sep 27, 2017 08:51 AM

    exactly, I want to know if I'm doing something wrong, because from what I've studied here the status changes are only reporting the problem and not returning to normalcy. I was wondering if there is anything I have to do to run the script when the application returns to normal.



  • 8.  Re: Problem with script to restart application

    Broadcom Employee
    Posted Sep 27, 2017 09:11 AM

    Try setting to final state change and try a test notification.



  • 9.  Re: Problem with script to restart application

    Posted Sep 27, 2017 09:18 AM

    in fact I already tested it, originally I configured it with final state change only that it did not work and then I changed it to when the severity changed to see if it had any effect, but it still did not work.



  • 10.  Re: Problem with script to restart application

    Broadcom Employee
    Posted Sep 27, 2017 11:35 AM

    Don't forget to set a notification on your Caution threshold so you can get a "NORMAL" status.

    It's not enough to have notifications on the Danger threshold.