DX NetOps

 View Only
  • 1.  Tuesday Tip: How to add SPECTRUM attributes to alarm notifications

    Posted Dec 08, 2011 03:38 AM

    Tuesday Tip: How to add SPECTRUM attributes to alarm notifications

    CA SPECTRUM Tuesday Tip by John Ware, Support Engineer, December 6, 2011

    Can Spectrum Attributes be added to Alarm Notifications?

    You can add specific attributes to alarm notifications by modifying one or more AlarmNotifier scripts.

    Any of the attributes of the model involved in the alarm can be passed to AlarmNotifier and used in SetScript, ClearScript or UpdateScript. To do this, you must use the .alarmrc parameters EXTRA_ATTRS_AS_ENVVARS or EXTRA_ATTRS_AS_ARGS. When using either of these parameters the USE_NEW_INTERFACE .alarmrc parameter must be set to TRUE.

    EXTRA_ATTRS_AS_ENVVARS passes attributes to AlarmNotifier as environmental variables and EXTRA_ATTRS_AS_ARGS passes attributes as additional command line arguments. For most attributes, either of these mechanisms can be used, but EXTRA_ATTRS_AS_ENVVARS is required when new lines or other special characters can cause problems with the script's parsing of the extra data. When USE_NEW_INTERFACE=TRUE, the environment variable mechanism is used to pass $STATUS, $EVENTMSG, and $PCAUSE to avoid this problem. ($EVENTMSG is only available when SANM is installed.)
    In the .alarmrc file, set the appropriate parameter equal to the SPECTRUM attribute IDs that you wish to pass. You can reference the attribute ID either in hexadecimal or decimal notation. See ".alarmrc Parameters" on page 27 (Alarm Notifier Guide) for specific instructions on the syntax for setting each of these parameters.
    If you pass an attribute as an environmental variable using EXTRA_ATTRS_AS_ENVVARS, you reference this variable in a script using the following syntax:
    $SANM_<attribute_ID>
    Where <attribute_ID> is the attribute ID of the attribute you are referencing. If you have used hexadecimal notation to call this attribute in the .alarmrc file, you must also use hexadecimal notation in the script. If you have used decimal notation to call this attribute in the .alarmrc file, you must also use decimal notation in the script.
    Note that Windows will automatically set environmental variables to uppercase, therefore when you reference these variables you must be sure to use the uppercase format (e.g.:$SANM_0X100C5).
    If you pass an attribute as an argument using EXTRA_ATTRS_AS_ARGS, you can reference this variable in a script by assigning the value to a variable within the script:
    <variable>=$<x>
    Where <variable> is the variable which will hold the value of the attribute, and <x> is the appropriate variable number based on the order and number of arguments that you have passed.
    Example
    The following example shows four sample SPECTRUM attributes being passed to AlarmNotifer in the .alarmrc file and then referenced in a script.

    .alarmrc file reference:


    USE_NEW_INTERFACE=TRUE
    EXTRA_ATTRS_AS_ENVVARS=0x100c5,0x11f84
    EXTRA_ATTRS_AS_ARGS=0x110df,0x117dc


    Script reference :


    #These lines read 0x110df and 0x117dc into the variables MAC_ADDRESS and FIRMWARE_VERSION respectively.
    shift 9
    MAC_ADDRESS=$1
    FIRMWARE_VERSION=$2


    #These lines print out the value of each attribute.(Solaris Platform)
    echo "The value of attribute 0x100c5 is: " $SANM_0x100c5
    echo "The value of attribute 0x11f84 is: " $SANM_0x11f84
    echo "The value of attribute 0x110df is: " $MAC_ADDRESS
    echo "The value of attribute 0x117dc is: " $FIRMWARE_VERSION


    #These lines print out the value of each attribute.(Windows Platform-#references to environmental variables are in uppercase)
    echo "The value of attribute 0x100c5 is: " $SANM_0X100C5
    echo "The value of attribute 0x11f84 is: " $SANM_0X11F84
    echo "The value of attribute 0x110df is: " $MAC_ADDRESS
    echo "The value of attribute 0x117dc is: " $FIRMWARE_VERSION



  • 2.  RE: Tuesday Tip: How to add SPECTRUM attributes to alarm notifications

    Broadcom Employee
    Posted Dec 08, 2011 03:41 AM
    Excellent Tip John! Thanks for sharing.


  • 3.  RE: Tuesday Tip: How to add SPECTRUM attributes to alarm notifications

    Posted Dec 08, 2011 06:44 AM
    Thanks John for this great tip on adding SPECTRUM attributes to alarm notifications.

    I would also like to welcome you to the Tuesday Tip team! We look forward to your contributions!

    Cheers!
    Mary


  • 4.  Re: Tuesday Tip: How to add SPECTRUM attributes to alarm notifications

    Posted Oct 19, 2018 09:51 AM

    Hi! I found this tip, very good (Y).

    Now I'm trying to make this work due to I need add the alarm title to the alarm notification

    I have the following:

    0x12b4c is an alarm attribute to alarm title

     

    on alarmrc I added it to EXTRA_ATTRS_AS_ENVVARS:

     

    USE_NEW_INTERFACE=true
    EXTRA_ATTRS_AS_ENVVARS=0x12b4c
    EXTRA_ATTRS_AS_ARGS=0x0023000e,0x11564

     

    on SetScript:

     

    echo "AlarmTitle:  $SANM_0X12B4C"

     

    but appear in blank ...

     

    Alarm Notification from SPECTRUM

    Alarm SET:

    Date: 10/19/2018
    Time: 10:39:33
    DeviceType: systemEDGE Host
    Mtype: Host_systemEDGE
    ModelName:  cl01prdwin03 
    AlarmID: 28694
    Severity: CRITICAL
    ProbableCauseID: 10f09
    RepairPerson:
    AlarmStatus:
    SpectroSERVER: spectrum-ss
    Landscape: 0x1000000
    ModelHandle: 0x1003a93
    ModelTypeHandle: 0x1160088
    IPAddress: 10.64.10.66
    SecurityString: ADMIN
    AlarmState: NEW
    Acknowledged: FALSE
    UserClearable: TRUE
    Location:
    AlarmAge: 0
    NotificationData:

    ProbableCause: HIGH AGGREGATE CPU UTILIZATION
    AlarmTitle:

     

    There's something wrong or do I have to add something else?

     

    I appreciate your help!

    thank you!

    EOS



  • 5.  Re: Tuesday Tip: How to add SPECTRUM attributes to alarm notifications

    Broadcom Employee
    Posted Oct 19, 2018 02:37 PM

    I think that happens if the alarm title is static as opposed to dynamic. Try this before you try echoing :

     

    ALARM_TITLE=$SANM_0x12b4c
    if [ -z "$ALARM_TITLE" ]
      then
        ALARM_TITLE=`echo "$PCAUSE" | head -1`
    fi

    ...

    echo "AlarmTitle:  $ALARM_TITLE"

    ....



  • 6.  Re: Tuesday Tip: How to add SPECTRUM attributes to alarm notifications

    Posted Oct 19, 2018 04:06 PM

    Thank you Robert, Im gonna try that..

     

    Have a good wekend

    EOS