How to include the CAPC_Item_Id in Spectrum Alarm Notifier output
search cancel

How to include the CAPC_Item_Id in Spectrum Alarm Notifier output

book

Article ID: 421101

calendar_today

Updated On:

Products

Network Observability

Issue/Introduction


When processing alarms via the AlarmNotifier and scripts we would like to use the CAPC_Item_Id value for the model. How can this be passed to the AlarmNotifier scripts?

Environment

All supported CA Spectrum release

Resolution

Refer to the "Passing Product Attributes to Scripts" section in the CA Spectrum Product Documentation for additional details.

It notes:

In the .alarmrc file, set the appropriate parameter equal to the CA Spectrum attribute IDs that you want to pass. You can reference the attribute ID either in hexadecimal or decimal notation.

It also provides the following example.

Example

The following example shows four sample CA Spectrum attributes that are passed to AlarmNotifier in the .alarmrc file. The attributes are then referenced in the SetScript, UpdateScript, and ClearScript(s).

.alarmrc File Reference

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


In this example (above) we add the CAPC_Item_Id attribute handle 0x13214 to the EXTRA_ATTRS_AS_ENVVARS line

Script Reference

 

# Information on specifying additional attributes, which requires
# USE_NEW_INTERFACE=true :

 

# Two ways have been added that allows the specification of additional 
# attributes for AlarmNotifier.  You have the option of passing the 
# attributes as environment variables or as arguments, which is reflected
# in the two new config parameters:
#
# EXTRA_ATTRS_AS_ENVVARS and EXTRA_ATTRS_AS_ARGS
#
# For most attributes, either method is acceptable, but for multi-line text
# attributes or for very long attribute values it is recommended to specify
# these as EXTRA_ATTRS_AS_ENVVARS because of command-line length limitations
# and Windows behavior that truncates the command-line at the first newline
# character.

 

# If EXTRA_ATTRS_AS_ENVVARS have been specified, they can be just referenced
# by prepending # SANM_ to the value in the config file, ie:
#
#  EXTRA_ATTRS_AS_ENVVARS=0x100c5,0x11f84  means that
#
#  $SANM_0x100c5 and $SANM_0x11f84 environment variables to be set, which
#  can be then be referenced in this script like:
#
# IFDESC=$SANM_0x100c5 
# IFALIAS=$SANM_0x11f84
#
#  Note: Windows will uppercase these variables, so they need to be referenced
#        that way - ie. $SANM_0X100C5 and $SANM_0X11F84.
#
# Alternatively, if EXTRA_ATTRS_AS_ARGS have been specified, they will be
# added to the command-line.  For example:
#
#  EXTRA_ATTRS_AS_ARGS=0x100c5,0x11f84   means that
#
#  the values of these attributes will be added to be argument list passed
# to this script, and can be referenced like this:
#
# IFDESC=$1
# IFALIAS=$2
CAPC_ITEM_ID=$SANM_0x13214

 

When using EXTRA_ATTRS_AS_ENVVARS the value is available prefixing $SANM_ to the attribute handle 0x13214 ex $SANM_0x13214. I then assign this to an internal script vaiable (above)

CAPC_ITEM_ID=$SANM_0x13214

and is now useable.

example

echo_info()
{
echo ""
echo "============================================================"
echo " "
echo "Alarm Notification from SPECTRUM"
echo " "
echo "Alarm SET:"
echo ""
echo "Date:            " $DATE
echo "Time:            " $TIME
echo "DeviceType:      " $DTYPE
echo "Mtype:           " $MTYPE
echo "ModelName:       " $MNAME
echo "AlarmID:         " $AID
echo "CAPC_ITEM_ID:    " $CAPC_ITEM_ID

# If you wish to see the global alarm ID printed out you need to set
# ENABLE_CORRELATION to "true" and USE_NEW_INTERFACE to "true" in the
# configuration file.



Note: The AlarmNotifier will need to be restarted to pick up the .alarmrc config changes.