To monitor if something didn't happened I use this script, it basically checks your Alarm History and if it's not there then it alerts you
rc = database.open("provider=nis;database=nis;driver=none")
query = "SELECT message from nas_transaction_summary where created > DATE_SUB(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE) and message like 'EXPECTED ALARM TEXT%' union select 'Dummy Record' from dual limit 1;"
alarms, rc = database.query(query)
for _, al in pairs (alarms) do
message = "EXPECTED ALARM TEXT has not happened"
SUPPKEY = "INSERT_SUPP_KEY"
SUBSYS = "1.1"
SOURCE = "INSERT_SOURCE"
if regexp (al.message,"*EXPECTED_TEXT*")
--then print (al.message)
then print ("Everything is fine")
--else print (al.message)
else nimbus.alarm (4, message , SUPPKEY , SUBSYS , SOURCE)
database.close()
end
end
You'll need to insert a dummy record into your DB so if nothing is found then the dummy record appears as a result, the regex can then scan this text. I found regex doesn't work with Blank values.
Hope it helps.