Sometimes, the Title of an alarm does not adequately convey enough information to allow action to be taken without viewing the body of the message. In these cases, it is desirable to add attributes of the model which raised the alarm so as to easily identify appropriate remedial actions. This article describes how to do this using the examples of Model Name and ifAlias.
Release: Any version of Spectrum
What is required here is the use of an Event Procedure. In the following methodology, we use the example of the BAD LINK DETECTED alarm since it offers no visible identifying signs in the title.
In this case, the Event code (ID) for BAD LINK DETECTED is 0x00010d11. As an example, if you wish to add the attributes for Model Name and ifAlias, you would proceed as follows;
1. Using the Event Configurator (OneClick -> Tools menu -> Utilities -> Event Configuration find the Event ID 10d11 (this is the BAD LINK DETECTED event) and copy this event to create a new one (the copy button is the one with two overlapping circles with an 'E' in each). This will create a file called EventDisp in the custom directory ($SPECROOT/custom/Event/) containing the following;
0xfff00000 E 10 A 3,0x0001040a
0x10d11 E 50
You need to note down the new event code (usually 0xfff00000 if its the first new custom event created in the system).
2. You need to disable the alarm for the original event (0x00010d11) since the new event (0xfff00000) is what will raise it with the new alarm title. You can set the new event's alarm severity to whatever you require.
3. You will need to edit this file in the custom directory to add the Event Procedure that can take the two model attributes and concatenate them to the alarm title. To do this, it uses the new event created in step 1 and tells the original event (0x00010d11) to generate the new event (0xfff00000). It then creates new event variables for this event to cater to the two new attributes you wish to add, which are (both for the Interface that generates the BAD LINK DETECTED alarm);
You will therefore need to add these two attributes using an event procedure to this Event Code's (0x00010d11) dynamic alarm title ID (0x12b4c). As an example;
0x00010d11 E 10 P "\
CreateEventWithVariables (\
{C CURRENT_MODEL },\
{H 0xfff00000 },\
SetEventVariable (\
GetEventVariableList(),\
{ H 0x12b4c },\
Append(Append(Append( {S \"BAD LINK DETECTED - \"} ,\
ToString(ReadAttribute({C CURRENT_MODEL},{H 0x1006e}))),\
{S \":\"}),\
ToString(ReadAttribute({C CURRENT_MODEL},{H 0x11f7e})))))"
0xfff00000 E 10 A 3,0x1040a
OR
0x00010d11 E 10 P "\
CreateEventWithVariables (\
{C CURRENT_MODEL },\
{H 0xfff00000 },\
SetEventVariable (\
GetEventVariableList(),\
{ H 0x12b4c },\
Append(Append(Append( {S \"BAD LINK DETECTED - \"} ,\
ToString(ReadAttribute({C CURRENT_MODEL},{H 0x1006e}))),\
{S \":\"}),\
ToString(ReadAttribute({C CURRENT_MODEL},{H 0x13224})))))"
0xfff00000 E 10 A 3,0x1040a
What is happening above is that these two attributes are being appended to the BAD LINK DETECTED title with a colon (:) between them (the {S \":\"})where S denotes string and \ is an escape character )
3. You will then need to go to the VNM model's Component Detail View -> Information tab -> SpectroSERVER Control and click on the Update Event Configuration button for this to take effect.
4. You can check that the Event procedure is registered in the new event by searching for the original event (0x00010d11) in Event Configuration and selecting the Event Rules tab (see screenshot). Have you to either click on the Refresh button or close and relaunch the Event Configuration editor to see the changes.
If you have a test environment you can easily validate the Event Procedure to generate a dynamic alarm title.
1. Open a bash shell (bash -login)
2. Navigate to the $SPECROOT/vnmsh/ directory
3. Run: ./connect
4. Run: ./create event type=0x10d11 text=test mh=<Port_Model_Handle>
Example: ./create event type=0x10d11 text=test mh=0x1003dad