Host Server Services Restart from Nagios Server

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.
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Host Server Services Restart from Nagios Server

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Server Services Restart from Nagios Server

Post 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/
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Host Server Services Restart from Nagios Server

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Server Services Restart from Nagios Server

Post by scottwilkerson »

Are you sure the service name on the remote host is crond and not just cron or some other variation?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Host Server Services Restart from Nagios Server

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Server Services Restart from Nagios Server

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Host Server Services Restart from Nagios Server

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Server Services Restart from Nagios Server

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Host Server Services Restart from Nagios Server

Post by epixelitsupport »

Please find the attached one

here Dont blame value=0
Attachments
nrpe.cfg
nrpe config file
(12.33 KiB) Downloaded 165 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Server Services Restart from Nagios Server

Post by scottwilkerson »

Change the value to 1

Then restart nrpe
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked