AnsweredAssumed Answered

LUA script to count open alarms from Dirscan and alert if too few

Question asked by Greenones on Aug 2, 2016
Latest reply on Aug 3, 2016 by chrlu01

Hi all,


I've looking into a way of counting open alarms on the alarm console and alerting if there are too few.

I found this script which apparently does the job, but I'm struggling to amend it to do what I'm looking for..The script runs without errors but doesnt send the alert.


list = alarm.list()

local match_count = {}

local current_count = 0


for i=1, #list do

   alm = list[i]

   hub = alm.hub



   match = regexp( alm.message, "/Average/")

   match = (match and regexp (hub, "/^HubName-/"))


   if match == true then



      if match_count[hub] == nil then

         current_count = 0


         current_count = match_count[hub]



      current_count = current_count +1

      match_count[hub] = current_count




for hub, alarm_count in pairs(match_count) do

   suppression_key = "snmpagent-"..hub

   if alarm_count <=20 then

      message = "Excessive number of snmp agents not responding on " .. hub .. " with a total of " .. alarm_count .. " alarms"

      print (message)


      nimbus.alarm (4, message , suppression_key)