DX Unified Infrastructure Management

 View Only
Expand all | Collapse all

Lua Pre-Processing

  • 1.  Lua Pre-Processing

    Posted Dec 12, 2019 08:32 AM

    I would like to know if it is possible to update robot name via a Lua Script in a Pre-Processsing rule.

    If this is the possible then are there any examples available 



  • 2.  RE: Lua Pre-Processing

    Broadcom Employee
    Posted Dec 12, 2019 08:47 AM
    Yes. Do you want to change the robot name to a different name or change the robot name to a different format, e.g., short hostname vs. FQDN?

    Steve

    ------------------------------
    Support Engineer
    Broadcom
    US
    ------------------------------



  • 3.  RE: Lua Pre-Processing

    Posted Dec 12, 2019 08:55 AM

    Thanks Stephen

    I would like it to be changed to different name




  • 4.  RE: Lua Pre-Processing

    Broadcom Employee
    Posted Dec 12, 2019 08:55 AM
    Please see the below information on what can be modified in the pre-processing lua scripting:
    http://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/it-operations-management/ca-unified-infrastructure-management-probes/GA/alphabetical-probe-articles/nas-alarm-server/the-nas-extensions-to-lua-all-versions/language-extensions.html

    Custom Pre-Processing
    The event table is placed into the Lua context prior to executing the "custom" pre-processing rule. You may alter (launder) the event by setting these fields: message, level, sid, source, hostname, user_tag1, user_tag2, visible, custom_1 through _5, supp_key, and origin. The following fields are present for the script to use:
    .source     - source of the alarm (typically ip-address)    
    .hostname       - resolved name (robotname or ip-address to name resolution)    
    .level      - severity level (0-5)  
    .sid        - subsystem identification. 
    .message        - alarm message text.   
    .origin     - origin of the alarm (stamped by nearest hub, or in some cases the robot.) 
    .domain     - name of originating domain.   
    .robot      - name of the sending robot.    
    .hub        - name of the nearest hub to the sending robot. 
    .prid       - name of probe issuing the alarm.  
    .user_tag1      - user tag 1 (as set by robot). 
    .user_tag2      - user tag 2 (as set by robot). 
    .supp_key       - suppression identification key.   
    .visible        - flag for visibility (true = visible)  

    see the below KB article on changing fields in lua script:
    https://ca-broadcom.wolkenservicedesk.com/external/article?articleId=34318

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 5.  RE: Lua Pre-Processing

    Posted Dec 12, 2019 09:21 AM
    I'm not sure if this is right but when I set
     event.robot="Test"

    I do see in nas logs

    Dec 12 15:17:17:414 [2916] 0 nas: SCRIPT: robot:Test
    Dec 12 15:17:17:414 [2916] 0 nas: SCRIPT: hostname:10.3.203.69

    But my message in IM still has the old robot name (UIM 9.20)


  • 6.  RE: Lua Pre-Processing

    Broadcom Employee
    Posted Dec 12, 2019 09:37 AM
    so the robot name can not be updated with pre-processing the hostname can. To update the robot field you would need to use alarm_enrichment.

    this is the simple test script I created
    print("Start of test")
    print ("robotname1:"..event.robot)
    event.robot = "test-robot"
    print ("robotname2:"..event.robot)
    print ("hostnamename1:"..event.robot)
    event.hostname = "test_hostname" -- and so on for _3 through _5
    print ("hostnamename2:"..event.robot)
    return event

    can you provide more insight into why you need to change the alarm on the individual alarm rather than at the robot level?

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 7.  RE: Lua Pre-Processing

    Posted Dec 13, 2019 03:50 AM

    We would like to receive alarms from external monitoring systems by using the UIM

    Rest API. In order to create a high availability solution we have deployed two wasp UIMAPI services which are Load balanced with a Master Slave http setup.

     

    The problem we observed is that when you create an alarm via the rest API the robot field is ignored since the service is using nimalarm and therefor it sets the robot name to the wasp computer name.

     

    This complicates the alarm correlation since alarm events arrive with from two different wasp robots.

     

    That is why we tried to change the robot name in the pre proc rule by setting the robot name equal to the source field.

     

    We also tried to create a AO rule which would close the alarm and recreate a rawalarm with the robot name set to the source.

     

    However closing the original alarm will prevent the AO to be triggered when a green alarm is send.

     

    Not closing the alarm but creating a new alarm is working if the alarms are received from one wasp.

     

    It would fail if there is an active alarm from wasp uimapi 1 and the slave would be active receiving the green alarm.

     

    I hope you have a solution ?

     

    Or do you think that the rest api should support the robot name as it implies in the documentation.




  • 8.  RE: Lua Pre-Processing

    Posted Dec 13, 2019 04:22 AM
    Edited by Luc Christiaens Dec 13, 2019 04:56 AM
    With the webservices_rest package/interface and with uimapi you can override hostname and source


  • 9.  RE: Lua Pre-Processing

    Posted Dec 13, 2019 07:59 AM

    Hi,

     

    I am a colleague of Abhishek and we want to achieve the following.

     

    We would like to receive alarms from external monitoring systems by using the UIM

     Rest API. In order to create a high availability solution we have deployed two wasp UIMAPI services which are Load balanced with a Master Slave http setup.

     

    The problem we observed is that when you create an alarm via the rest API the robot field is ignored since the service is using nimalarm and therefor it sets the robot name to the wasp computer name.

     

    This complicates the alarm correlation since alarm events arrive with from two different wasp robots.

     

    That is why we tried to change the robot name in the pre proc rule by setting the robot name equal to the source field.

     

    We also tried to create a AO rule which would close the alarm and recreate a rawalarm with the robot name set to the source.

     

    However closing the original alarm will prevent the AO to be triggered when a green alarm is send.

     

    Not closing the alarm but creating a new alarm is working if the alarms are received from one wasp.

     

    It would fail if there is an active alarm from wasp uimapi 1 and the slave would be active receiving the green alarm.

     

    I hope you have a solution ?

     

    Or do you think that the rest api should support the robot name as it implies in the documentation.

    Best Regards,
    Hans Neesen




  • 10.  RE: Lua Pre-Processing

    Posted Dec 13, 2019 09:33 AM
    Hi Gene,

    I am a working together with of Abhishek and we are tring to solve the following problem.

    We want to allow receiving alarms from external monitoring systems via the wasp uimapi, however we noticed that the rest call ignores the robot field since internally it uses nimalarm to create the alarm. so the robot name is set to name of the robot where the wasp is running.
    Since we want to have a high availability solution we have installed two wasp uimapi services with a Master slave LB http setup.
    No we noticed that the alarm correaltion doesn't work in case that the Master send a alarm and the slave would take over and it would receive an clear alarm from the same source.

    We have therefor tried to change the alarm robot in prepro script and we tried with a AO rule to recreate new alarm with rawalarm and close the original alarm.

    However the later option will never receive a trigger when the green alarm is sent because the correlation didn't find a open active alarm.

    Not closing the original alarms also doesn't work when the Master has been taken over by the Slave and pending alarms are active.

    Any ideas how to solve this?


  • 11.  RE: Lua Pre-Processing

    Broadcom Employee
    Posted Dec 13, 2019 01:16 PM
    the only way you will be able to do this is with the alarm_enrichment process.
    http://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/it-operations-management/ca-unified-infrastructure-management-probes/GA/alphabetical-probe-articles/nas-alarm-server/alarm-enrichment-raw-configuration.html

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 12.  RE: Lua Pre-Processing
    Best Answer

    Posted Dec 12, 2019 09:38 AM
    Edited by Diane Craddock Dec 13, 2019 09:33 AM
    Only the fields: message, level, sid, source, hostname, user_tag1, user_tag2, visible, custom_1 through _5, supp_key, and origin
    are permitted to change (in a lua pre-processing script)