DX NetOps

  • 1.  Heartbeat trap alert

    Posted Apr 20, 2019 11:01 PM

    For Spectrum 10.2 running on Solaris, we use snmptrap to generate a snmp heartbeat trap to monitor Spectrum server status via the following shell script:

     

    /usr/sfw/bin/snmptrap -v 1 -c public $SSSERVER .1.3.6.1.4.1.1.590.2 $AGENTHOST 6 1 '' .1.3.6.1.4.1.1.590.2.1.1 s $SENDTIME .1.3.6.1.4.1.590.2.1.2 s "pulse"

     

    But it won't work on Linux, it gave the following error:

    s: Bad variable type ("1")

     

    Here is the AlertMap info for this custom alert:

     

    #HeartBeat_pulse                                   Timestamp

    1.3.6.1.4.1.1.590.2.6.1     0x053609ae  1.3.6.1.4.1.1.590.2.1.1(1,0)\

                                                                    # Message

                                                                    1.3.6.1.4.1.1.590.2.1.2(2,0)

     

    Could not figure out what variable type it should be.(have tried all 6 types of, none of them work).

     

    Any help is much appreciated.

    Thanks,

    Kevin



  • 2.  Re: Heartbeat trap alert

    Broadcom Employee
    Posted Apr 22, 2019 01:06 PM

    Hi Kevin,

     

    Where exactly did you get the error below?

    s: Bad variable type ("1")

     

    Did you also customize the EventDisp for the  0x053609ae event code?

    Are you using the Southbound Gateway?

     

    Thanks,

    Silvio



  • 3.  Re: Heartbeat trap alert

    Posted Apr 22, 2019 02:28 PM

    Hello Silvio,

     

    I have a shell script called PulseAlarm.sh under /spectrum/custom/bin/ like following:

     

    #!/bin/sh

    # Send pulse trap to SPECTRUM

     

    DEBUG=0  #0=false 1=true

     

     

    HOSTNAME=`hostname`

    SSSERVER=$HOSTNAME

    SENDTIME=`perl -e 'print time()'`

     

    logfile='/app/spectrum/custom/logs/rbcPulseAlarmLog.out'

     

    case $HOSTNAME in

       ulvxxxxxxxxxxxx)

          AGENTHOST=<hostname1>

          ;;

       ulvxxxxxxxxxxxx)

          AGENTHOST=<hostname2>

          ;;

    esac

     

    DATE=`date`

    echo "$DATE: Sent $AGENTHOST SNMP TRAP to $SSSERVER from $HOSTNAME, CurrentTime = $SENDTIME" >> $logfile;

    if [ $DEBUG -eq 1 ]; then

    echo "$DATE: /usr/bin/snmptrap -v 1 -c public $SSSERVER .1.3.6.1.4.1.1.590.2 $AGENTHOST 6 1 '' .1.3.6.1.4.1.1.590.2.1.1 s $SENDTIME .1.3.6.1.4.1.590.2.1.2 s \"pulse\" " | tee -a $logfile

    fi

     

    /usr/bin/snmptrap -v 1 -c public $SSSERVER .1.3.6.1.4.1.1.590.2 $AGENTHOST 6 1 '' .1.3.6.1.4.1.590.2.1.1 s $SENDTIME .1.3.6.1.4.1.590.2.1.2 s "pulse"

     

    When I run the script under RHEL, I got the error, but working under Solaris:

     

    Under RHEL Linux;

     

    <928 spectrum@ulvxxxxxxxx11.fg.rbc.com /spectrum/custom/bin>

    $./PulseAlarm.sh

    s: Bad variable type ("1")

    <929 spectrum@ulvxxxxxxxx11.fg.rbc.com /spectrum/custom/bin

     

     

    Under Solaris:

     

    <502 pxbh0app@usvxxxxxxxx1 /app/spectrum/custom/bin>

    $./PulseAlarm.sh

    Monday, April 22, 2019 02:14:06 PM EDT: /usr/sfw/bin/snmptrap -v 1 -c public usvspecd01 .1.3.6.1.4.1.1.590.2 usvspecd01 6 1 '' .1.3.6.1.4.1.1.590.2.1.1 s 1555956846 .1.3.6.1.4.1.590.2.1.2 s "pulse"

    <503 spectrum@uusvxxxxxxxx1 /app/spectrum/custom/bin>

     

    Yes, we customized the EventDisp for the  0x053609ae event code. But Southbound Gateway is not used for this. 

     

    It is just using snmptrap to send our private trap.

     

    Thanks,

    Kevin



  • 4.  Re: Heartbeat trap alert

    Broadcom Employee
    Posted Apr 22, 2019 05:15 PM

    Hi Kevin,

     

    Actually this is not a Spectrum issue.

     

    a) Are you using the same shell in Solaris and RHEL?

     

    b) Have you tried putting the script in verbose mode to see in which line you are getting the message error?

     

    #!/bin/sh

    set -xv

    # Send pulse trap to SPECTRUM

     

    DEBUG=0  #0=false 1=true

     

    Thanks,

    Silvio



  • 5.  Re: Heartbeat trap alert
    Best Answer

    Posted Apr 23, 2019 10:22 AM

    Hi Silvio,

     

    I was able to figure out the cause. I have to use the FQDN for hostname on Linux.

     

    Thanks a lot for your help.

    Kevin