NCPA service event handler not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

NCPA service event handler not working

Post by HIINNS »

All,

I am currently using Nagios XI 5.7.5 and am trying to set up a service (RLM) to restart when it is not available. I believe I have configured it correctly, and am able to execute the ./check_ncpa.py -H 10.25.14.3 -P 5693 -t Str0ngT0k3n -M 'plugins/restart_service.bat' -a RLM and /usr/local/nagios/libexec/restart_service.sh CRITICAL 10.25.14.3 Str0ngT0k3n RLM from the command line. I added Service Restart - WIndows to Commands as a Misc command type, and checked Active. On the Check Settings tab of the Service I set the Event Handler dropdown as Service Restart - Windows, and set Event handler enabled to On. On the Manage Free Variables window I ser _xwizart to ncpa, and _service to RLM. I turned off the RLM service on the Windows server, and Nagios reports that the service is down. However, the service fails to restart. Am I doing something wrong? I pretty much tried for 6 hours last Friday to get it to work. :cry:
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: NCPA service event handler not working

Post by HIINNS »

I have also checked the /usr/local/nagios/var/nagios.log for errors. Could not find any.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NCPA service event handler not working

Post by ssax »

Please send a copy of your profile.zip, you can download it from Admin > System Profile by clicking the Download Profile button.

Please attach this file:

Code: Select all

/usr/local/nagios/libexec/restart_service.sh
Include the output of this command:

Code: Select all

ls -l /usr/local/nagios/libexec/restart_service.sh
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: NCPA service event handler not working

Post by HIINNS »

Have you received my last post? I sent it this past Wednesday.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NCPA service event handler not working

Post by ssax »

The script expects four arguments but the command is only passing three:

Code: Select all

define command {
    command_name    Service Restart - Windows
    command_line    $USER1$/restart_service.sh $SERVICESTATE$ $HOSTADDRESS$ $_SERVICESERVICE$
}
It should be this:

Code: Select all

define command {
    command_name    Service Restart - Windows
    command_line    $USER1$/restart_service.sh $SERVICESTATE$ $HOSTADDRESS$ 'your_NCPA_token' $_SERVICESERVICE$
}
Try that and see if it resolves the issue.
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: NCPA service event handler not working

Post by HIINNS »

Please feel free to close this case. I finally figured out that the restart_service.sh script did not contain the token.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NCPA service event handler not working

Post by scottwilkerson »

HIINNS wrote:Please feel free to close this case. I finally figured out that the restart_service.sh script did not contain the token.
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked