DX Unified Infrastructure Management

  • 1.  Set Custom_1 variable

    Posted Jun 07, 2018 04:18 AM

    Hi,

    Whats the easiest way to automatically set Custom_1 variable to a predefined value when a specific alarm i triggered?

     

    /Roberth



  • 2.  Re: Set Custom_1 variable

    Broadcom Employee
    Posted Jun 07, 2018 04:29 AM

    Hi

     

    Not the easiest way but you can explore alarm_enrichment 

    How to use the nas and alarm_enrichment probes to enrich alarms 



  • 3.  Re: Set Custom_1 variable

    Broadcom Employee
    Posted Jun 07, 2018 05:12 AM

    Setup a pre-processing rule in the NAS is the easiest way.

     

    Put the following in a script:

    event.custom_5 = "your text"

    return event

     

    And then trigger the script in the pre-processing rule to set your selected alarms with the custom_5 field

     



  • 4.  Re: Set Custom_1 variable

    Posted Jun 11, 2018 03:52 AM

    Hi,

    How/were do I define a simple "pre-processing rule" that do a regex match on alarm messages and if match execute my set custom1 script?



  • 5.  Re: Set Custom_1 variable

    Posted Jun 11, 2018 05:53 AM

    it can be done in NAS probe under pre-processing tab, create a new profile as per your criteria and choose filer type as Custom and choose the custom script as provided by RowanCollis

     

     

     

     

    For more information please go through below link and look for 

    The Pre-Processing Rules Tab

    The nas Auto-Operator Tab - CA Unified Infrastructure Management Probes - CA Technologies Documentation 



  • 6.  Re: Set Custom_1 variable

    Posted Jun 11, 2018 07:00 AM
    So I guess the custom script should contain the below:
    event.custom_1 = "my static info"
    return event
    As I'm going to set different info, depending on different regex'es. Is there a way to either define the both regex and info matching in the custom script or use for example "User Tag 1" in the Rule GUI as my info "input".
    One generic script, like this?
    event.custom_1 = "$User Tag 1"
    return event


  • 7.  Re: Set Custom_1 variable

    Posted Jun 11, 2018 11:18 AM

    you can create multiple profiles under pre processing rules if regex conditions are few, but if the number of regex is large then you need to get this done in LUA script.



  • 8.  Re: Set Custom_1 variable

    Posted Jun 12, 2018 02:46 AM

    Elaborate please. LUA script?



  • 9.  Re: Set Custom_1 variable

    Posted Jun 12, 2018 08:56 AM

    Hi Roberth,

     

    I have not tested this code but you need to play around and modify as per your requirement, this is just an example you can use to start with. this code is written in LUA, code provided by Rowan is also a lua code.

    You can get the required values from the message or probe or subsystem type etc and then on basis of matching criteria, you can populate values to the custom tag.

     

    smessage = string.upper(event.message)
    sprid= string.upper (event.prid)
    stype = string.upper(event.sid)

     

     if stype == "NMS" then
    if (string.find(smessage, string.upper("whatever message text you want to match"))) ~= nil then
    event.custom_5 = "your text1"
    return event
    end
    end


    if (sprid == "SQLSERVER") then

    if (string.find(smessage, string.upper("whatever message to match"))) ~= nil then
    event.custom_5 = "your text2"
    return event
    elseif (string.find(smessage, string.upper(" - match condition 1")) and string.find(smessage , string.upper("match condition 2"))) then
    event.custom_5 = "your text3"
    return event
    end
    end

     

    Note: this code is not tested, should be tested in test environment first.