DX Infrastructure Manager

Expand all | Collapse all

Need some ideas on Lua

  • 1.  Need some ideas on Lua

    Posted 04-19-2018 10:57 AM

    I've a situation where there is need to pre-process some alarms through lua

    So, there are 2 servers send same alarms from logmon several times a week since they handle the same application.

    Now I would like to suppress alarms from 1 server if there is a match on probe, subsystem and message.

    Need some suggestions and if someone has such an implementation can guide too.
    Other alternative are also welcome

  • 2.  Re: Need some ideas on Lua

    Posted 04-19-2018 10:54 PM



    Something like this should work if i understood your need

    local prid = "logmon"
    local subsys = "1.1"
    local match = string.match
    local pattern = ".*Failed\sto\sget.*"
    local aoAlarm = alarm.get()

    if aoAlarm.prid == prid and aoAlarm.sid == subsys and match(aoAlarm.message, pattern) then


    Put this script on AO. And it should "close" any alarm that come and match these three conditions. You can test this script by executing the script yourself (just give a "nimid" in the alarm.get() ).


    If you want to dump complete hash use this

    local function tdump(t)
        local search = pairs;
        local sf = string.format;
        local sr = string.rep;
        local perf_type = type;
        local ts = tostring;
        local function dmp(t, l, k)
            if perf_type(t) == "table" then
                print(sf("%s%s:", sr(" ", l*2), ts(k)));
                for k, v in search(t) do
                    dmp(v, l+1, k);
                print(sf("%s%s:%s", sr(" ", l*2), ts(k), ts(t)));
        dmp(t, 1, "root");


    And use it to dump the aoAlarm hash:



    Best Regards,