AnsweredAssumed Answered

question about lua script and pre-processing rules

Question asked by rgivens on Oct 15, 2008
Latest reply on Oct 18, 2008 by rgivens

Here is what I'm trying to do - We have had an issue a few times with users entering pre-processing rules improprely resulting in a global filter being placed in.  This last time it occurred late at night and was not noticed for several hours.  My idea was to create a script that would generate a test alarm, check to see if that alarm exists, if it does close the alarm, and if it doesn't send an email to a distribution list.  Here is the script:


nimbus.alarm (1,"Pre-processing Rules Test Alarm","Pre-processingTestAlarm",3.1)
sleep(10000)


al=alarm.list("message","Pre-processing Rules Test Alarm")
if al ~= nil then
for i=1,#al do
a=al
-- printf(a.message)
-- printf(a.nimid)
sleep(10000)
action.close (a.nimid)
end
-- else action.command ("library/FilteredMachines-lib")
else action.email ("MyEmail@company.com","Pro-processing Rules Alarm")
end

The problem I'm having is that I can't get the else statement to work.  When there is no pre-processing rule it that would filter out this alarm the alarm is successfully generated and then closed.  When I place a pre-processing rule in that would exculde this from becoming an alarm nothing happens at all.  Maybe I'm approaching this the wrong way.  The end result I would like to have is a way of regularily testing that there isn't any type of syntax error in a pre-processing rule that could potentially put a global filter in place.  The way I figured would be a good solution is to generate a test alarm and check that the alarm was successfuly created on a regular basis.

Outcomes