Page 2 of 2

Re: Event Handler for Restart-Service

Posted: Wed Aug 26, 2020 5:56 pm
by kwhogster
benjaminsmith

I thought my event handler logic was simple

Has anyone reviewed my logic?

Does anyone have a working event handler that they can post

Thanks

Re: Event Handler for Restart-Service

Posted: Wed Aug 26, 2020 6:48 pm
by gormank
I won't claim to be good with the event handlers and am following along to educate myself.
From what I can see there's a command to check the service, that runs an EH that runs on the Nagios host that in turn runs the command (via nrpe) on the remote host to do the restart.
One thing is the local command and the remote command have the same name. You might rename the remote command and script to restart_service_win and restart_service_win.cmd. I don't see this as helping, but something is going on that we're missing.
That said, it looks like somehow, on the nagios server, it isn't finding the shell script although it exists. All I can think is there's some slight mistake in the path or something that we're missing.

Re: Event Handler for Restart-Service

Posted: Thu Aug 27, 2020 3:14 pm
by kwhogster
Is there another log we can looks at ???
The nagios log reports this

[1598558394] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;1;CRITICAL: Spooler: stopped delayed ()
[1598558394] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;1;restart_service
[1598558454] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;2;CRITICAL: Spooler: stopped delayed ()
[1598558454] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;2;restart_service
[1598558514] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;3;CRITICAL: Spooler: stopped delayed ()
[1598558514] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;3;restart_service
[1598558574] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;4;CRITICAL: Spooler: stopped delayed ()
[1598558574] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;4;restart_service
[1598558634] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;5;CRITICAL: Spooler: stopped delayed ()
[1598558634] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;5;restart_service
[1598558695] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;6;CRITICAL: Spooler: stopped delayed ()
[1598558695] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;6;restart_service
[1598558754] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;7;CRITICAL: Spooler: stopped delayed ()
[1598558754] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;7;restart_service
[1598558814] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;8;CRITICAL: Spooler: stopped delayed ()
[1598558814] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;8;restart_service
[1598558874] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;SOFT;9;CRITICAL: Spooler: stopped delayed ()
[1598558874] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;SOFT;9;restart_service
[1598558934] SERVICE ALERT: TGKW002;Check All Service;CRITICAL;HARD;10;CRITICAL: Spooler: stopped delayed ()
[1598558934] SERVICE EVENT HANDLER: TGKW002;Check All Service;CRITICAL;HARD;10;restart_service

Re: Event Handler for Restart-Service

Posted: Fri Aug 28, 2020 12:46 pm
by kwhogster
Guys

I tested on the client side by running NSCP TEST from a command prompt after stopping the nscp service.

I monitored the test and saw no activity from the nagios server when a service was stopped.

When I ran the command manually on the nagios service I saw the command on the test console.
So the client is fine it has to be on the nagios server side it looks like the command is not running

Anyway to trace this on the nagios server?

Re: Event Handler for Restart-Service

Posted: Fri Aug 28, 2020 7:32 pm
by kwhogster
Well
I renamed the script and command to restart-aservice.sh and restart-aservice

Same results.

Nagios is not send a request to the nsclient to run the command

Some in Nagios is not correct

Need help.....

Re: Event Handler for Restart-Service

Posted: Tue Sep 01, 2020 9:03 am
by kwhogster
This is still not working.

I am most surely it is on the Nagios side.

The tail command of the nagios log was not helpful

There has be be another log to look at

Any one have this working ? If so please share your files.

Thank you