claus.langhans

Change the alarm message text with a LUA script

Discussion created by claus.langhans on Jun 26, 2009
Latest reply on Dec 13, 2013 by carl
Hi,

I am trying to change the message text with a LUA script. So I came up with this one:

a = alarm.get()
printf ("===> %s, nimid: %s, message: %s", PROFILE_NAME, a.nimid, a.message)
a.message = "NON-PROD: " .. a.message
printf ("===> %s, nimid: %s, message: %s", PROFILE_NAME, a.nimid, a.message)

I can see in the log file that the auto-operator is triggered and that the message text is indeed changed:

Jun 25 15:21:27:788  nas: SCRIPT Prefix Non-PRD: ===> SCRIPT Prefix Non-PRD, nimid: NI45877147-92141, message: test
Jun 25 15:21:27:788  nas: SCRIPT Prefix Non-PRD: ===> SCRIPT Prefix Non-PRD, nimid: NI45877147-92141, message: NON-PROD: test

However this neither reflected in any of the GUIs nor in the SQLite database of the NAS.

I tried to run this script as a pre-processing rule, put the alarm.get() does not seem to be supported. (Why?)

Where am I going wrong? Do I need to somehow repost the alarm or call some kind of update method?

Claus

P.S.: I noticed that in other examples in this forum alarm.get is called like this: alarm.get()() and not like this(). Is this intentional?

Outcomes