sonya.patel

Issue an independent alert to notify when alert transitions from Orange to Red

Discussion created by sonya.patel on Jan 7, 2014
Latest reply on Jan 11, 2014 by 1_keithk

This script used to work and the original author has left the company.  Sometimes it works but not all the time.  Is it possible for someone to review the script?  Thank you in advance.

 

a = alarm.get()
--printf("OrangeToRed passing thru %s ",a.nimid)
if (a.prevlevel ~= nil ) then
   --printf("OrangeToRed prevlevel is %d",a.prevlevel)
   if (a.prevlevel == 4 ) then
      if (a.suppcount ~= nil ) then
         if (a.suppcount == 0 ) then
            if (a.assigned_to == "HPOVSD") then
            --printf("OrangeToRed Alert %s is critical and suppcount is %d .",a.nimid,a.suppcount)
            --nimbus.alarm(5,"Nimbus alarm "..a.nimid.." has gone from orange to critical. Look up incident and Notify the resposible group. Then acknowledge this alert. Message is "..a.message,a.nimid)
            --a.suppcount = 1
            --alarm.set(a)
            end
         elseif (a.suppcount == 1 ) then
            if (a.assigned_to == "HPOVSD") then
               match,pos = substr(a.message,"Contact")
               if match then
                  emess = left(a.message,pos)
               else
                  emess = a.message
               end
               printf("OrangeToRed Alert %s is critical and suppcount is %d .",a.nimid,a.suppcount)
               nimbus.alarm(5,"suppcount 1 Nimbus alarm "..a.nimid.." has gone from orange to critical. Look up incident and Notify the resposible group. Then acknowledge this alert. Message is "..emess.." Contact Operations",a.nimid,a.subsys,a.source)
            end        
         end
      else
         -- a.suppcount is nil
         if (a.assigned_to == "HPOVSD") then
            matchn,posn = substr(a.message,"Contact")
            if matchn then
               emessn = left(a.message,posn)
            else
               emessn = a.message
            end
            printf("OrangeToRed Alert %s is critical and suppcount is nil .",a.nimid)
            nimbus.alarm(5,"suppcount Nimbus alarm "..a.nimid.." has gone from orange to critical. Look up incident and Notify the resposible group. Then acknowledge this alert. Message is "..emessn.." Contact Operations",a.nimid,a.subsys,a.source)
         end                 
      end
   end
end 

--exit(0)

Outcomes