nagios事件处理程序重新启动远程服务

我需要使用nagios事件处理程序来重新启动ntp服务。

我重新启动脚本

1: cat /usr/lib64/nagios/plugins/remote-restart

 #!/bin/bash echo "ok" /etc/init.d/ntpd restart echo "done" 

2:用于nrpe.cfg远程入口

 command[check_remote_restart]=/usr/lib64/nagios/plugins/remote-restart 

3:从服务器运行nagios命令

 /usr/lib64/nagios/plugins/check_nrpe -H $HOSTNAME -p 5666 -c check_remote_restart 

输出:

 ok done 

我得到的输出在回声,但仍然ntp服务没有启动。

有人能帮我find灵魂吗?

除非以root用户身份运行NRPE,否则需要通过sudo运行该重新启动命令。