DX Unified Infrastructure Management

Expand all | Collapse all

Change alarm fields "custom_1" to "custom_5" by LUA script...

  • 1.  Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 27, 2010 04:54 PM

    Hi,

     

    I have to change some alarm fields with a LUA script in AO or preprocessing rules.

     

    I can change most of the alarm fields by using the raw_alarm-script posted by Carsten.

     

    E.g. for changing User Tag 1 I use pds.putString(msg,"user_tag_1","<Usertag_1>") ... and it works as expected.

     

    For changing the "custom_1" to "custom_5" fields I tried pds.putString(msg,"custom_1","<Custom_1>"), ... custom1, .... custom_tag_1, ...custom_tag1 a.s.o. With Dr. Nimbus I saw my String in the message header but the fields in the database NAS_ALARMS resp. in the alarmconsole are unset / empty.

     

    What's the trick?

     

    Regards,

    Olaf



  • 2.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...
    Best Answer

    Posted May 27, 2010 05:36 PM

    Olaf,

     

    I do not know the answer to this, but have you tried putting the custom_1 field inside the (inner) udata PDS rather than the (outer) msg PDS to see if it comes through on the NAS then? It might work.

     

    And you are running a version of the NAS that supports the custom fields, right? :smileyhappy: Just checking...

     

    -Keith



  • 3.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 27, 2010 06:42 PM
    Hi Keith,

    that's it - i put the custom_1 field inside the (inner) udata PDS structure and now the custom_1 field apears. I thought that this custum_x fields would be on the same level (outside) as the user_tag_x fields.

    Thanks a lot,

    Olaf


  • 4.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 27, 2010 06:46 PM

    I have tried this as well to no avail, I don't think it's supported yet maybe in future release?



  • 5.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 27, 2010 06:48 PM

    I guess I should have refreshed page first thank for the update keith, does it only work using the pds?  I tried setting in a preprocess lua script.



  • 6.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 27, 2010 06:50 PM

    Neal,

     

    The NAS 3.41 whitepaper indicates that you can set the custom_X fields in pre-processing scripts, but I have not tried it.

     

    -Keith



  • 7.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 28, 2010 12:16 PM

    The custom_1 to custom_5 fields are, as Keith correctly points out, part of the udata (not the header data) in the incomming raw alarm message.  You can modify the custom fields as part of a pre-processing as well as post-processing script.

    The API's have been modified to allow for these fields as part of the nimAlarm (or equivalent) functions.

     

    You may alter the heading (used by IM and the NAS UI) for these fields by adding the following section to the nas.cfg:

     

    <setup>

        <custom_headers>

                 custom_1 = Troubleticket

                 custom_2 = Customer Id.

        </custom_headers>

    </setup>

     

    The above configuration will instruct UI's to replace custom_1 with Troubleticket.  This is documented in the NAS tech brief. in the Configuration and Data File section.

     

    Carstein



  • 8.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 28, 2010 02:06 PM

    Carstein,

     

    Good info! Thanks.

     

    Is there a callback that would allow us to set the values of the custom fields from an external script/probe? Our integration wth HP Service Desk is handled by a Perl probe, and it currently uses the assignment field to track ticket IDs. I would be very interested in using one of the custom fields, but the Perl script would have to be able to set it.

     

    If there is no callback for setting the custom fields, I was thinking we could use the script_run callback, but it does not look like that takes an argument.

     

    Thanks,

    Keith



  • 9.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 28, 2010 02:52 PM

    Keith,

     

    Try set_alarm with token=custom_1 value=MyValue nimid=<nimid>

     

    C



  • 10.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted May 29, 2010 04:58 AM

    Thanks all I now how some future coding to do after a vacation.  The many things that can be done.



  • 11.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Nov 01, 2011 06:32 PM

    How Can the Headers name be changed on the Alarm Console in the UMP for the Custom Fields?



  • 12.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Nov 01, 2011 06:43 PM

    The following example configuration settings can be applied to nas.cfg:

     

    <setup>

        <custom_headers>

                 custom_1 = Troubleticket

                 custom_2 = Customer Id.

        </custom_headers>

    </setup>

     

    This information was posted by Carstein in an earlier message in this thread. See above for the original message.



  • 13.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Nov 01, 2011 07:06 PM

    Does this work for the UMP Alarm Console also?



  • 14.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Nov 01, 2011 07:13 PM

    Yes.



  • 15.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Jun 02, 2010 12:14 AM

    Where do you find the NAS 3.41 whitepaper?  I can only find v3.28.

    Thanks



  • 16.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Jun 02, 2010 12:35 AM

    Hi to all,

    first of all - thanks a lot for all the useful information about the custom tags (special thanks to Carsten and Keith).

    I would like to join the question of swright: Where can we find all the technical docs and whitepapers?

    Idea: Create a seperate section in the forum and put all these paper in it - and we are all happy :smileyhappy:

    Regards,
    Olaf



  • 17.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Jun 16, 2010 12:27 AM

    With the new version of nas 3.43 is their a way to set these fields using alarm.set()  I have a script that generates ticket in our system and would like to write the ticket number in one of these fields after the ticket is created.



  • 18.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Jun 16, 2010 12:42 AM

    Here is a part of a script I use to do something similar:

     

    --SetAlarm
    --
    -- This will add or change values of an alarm within the NAS calling the set_alarm command within the NAS
    almid = "FC41908546-82536"
    attr = "custom_1"
    --val = SCRIPT_NAME
    val = "TICKET1234"
    nasaddr="/Enterprise/MONIMBUSP/monimbusp/nas"
    sa_pds = pds.create()
    pds.putString (sa_pds,"token",attr)
    pds.putString (sa_pds,"value",val)
    pds.putString (sa_pds,"nimid",almid)
    result,rc = nimbus.request(nasaddr,"set_alarm",sa_pds)
    printf("RC is %d",rc)
    pds.delete(sa_pds)



  • 19.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Jun 16, 2010 10:50 AM

    I will encourage the use of the internal alarm.set() method when you are executing scripts from within the NAS sandbox. The example script shows how to set the custom_1 and custom_2 fields from a script that is called in an AO profile (on arrival).

     

    curr = alarm.get()

     

    a = {

      nimid         = curr.nimid,

      custom_1 = "SOME-INFO",

      custom_2 = "SOME-MORE-INFO"

    }

     

    alarm.set(a)

     

    You could also do

     

    curr = alarm.get()

    curr.custom_1 = "SOME-INFO"

    curr.custom_2 = "SOME-MORE-INFO"

    alarm.set(curr)

     

    The last approach may seem to do the same thing, but actually the curr variable holds the entire alarm record and presents the whole record for update instead of just the "dirty" fields.

     

    Carstein

     



  • 20.  Re: Change alarm fields "custom_1" to "custom_5" by LUA script...

    Posted Jun 16, 2010 04:42 PM

    Thanks carstein I was hoping that was available the later method worked great in my case cause I allready called alarm.get()