DX Infrastructure Manager

Expand all | Collapse all

Sending SNMP informs for alarms using lua. Is it implemented

  • 1.  Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-10-2014 05:09 PM

    I was thinking if it would be possible to send an inform trap using lua script.

     

    Does anyone know if this has been implemented in the nsa?

     

    Cheers,

     

    Michel



  • 2.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-10-2014 05:40 PM

    There is no built-in support for SNMP in the NAS, but you could use a Lua script to put a message on the message bus for the snmpgtw probe. By default that probe listens for alarm messages, but you can change the subject for which it listens so that it only receives alarms from the script rather than all alarms.



  • 3.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-10-2014 06:47 PM

    I've also used some small trap sending commandline utlity in similar cases. Can't remember it's name, but it's probably easy to find, and definitely easy to use.

     

    -jon



  • 4.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-11-2014 10:17 AM

    Thank you for your replies gentlemen,

     

    We currently use a perl script that listens for specific nas generated messages and then calls a dos cli net-snmp executable to send a trap.

    I'm trying to get to a simpler solution based on fewer components and less dependencies.

    The snmpgtw probe was on my mind but I recently found that we need to use SNMP informs rather than traps.

     

    I came across some documentation that I think originates from this forum that indicates a SNMP class exists in lua.

    I was sort of hoping a update including SNMP informs would exist

     

     

     
    The SNMP class provides the script programmer with built-in SNMPGET and SNMPWALK functionality.
     
    snmp.create (SnmpVersion, TargetHost, … )
    The snmp.create method takes different arguments dependent on the SNMPversion information.
     
    For version 1 and 2:
    snmp.create(1|2,target,community [,oidlist [,options]] )
     
    For version 3:
    snmp.create (3,target,username,password,auth,seclevel [,privprotocol [,privpassword [,oidlist]]] )
     
    This method returns a handle used by the other methods in this class.  The oidlist is a comma or white-space
    separated list of object identifiers.  They will be added to the handle‟s request list, and used by the
    snmp.query method.
     
    snmp. addvariable ( SnmpHandle , Oid)
    Adds the oid to the SnmpHandle request buffer.  Will be used by snmp.query.
     
    snmp. addvariable ( SnmpHandle ,  Format, Type, Data [,Index])
    Adds the oid to the SnmpHandle set buffer.  The Format string is a sprint like formatting string allowing you
    to modify the OIDs used together with the snmp.set.  The Type is one of string, number or time. This usage
    of the addvariable method will be only used by snmp.set.
     
    snmp. delete( SnmpHandle )
    Removes the data-structure associated with SnmpHandle.
     
    snmp.query (SnmpHandle)
    Runs the query against the oidlist specified in the create statement.
     
    snmp. get(SnmpHandle,Oid)
    Requests the Oid from the targethost denoted by the SnmpHandle.  The data is returned as a table.
     
    snmp. set(SnmpHandle)
    Sets the variables added to the handle by snmp.addvariable at the targethost denoted by the SnmpHandle.  
    The data is also returned as a table if successful as well as a return code.
     
    snmp.getnumber (Table|SnmpHandle, Oid)
    Requests a single integer value from the SnmpHandle‟s result buffer, or from the Table returned by
    snmp.walk or snmp.get.
     
    snmp.getstring (Table|SnmpHandle, Oid )
    Requests a single string value from the from the SnmpHandle‟s result buffer, or from the Table returned by
    snmp.walk or snmp.get.
     
    snmp. walk (SnmpHandle, StartingOID, RootPath [, MaxOids])
    Performs a “snmpwalk” starting at the StartingOID, limiting it to the RootPath.  The optional MaxOids
    parameter allows the caller to set the maximum oids returned per request.  The default value is 300.
    The table returned by this function contains the following elements:  numoids,  done, lastoid and oids.   
     



  • 5.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-11-2014 10:28 AM

    Heh, I totally missed the inform bit. If it's not currently implemented, it probably won't be either. I think it's been said that NSA will no longer be developed.. not sure if it's "official", though.

     

    -jon



  • 6.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-11-2014 11:25 AM

    If lua nsa is no longer developed, is another "scripting platform" going to replace it?

     

    I hope it is still clear for all at CA that a scripting language is the glue that makes nimsoft the coherent solution it currrently is.

    If the interfacing with other systems,which a management platform has to do nowadays, has to be done using "one size fits all" tools then it looses its added value.

     

     

     

     



  • 7.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-11-2014 06:20 PM

    There are several other SDKs, so even though I doubt Lua will be replaced directly, other languages are already available. Every once in a while someone from CA will talk about adding new languages--Python and Ruby coming up the most--but that has yet to materialize. And then they decide to get rid of Lua, which is one of the most common scripting languages (based on the number of code-related posts on this forum). It does not make much sense to me.

     

    If your script is already using Perl, you might want to use the Net::smileyfrustrated:NMP module rather than calling the CLI commands.



  • 8.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-11-2014 09:59 PM
      |   view attached

    I wrote a couple lua probes that uses snmpgets to get some metrics I am attaching one of them which is just a simple probe to look at aps ups.

    Attachment(s)

    txt
    lua-snmp.txt   7K 1 version


  • 9.  Re: Sending SNMP informs for alarms using lua. Is it implemented

    Posted 02-12-2014 12:12 PM

    Thanks for the responses,

     

    We will probably invest more time in perl, but despite the perl and other SDK's, the nas can only run lua natively.

     

    I carefuly store all the lua examples for later reference  :-)

     

    Neal,

     

    If you have a working example of sending a trap/inform  I'm very interested to have that as well.

     

     

    Cheers,

     

    Michel