WRT Router Series Monit: Difference between revisions
mNo edit summary |
|||
| Line 33: | Line 33: | ||
If configured in the manner described in the Configuration File(s) for Monit Service section, each of the following example can be placed in a separate text file in the /etc/monit.d directory. | If configured in the manner described in the Configuration File(s) for Monit Service section, each of the following example can be placed in a separate text file in the /etc/monit.d directory. | ||
Apache Example;<syntaxhighlight lang="text"> | Apache Example; | ||
<syntaxhighlight lang="text"> | |||
check process httpd with pidfile /tmp/run/apache2/httpd.pid | check process httpd with pidfile /tmp/run/apache2/httpd.pid | ||
start program "/etc/init.d/apache2 start" | start program "/etc/init.d/apache2 start" | ||
| Line 39: | Line 40: | ||
restart program "/etc/init.d/apache2 restart" | restart program "/etc/init.d/apache2 restart" | ||
if 5 restarts within 5 cycles then timeout | if 5 restarts within 5 cycles then timeout | ||
</syntaxhighlight>BIND / NAMED Example; | </syntaxhighlight> | ||
BIND / NAMED Example; | |||
DHCPC Example | <syntaxhighlight lang="text"> | ||
<syntaxhighlight lang="text"> | |||
MySQL Example | check process named with pidfile /tmp/run/named/named.pid | ||
start program "/etc/init.d/named start" | |||
stop program "/etc/init.d/named stop" | |||
restart program "/etc/init.d/named restart" | |||
if failed host 192.168.2.1 port 53 type tcp protocol dns then restart | |||
if failed host 192.168.2.1 port 53 type udp protocol dns then restart | |||
if 5 restarts within 5 cycles then timeout | |||
</syntaxhighlight> | |||
DHCPC Example; | |||
check process dhcpd with pidfile /tmp/run/dhcpd.pid | |||
start program "/etc/init.d/dhcpd start" | |||
stop program "/etc/init.d/dhcpd stop" | |||
restart program "/etc/init.d/dhcpd restart" | |||
if failed host 192.168.2.1 port 67 type udp then restart | |||
if 5 restarts within 5 cycles then timeout | |||
</syntaxhighlight> | |||
MySQL Example; | |||
<syntaxhighlight lang="text"> | |||
check process mysqld with pidfile /tmp/run/mysqld/mysqld.pid | |||
start program "/etc/init.d/mysqld start" | |||
stop program "/etc/init.d/mysqld stop" | |||
restart program "/etc/init.d/mysqld restart" | |||
if failed unixsocket /tmp/run/mysqld/mysqld.sock then restart | |||
if 5 restarts within 5 cycles then timeout | |||
</syntaxhighlight> | |||
===Notifications & Alerts=== | ===Notifications & Alerts=== | ||
The Monit service can also send email notifications and alerts. This can get annoying over time, but it is useful if troubleshooting or monitoring a process. The annoyance can also be "reigned in" to a certain degree. | The Monit service can also send email notifications and alerts. This can get annoying over time, but it is useful if troubleshooting or monitoring a process. The annoyance can also be "reigned in" to a certain degree. | ||