nagios

CHANGE_SVC_EVENT_HANDLER External Command Failed


Im having no luck with this external command:

/usr/bin/printf "[%lu] CHANGE_SVC_EVENT_HANDLER;<HOST>;<SERVICE>;ack_service\n" >> /usr/local/nagios/var/rw/nagios.cmd

Nagios.log shows:

[1647021762] EXTERNAL COMMAND: CHANGE_SVC_EVENT_HANDLER;<HOST>;<SERVICE>;ack_service
[1647021762] Error: External command failed -> CHANGE_SVC_EVENT_HANDLER;<HOST>;<SERVICE> ack_service
[1647021762] External command [1647021762] CHANGE_SVC_EVENT_HANDLER;<HOST>;<SERVICE>;ack_service returned error Command failed

I am submitting other external commands in the same way with no problems. For the service Im using, --Event Handler (EH) is enabled. --I have an existing EH which differs from the one Im trying to switch to. In nagios.cfg I have check_external_commands=1

Any thoughts?

The debug log isnt any help either:

[1647022292.354006] [256.2] [pid=10560] Read 78 bytes from command worker
[1647022292.354040] [256.1] [pid=10560] Read raw external command '[1647021762] CHANGE_SVC_EVENT_HANDLER;<HOST>;<SERVICE>;ack_service'
[1647022292.354045] [001.0] [pid=10560] process_external_command1()
[1647022292.354049] [128.2] [pid=10560] Raw command entry: [1647021762] CHANGE_SVC_EVENT_HANDLER;<HOST>;<SERVICE>;ack_service
[1647022292.354094] [064.1] [pid=10560] Making callbacks (type 2)...
[1647022292.354100] [064.2] [pid=10560] Callback #1 (type 2) return code = 0
[1647022292.354104] [064.1] [pid=10560] Making callbacks (type 17)...
[1647022292.354107] [064.2] [pid=10560] Callback #1 (type 17) return code = 0
[1647022292.354110] [001.0] [pid=10560] process_external_command2()
[1647022292.354113] [128.1] [pid=10560] External Command Type: 126
[1647022292.354116] [128.1] [pid=10560] Command Entry Time: 1647021762
[1647022292.354119] [128.1] [pid=10560] Command Arguments: <HOST>;<SERVICE>;ack_service
[1647022292.354130] [064.1] [pid=10560] Making callbacks (type 2)...
[1647022292.354133] [064.2] [pid=10560] Callback #1 (type 2) return code = 0
[1647022292.354136] [064.1] [pid=10560] Making callbacks (type 17)...
[1647022292.354139] [064.2] [pid=10560] Callback #1 (type 17) return code = 0
[1647022292.354151] [064.1] [pid=10560] Making callbacks (type 2)...
[1647022292.354154] [064.2] [pid=10560] Callback #1 (type 2) return code = 0
[1647022292.354157] [4096.2] [pid=10560] ## 1 descriptors had input

Solution

  • Well here's the reason. Would have been nice if the error indicated what's going on!

    https://github.com/NagiosEnterprises/nagioscore/commit/3207e91193cb507401858a6136fc6e3fc257a236

    The following macros are disabled: CHANGE_GLOBAL_HOST_EVENT_HANDLER CHANGE_GLOBAL_SVC_EVENT_HANDLER CHANGE_HOST_EVENT_HANDLER CHANGE_SVC_EVENT_HANDLER CHANGE_HOST_CHECK_COMMAND CHANGE_SVC_CHECK_COMMAND