DX Infrastructure Manager

Expand all | Collapse all

LUA Script: Create array/list of Alert ID's then close them all

  • 1.  LUA Script: Create array/list of Alert ID's then close them all

    Posted 12-03-2014 02:25 AM

    Hello, I hit an issue with the Nimsoft/UIM connector and SOI and now I have 350+ stale Nimsoft Alerts on my UIM Console since the connector could not close the respective alert on the UIM side. 

    Can someone tell me real quick, I have a list of alarm ID: --  FFF2343-234,FFwere-12323, etc....

    What does a list or an arry in LUA look like and then how can I use the  action.close(stale_list(i)) method to close all these?

     

    I tried: 

    close_list = {"FS98101002-48144","FS98101002-43104","ZF53700518-44387"}
    for i = 0, 2 do
       --print (close_list[i])
       action.close(close_list[i])
    end

     

    But getting:

     

    ----------- Executing script at 12/2/2014 6:20:00 PM ----------

    Error in line 9: bad argument #1 to 'close' (string expected, got nil)



  • 2.  Re: LUA Script: Create array/list of Alert ID's then close them all

    Posted 12-03-2014 03:45 AM

    LUA Arrays start with 1 not 0 I'm guessing

     

    staleList = {"NIMID", "NIMID", "NIMID"}

     

    for staleCount = 1, 3 do

      rc = action.close(staleList[staleCount])

      if (rc == 0) then

         print ("Successfully closed alarm: " .. staleList[staleCount])

      else

         print ("Failed to close alarm: " .. staleList[staleCount])

      end

    end

     

     

    This closed the alarms and returned a code of 0.



  • 3.  Re: LUA Script: Create array/list of Alert ID's then close them all

    Posted 12-03-2014 04:35 PM

    Thank you Bryan!

     



  • 4.  Re: LUA Script: Create array/list of Alert ID's then close them all

    Posted 12-04-2014 04:49 AM

    FYI- You don't need to use a loop for this. The action.close() function accepts a list of IDs. Here is the description from the whitepaper:

     

    action.close ( NimId | NimId-List )
    Closes the open alarm referenced by the single nimid or the list of alarm ids.

     

    I am not sure if the list is a table or a string, but I suspect it is a string of IDs, probably comma-separated.