$SERVICESTATEID$ Macro

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
klee
Posts: 147
Joined: Fri Apr 04, 2014 2:31 pm

$SERVICESTATEID$ Macro

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: $SERVICESTATEID$ Macro

Post 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
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked