DX Unified Infrastructure Management

  • 1.  Use LUA script to create new alarm based on alarm from AO profile

    Posted Apr 23, 2019 09:24 AM

    Hello,

     

    can somebody help me with creating new alarm based on alarm which meets AO criteria. The point what I want to do is:

     

    - We receive SNMP traps from SCADA system which is not sending CI as standalone variable value.

    - That CI name is part of the message.

    - Because of that it is not possible to map alarm (source) to that CI

    - My intention is to use LUA script to extract (regex) CI from message and create new alarm with all the data the same except the source.

    - Close previous alarm

     

    ps. RowanCollis i have seen your other answers about creating new alarm with LUA, can you help me?

     

    Thank you



  • 2.  Re: Use LUA script to create new alarm based on alarm from AO profile

    Broadcom Employee
    Posted Apr 23, 2019 04:33 PM

    Is the CI in the message always in the same place?

    Have you tried extracting this with the variables in snmptd?

    Failing that you should be able to do what you want in lua. My other posts detail the alarm creation. Which bit do you need help with?



  • 3.  Re: Use LUA script to create new alarm based on alarm from AO profile

    Posted Apr 24, 2019 03:24 AM

    Yes, CI in the message is always in the same place.

    How to extract from the SNMP trap variable, according to the CA Support, that is not possible? If you know something about that please point me.

    Well..., i have never done scripting except some really simple scripts (eg. start/restart/stop service in bash). I understand mostly what is going on in your code, but not why? What in your code must be changed to, for example, make an exact copy of an alarm from AO profile.

     

    Can you please explain this part of the code

     

    Why all of this variables are not filled with values with pds function?

     

    nimid nimts dev_id met_id time_origin time_arrival arrival prevlevel level severity message subsys sid source hostname prid robot hub nas domain origin user_tag1 user_tag2 supp_key suppcount supptime time_supp aots assigned_at assigned_by assigned_to assigned_accept acknowledged_by notes attachment visible escalated auto_remove tz_offset custom_1 custom_2 custom_3 custom_4 custom_5 policy_id i18n_token i18n_dsize i18n_data extensions alarm_manager

     

     

     

    why this, when that data was filled in previously in the code?

    Why introducing this udata? I have seen udata when checking messages with drnimbus. Is this udata.level (why is "level" variable skipped in msg (msg.level)), udata.subsys, udata.message same values as in msg variable (msg.subsys, msg.message)  

     

    -- Add raw alarm data

       udata = pds.create() 

       pds.putInt    (udata,"level",severity)

       pds.putString (udata,"subsys",subsystem)

       pds.putString (udata,"message",message)

      

       pds.putPDS (msg,"udata",udata) -- what is this?

      

       -- Post the message to the hub-spooler

       t,rc = nimbus.request ("spooler","hubpost",msg)  -- why this variables t, rc

     

       pds.delete (udata) - why deleting

       pds.delete (msg)     - why deleting

       return rc,nimid      - why returning, where are they used afterward

     

    end

     

    -- initialize the random generator

    math.randomseed(os.time())       - why this?

     

    This is real scenario captures

     

    alarm

    alarm2

     

    Should I use only variables which are shown here, and which type to use alarm or alarm2. I think that alarm2 are evaluated by AO profile?

     

    The following table is print of alarm.get() of one alarm

    {

    ["time_origin"] = 2019-04-24 11:43:31,

    ["assigned_to"] = uimsduser,

    ["level"] = 5,

    ["aots"] = 1556099023,

    ["change_id"] = 985786C101460AC578E4435CB9E90B1F,

    ["severity"] = critical,

    ["nimts"] = 1556099011,

    ["subsys"] = SCADA,

    ["message"] = HP-EEN-DEA-UGV_DEA2: Emergency stop (StopReq) - Status: 1_ALARM - INCSD,

    ["tz_offset"] = -7200,

    ["nas"] = primary_hub,

    ["prid"] = snmptd,

    ["visible"] = 1,

    ["custom_2"] = pcat:400228,

    ["source"] = scadasrv2,

    ["origin"] = primary_hub,

    ["assigned_at"] = 1556099013,

    ["arrival"] = 1556099012,

    ["supp_key"] = snmptd/.1.3.6.1.6.3.1.1.4.1.0-.1.3.6.1.4.1.27583.1.1.2.0.1,

    ["hostname"] = scadasrv2.intranet.fina.hr,

    ["hub"] = primary_hub,

    ["custom_4"] = 799,

    ["dev_id"] = D515806CD8ADEA6416DDE07028DB73335,

    ["time_arrival"] = 2019-04-24 11:43:32,

    ["i18n_dsize"] = 0,

    ["assigned_by"] = auto-operator,

    ["custom_1"] = scadasrv2,

    ["custom_3"] = intfc:3581,

    ["domain"] = fina_uim,

    ["robot"] = CAUIMPROD1,

    ["custom_5"] = http://CASDPROD:80/CAisd/pdmweb.exe?OP=SEARCH+FACTORY=cr+SKIPLIST=1+QBE.EQ.id=402568,

    ["nimid"] = FG66050762-70488,

    ["met_id"] = M477D12A31023FEE3930594B13D761BAF,

    ["assigned_accept"] = 0,

    ["suppcount"] = 0,

    ["supp_id"] = 2991C27AD97D4C1873E72D24D39DF904,

    ["event_type"] = 0,

    ["sid"] = 2.29,

    }

     

    Thank you