Page 1 of 3

Host Server Services Restart from Nagios Server

Posted: Sat Dec 14, 2019 6:39 am
by epixelitsupport
Is it possible to restart services which are running in Host servers from Nagios Server?
Please let me know the solution if the above one works

Re: Host Server Services Restart from Nagios Server

Posted: Mon Dec 16, 2019 8:37 am
by scottwilkerson
You can with event handlers if you have agents installed.

Here are a few guides on how to do that, the guides are written for Nagios XI but you can apply the same methods to Nagios Core
https://library.nagios.com/library/prod ... nagios-xi/

Re: Host Server Services Restart from Nagios Server

Posted: Tue Dec 17, 2019 1:30 am
by epixelitsupport
I'm Using Nagios Core for checking the services, When I trying to start configuring above service I'm getting an error like this https://prnt.sc/qbv9i0 while I'm accessing client machine from Nagios server

Please let me know the solution

Re: Host Server Services Restart from Nagios Server

Posted: Tue Dec 17, 2019 7:21 am
by scottwilkerson
Are you sure the service name on the remote host is crond and not just cron or some other variation?

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 1:50 am
by epixelitsupport
Yea I tried in client server there I'm getting the output when I'm trying with the command


Trying from Nagios Server to the Client Machine: https://prnt.sc/qce05z


In the Client machine: https://prnt.sc/qce0x6

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 7:22 am
by scottwilkerson
Can you share the command specified for restart_service in the nrpe.cfg as well as the script you are running in that command

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 10:46 am
by epixelitsupport
As you are mentioned in the Document, I'm following the same


This is what I m added in the nrpe.cfg file in the client machine: https://prnt.sc/qcmtbr

This is the script im running from the Nagios Server: /usr/local/nagios/libexec/check_nrpe -H XX.X.X.X -p 5666 -c service_restart -a cron

And i didn't create a Create Event Handler Script since I'm not getting a proper output from the above commands as mentioned in the Document

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 11:49 am
by scottwilkerson
Can you share your whole nrpe.cfg from the remote machine, we need to see if you have

Code: Select all

dont_blame_nrpe=1

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 1:11 pm
by epixelitsupport
Please find the attached one

here Dont blame value=0

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 1:17 pm
by scottwilkerson
Change the value to 1

Then restart nrpe