Utilizing event procedures to place a device in maintenance mode
For this example, we will be using the 'WriteAttribute' procedure code.
This allows you to either set an attribute in Spectrum to True or False (yes/no) or utilize an event variable to set the attribute value to that (must be a writable attribute).
Examples:
WriteAttribute( \
{ C CURRENT_MODEL }, \
{ H
0xffff0001
}, \
GetEventVariable( { U
5
} ) \
)
Write a value retrieved from event variable 1 to attribute 0xffff0001 of the current model.
The GetEventVariable function, retrieves the value from the variable of the event.
With the WriteAttribute function, writes the value to the model.
Maintenance Mode:
It is important to note that once a device is in maintenance mode it will no longer process traps or alarms.
So using a trap, which this example is using, will place it in maintenance but a procedure cannot be used to remove it from maintenance.
Place this code in your $SPECROOT/Custom/Events/eventdisp file:
0xffff0011 E 20 A 4,0xffff0011 P "WriteAttribute( { C CURRENT_MODEL }, { H 0x1295d }, { B False } )"
Attribute 0x1295d is the isManaged attribute. Setting it to False effectively sets it to "no".
This can be helpful if a device is going down for a reboot and sends a trap to notify Spectrum of that case, or if a device supports 'maintenance' type of traps.
Please reference the "How to Use Procedure in Event Processing" for more information.