Hi All,
I have installed monit in our environment from a user X. And I want to monitor Apache and restart the Apache, if there is no response. Apache is running from root.
I have also given sudo access to user X to start apache and written a script like below in monitrc, but it is not able to stop/start apache. I am able to re-start apache from user X without using monitrc.
check process apache with pidfile "/opt/apache/logs/httpd.pid"
start = "/usr/bin/sudo /opt/apache/bin/httpd -k start"
stop = "/usr/bin/sudo /opt/apache/bin/httpd -k stop"
if failed host <IP-Address> port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout
Any suggestions??
Thanks,
Amit