Forward Incoming traps to external application

Started by tamal_g, October 22, 2013, 10:15:58 AM

Previous topic - Next topic

tamal_g

Hi,
I have a perl script which accepts SNMP traps as standard input. I want the incoming traps in NetXMS forward to that particular perl script. I want to call standard dos batch file from Netxms ver 1.2.9 with SNMP traps as input parameters which will invoke the perl script and pass on the same trap information for further processing.

Thanks   

Victor Kirhenshtein

Hi!

All SNMP traps are converted into events in NetXMS server. All you have to do is to call external script from event processing policy as a reaction to these trap-originated events. You can define "execute command on management server" action to call local script on NetXMS server.

Best regards,
Victor

tamal_g

Thanks Victor,

As you suggested I have already converted my incoming traps into events. I have written a test script which will print "Hello" and I have added that action from event processing policy. But I am not able to see the output of the script. Can you please guide me where I could see the console output as "Hello" (it is not showing in "Server Console").

Thanks
Tamal

tamal_g

Hi Victor,

I want to run a batch file with a trap event which I have already configured in "Event Processing Policy". I have selected the option "Execute command on management server" and have put the command line as "cmd.exe /C Test.bat" (which is my test batch file located in system folder). But unfortunately this batch file is not executed with the configured event.

Can you provide some tips to run this?

Thanks,
Tamal

Victor Kirhenshtein

Hi!

I suggest to run server with debug level 4 or higher and check server log. Maybe there are errors at command execution, or it is not executed at all. You can change debug level in run time by opening server debug console (from Tools->Server Console menu) and entering command debug 5 (or whatever debug level you need).

Best regards,
Victor

tamal_g

Thanks Victor,

Fortunately I could run my batch file from the command line. Actually the bat file was executed but I was unable to see the command window, so I have checked the option "Allow service to interact with desktop" of NetXMS core service properties and by doing that it worked.
Now I want to pass the incoming SNMP trap as a whole including the variable bindings into my batch file as input parameters. I have tried by using some macros but till now no luck.
Can you please suggest the steps which I should follow so that I can get the whole trap in my bat file.

Thanks.
Regards,
Tamal

Victor Kirhenshtein

You have to get all bindings from trap into event, then you can use macros %2, %3, and so on to insert values of those varbinds into script command line. You can check interface up/down traps to see how varbinds are mapped to event parameters.

Best regards,
Victor

tamal_g

I understand that fact and I have already configured it like what you suggested. But my problem is I cannot get the text value which is actually associated with a particular variable in my MIB file. For example when SNMP trap is coming from my device in NetXMS I cant get the value of the variable (say 'status') of that particular trap as '4' . In the MIB file this status object is defined as if value is '4' then it should send value as 'highcritical' that is what I am not able to get.
Can you help to to get that and also how can I associate an object defined in my MIB file with a newly created node.

Thanks in advance.