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

Re: Host Server Services Restart from Nagios Server

Post by epixelitsupport »

after changing the value to dont_blame_nrpe=1 I'm getting the output is https://prnt.sc/qcp52t
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 show the results of running the following on the remote server

Code: Select all

/usr/local/nagios/bin/nrpe
Also, can you tail the syslog on the remote server while attempting your original command from the Nagios server and seeing of you are getting an error?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
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 output in clinet machine : https://prnt.sc/qcqh77
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 »

Ok, this is an Ubuntu machine and I would suspect the same as your other thread is is getting caught up on the special chars, change your command from this

Code: Select all

command[service_restart]=sudo service $ARG1$ restart 2>&1
to this

Code: Select all

command[service_restart]=sudo service $ARG1$ restart| tr -cd '\11\12\15\40-\176' 2>&1
than then restart nrpe
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Host Server Services Restart from Nagios Server

Post by epixelitsupport »

I did the same but still getting the same output
https://prnt.sc/qd25kl

Output from Nagios Server: https://prnt.sc/qd27bb

Client Machine nrpe status: https://prnt.sc/qd27w3
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 »

epixelitsupport wrote:I did the same but still getting the same output
https://prnt.sc/qd25kl

Output from Nagios Server: https://prnt.sc/qd27bb

Client Machine nrpe status: https://prnt.sc/qd27w3
Did you restart nrpe on the remote server?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Host Server Services Restart from Nagios Server

Post by epixelitsupport »

Yes restarted
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 »

This is a bit strange, but you might want to change the command to something like this

Code: Select all

command[service_restart]=/usr/local/nagios/libexec/restart_service.sh $ARG1$
and then create the script /usr/local/nagios/libexec/restart_service.sh

Code: Select all

#!/bin/bash
status=$(sudo service $1 restart)
echo "service $1 restarted"
Set the script to be executable

Code: Select all

chmod +x /usr/local/nagios/libexec/restart_service.sh
And then restart nrpe
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Host Server Services Restart from Nagios Server

Post by epixelitsupport »

okay That one is worked ... SO can i proceed with the Event Handler Script, Do i need to proceed it in the same way or do i need to change anything in it ?
is it possible to handle those commands from my Nagios Core GUI Dashboard itself?
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 »

epixelitsupport wrote:can i proceed with the Event Handler Script, Do i need to proceed it in the same way or do i need to change anything in it ?
Yes, you would proceed in the same way.
epixelitsupport wrote:is it possible to handle those commands from my Nagios Core GUI Dashboard itself?
In Nagios Core, you would need to create the commands manually, there isn't a GUI config. Nagios XI has a GUI config
https://www.nagios.com/products/nagios-xi/
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked