global_event_handler and macros.

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
noy
Posts: 1
Joined: Sun Feb 12, 2012 4:34 am

global_event_handler and macros.

Post by noy »

Hello everyone,
I've been following Askar Ali Khan's guide to sending snmp traps via nagios.
SNMP traps are sent and everything is fine, but one issue - the $HOSTADDRESS$ macro sometimes outputs the actual IP address, which is great, but sometimes it outputs the host name instead of the address. There are no visible common attributes between the checks, as far as I have seen.

Relevant configuration snippets:

checkcommands.cfg

Code: Select all

# 'send-service-trap' command definition
define command{
      command_name send-service-trap
      command_line /usr/local/bin/send-service-trap hostname public "$HOSTADDRESS$" "$SERVICEDESC$" $SERVICESTATEID$ "$SERVICEOUTPUT$"
}
# 'send-host-trap' command definition
define command{
                command_name send-host-trap
                command_line /usr/local/bin/send-host-trap hostname public "$HOSTADDRESS$" $HOSTSTATEID$ "$HOSTOUTPUT$"
}

nagios.cfg

Code: Select all

global_host_event_handler=send-host-trap
global_service_event_handler=send-service-trap
Any hint will be greatly appreciated, I have been looking at this matter for over two days now, with no useful leads..

Thanks in advance! :)
Locked