I Need to use the nagios event handler to restart ntp services.
My restart scripts
1: cat /usr/lib64/nagios/plugins/remote-restart
#!/bin/bash
echo "ok"
/etc/init.d/ntpd restart
echo "done"
2: remote entry for nrpe.cfg
command[check_remote_restart]=/usr/lib64/nagios/plugins/remote-restart
3: run the nagios command from server
/usr/lib64/nagios/plugins/check_nrpe -H $HOSTNAME -p 5666 -c check_remote_restart
output:
ok
done
I am getting the output as in echo but still ntp service is not started.
Can somebody help me to find the soultion .
Best Answer
Unless you're running NRPE as root, you'll need to run that restart command through sudo.