DX Application Performance Management

  • 1.  CA APM shell command action arguments

    Posted Jan 18, 2018 07:00 AM

    I am using CA APM 10.5.2 and would like to pass some custom variables which uniquely identifies application name (probably management module name) and can be passed as custom variable along with other variables to shell script action. I want to avoid creation of multiple actions with hardcoded application name as argument for each applications so any suggestion to achieve it would be appriciated.

     

    Thanks

    Ravi



  • 2.  Re: CA APM shell command action arguments
    Best Answer

    Posted Jan 19, 2018 01:31 PM

    Hello,
    I have the same problem here, the way we managed to overcome this problem here was as follows ...

     

    in the creation of the domains of the applications, we put a unique identifier of that application for example 00023 followed by "-" and a mnemonico (00023-selles), then in the action we pass 3 parameters: pass text to shel, alert status and agent name (s) .

     

    so it was only dealing with those values we passed in the shell script we created ... I'm using more or less like this:

     

     

    !/bin/sh
    #
    # Determine automatically where our home is.
    # resolve links - $0 may be a softlink
    PRG="$0"
    while [ -h "$PRG" ] ; do
      ls=`ls -ld "$PRG"`
      link=`expr "$ls" : '.*-> \(.*\)$'`
      if expr "$link" : '.*/.*' > /dev/null; then
        PRG="$link"
      else
        PRG=`dirname "$PRG"`/"$link"
      fi
    done
    PRGDIR=`dirname "$PRG"`

    # Set environment
    if [ -f $PRGDIR/setIscEnv.sh ] ; then
    #       . $PRGDIR/setIscEnv.sh
    source $PRGDIR/setIscEnv.sh
    else
            echo "There is no environment setup file: setIscEnv.sh"
            echo "Please re-run configureWily in installation directory!"
            exit
    fi
    #---------------Set the log file-----------------------------------------#
    LOG_FILE=/opt/programas/apm/mom/log/chamado.log
    #______________Receipt of values--------------------------------#
    ALERT=$1
    ALERT_STATUS=$2
    AGENT_NAME=$3

    #---------------Define Agent Name and Instance Name----------------------#
    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"`

    #--------------Treat the data to get the service code and the name of the application-#
    TT_AGENTS=`echo $AGENT_NAME|awk -F"|" '{print $(NF)}'`
    TT_AGENTS=`echo $TT_AGENTS | sed -e "s/]\"//g"`
    DOMAIN=`echo $AGENT_NAME|awk -F"|" '{print $(NF-3)}'`
    DOMAIN=`echo $DOMAIN | sed -e "s/\"\[//g"`

    DOMAIN_ARRAY=( $(echo $DOMAIN | tr "-" "\n") )
    COD_SERV="0000"
    APLIC=$TT_AGENTS

    if [ "X${DOMAIN_ARRAY[1]}" != "X" ]; then
            COD_SERV=${DOMAIN_ARRAY[0]}
            COD_SERVV=`echo $COD_SERV | awk -F"\/" '{print $(NF)}'`
            APLIC=${DOMAIN_ARRAY[1]}
    fi