DX Unified Infrastructure Management

  • 1.  String manipulation question for snmptd probe

    Posted Oct 15, 2009 12:52 AM

    In the snmptd probe there is an option to create a nimbus message from snmp traps. Variables are automatically placed in quotation marks and presented in the message text.

    Is there a function within LUA scripting that will allow me to strip the quotation marks and place remaining text back into the message field for snmptd alarms only?

    example message

    "Rw2 Rk17 PDU A"  "Metered Rack PDU: Near overload on phase 1."



  • 2.  String manipulation question for snmptd probe

    Posted Oct 15, 2009 01:58 AM
    We use that probe alot and just putting a custom message in without the quotes or tics in it does the trick.

    Below is a couple of our messages currently active

    Trillion: (snmptd)  Ospf State Change  Neighbour 192.168.93.241  State DOWN:1

    Trillion: (snmptd) MGE UPS entering low condition.


  • 3.  String manipulation question for snmptd probe

    Posted Oct 15, 2009 12:52 PM
    The following snippet does the trick.

    msg = "\"This is a quoted message\" - here is some more."

    printf("before: %s",msg)
    printf("after   : %s", msg:gsub("\"",""))

    ----------- Executing script at 15.10.2009 08:48:50 ----------

      before: "This is a quoted message" - here is some more.
      after   : This is a quoted message - here is some more.

    In a spesific NAS pre-processing rule+script where the filter 'NimBUS Probename'  is 'snmptd':
    event.message = event.message:gsub("\"","")
    return event

    In a general NAS pre-processing script:
    if event.prid == "snmptd" then
       event.message = event.message:gsub("\"","")
    end
    return event

    PS. You could also check out the lua string handling recipes here: http://lua-users.org/wiki/StringRecipes

    Carstein