Whats the easiest way to automatically set Custom_1 variable to a predefined value when a specific alarm i triggered?
Not the easiest way but you can explore alarm_enrichment
How to use the nas and alarm_enrichment probes to enrich alarms
Setup a pre-processing rule in the NAS is the easiest way.
Put the following in a script:
event.custom_5 = "your text"
And then trigger the script in the pre-processing rule to set your selected alarms with the custom_5 field
How/were do I define a simple "pre-processing rule" that do a regex match on alarm messages and if match execute my set custom1 script?
it can be done in NAS probe under pre-processing tab, create a new profile as per your criteria and choose filer type as Custom and choose the custom script as provided by RowanCollis
For more information please go through below link and look for
The nas Auto-Operator Tab - CA Unified Infrastructure Management Probes - CA Technologies Documentation
you can create multiple profiles under pre processing rules if regex conditions are few, but if the number of regex is large then you need to get this done in LUA script.
Elaborate please. LUA script?
I have not tested this code but you need to play around and modify as per your requirement, this is just an example you can use to start with. this code is written in LUA, code provided by Rowan is also a lua code.
You can get the required values from the message or probe or subsystem type etc and then on basis of matching criteria, you can populate values to the custom tag.
smessage = string.upper(event.message) sprid= string.upper (event.prid) stype = string.upper(event.sid)
if stype == "NMS" thenif (string.find(smessage, string.upper("whatever message text you want to match"))) ~= nil then event.custom_5 = "your text1" return event end end
if (sprid == "SQLSERVER") then
if (string.find(smessage, string.upper("whatever message to match"))) ~= nil then event.custom_5 = "your text2" return event elseif (string.find(smessage, string.upper(" - match condition 1")) and string.find(smessage , string.upper("match condition 2"))) then event.custom_5 = "your text3" return event end end
Note: this code is not tested, should be tested in test environment first.
Retrieving data ...