carl

LUA - Custom Tags in Alarms

Discussion created by carl on Sep 3, 2012
Latest reply on Sep 4, 2012 by 1_keithk

I was asked an interesting question the other day and thought to share this here:

 

"How to update or add the custom_x fields in an alarm using LUA OUTSIDE of pre-processing rules"

 

A normal pre-processing rule to operate on an alarm "graps" the alarm for you but in this case we are using the NimID to fetch the alarm from the NAS. Then we simply add the custom_x key and value and send the alarm back. The same alarm will now have your custom fields attached

 

#!/opt/nimsoft/sdk/nsa/nsa 
a = alarm.get("RN45805640-28788")
a.custom_1 = "test"
alarm.set(a)

Outcomes