Page 1 of 1

$SERVICESTATEID$ Macro

Posted: Fri Apr 04, 2014 2:49 pm
by klee
Hello,

We created a command in Nagios CCM called "send_snmptrap" which contains the following line:

/usr/bin/snmptrap -v 2c -c public 10.10.10.99 '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "$HOSTNAME$" nSvcDesc s "$SERVICEDESC$" nSvcStateID i $SERVICESTATEID$ nSvcOutput s "$SERVICEOUTPUT$"

We are trying to configure an Event Handler to use the $SERVICESTATEID$ macro to pass the actual state of a Service Event via snmptrap.

Currently, the macro $SERVICESTATEID$ is not returning with a value (integer) for this service check command. If we replace the macro with a static value, e.g. 1, then the trap message arrives as expected. Otherwise, the event never makes it to the SNMP logs. We understand that not all macros may be "valid" in a particular type of command. However, the MACRO $SERVICESTATEID$ is supposed to be valid for Service Event Handlers.

Can someone please advise?

Thanks,

KLee

Re: $SERVICESTATEID$ Macro

Posted: Mon Apr 07, 2014 2:22 pm
by sreinhardt
What version of XI are you on presently? Have you tried having this echoed to a temp file like so?
EDIT: Create a new command for the following and then run it and check /tmp/test:

Code: Select all

/bin/echo nSvcHostname s "$HOSTNAME$" nSvcDesc s "$SERVICEDESC$" nSvcStateID i $SERVICESTATEID$ nSvcOutput s "$SERVICEOUTPUT$" >> /tmp/test
Topic was locked, but solution is here - http://support.nagios.com/forum/viewtop ... 557#p94557