Client Service needs to restart automatically

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
Vigneshbabun
Posts: 1
Joined: Thu Oct 08, 2020 4:21 am

Client Service needs to restart automatically

Post by Vigneshbabun »

Hi Team,

Actually we have a own microservices with Port Number like 5666. We set to monitor the services through Nagios.
Now we need to restart our services automatically if it is down in our production server. So how can we configure it from Nagios as well as NRPE? It will be useful for us to share the step by step procedure. Can you please share it ASAP.

NOTE: Our servers are running in Linux OS.

Thanks,
Vignesh
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Client Service needs to restart automatically

Post by gormank »

You probably want to look at event handlers in the documentation. The example is a service restart. A web search will point you to it. Read the docs before thinking much about the following...
I think (but don't quote me) that the docs are a bit unclear in that if you want to restart a service on a remote host, you need to define the service restart nagios command on the remote hosts, and create the service restart script on the remote hosts. Then on the nagios host, you define a check_nrpe command to run the service restart command on the remote host. Finally, the event handler is defined for the service check in nagios.
That's probably confusing but should be less so after reading the docs.
Since nagios runs things remotely as nagios by default, you'll most likely need to add a config in /etc/sudoers.d/ to allow nagios to run the service restart script.
Locked