Page 2 of 3

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 1:19 pm
by epixelitsupport
after changing the value to dont_blame_nrpe=1 I'm getting the output is https://prnt.sc/qcp52t

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 1:52 pm
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?

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 2:58 pm
by epixelitsupport
Please find the output in clinet machine : https://prnt.sc/qcqh77

Re: Host Server Services Restart from Nagios Server

Posted: Wed Dec 18, 2019 3:05 pm
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

Re: Host Server Services Restart from Nagios Server

Posted: Thu Dec 19, 2019 8:02 am
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

Re: Host Server Services Restart from Nagios Server

Posted: Thu Dec 19, 2019 9:15 am
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?

Re: Host Server Services Restart from Nagios Server

Posted: Thu Dec 19, 2019 10:30 am
by epixelitsupport
Yes restarted

Re: Host Server Services Restart from Nagios Server

Posted: Thu Dec 19, 2019 5:11 pm
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

Re: Host Server Services Restart from Nagios Server

Posted: Fri Dec 20, 2019 1:55 am
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?

Re: Host Server Services Restart from Nagios Server

Posted: Fri Dec 20, 2019 8:45 am
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/