Commit c11149a8 authored by Gabriel Detraz's avatar Gabriel Detraz
Browse files

Ajout du support de monit

parent d4244a09
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2012 OpenWrt.org
START=60
SERVICE_USE_PID=1
start() {
[ -f /etc/monitrc ] || return 1
ls -l /etc/monitrc | grep -q '^-rw-------'
[ $? -eq 0 ] || chmod 0700 /etc/monitrc
service_start /usr/bin/monit
}
stop() {
service_stop /usr/bin/monit
}
###############################################################################
## Monit Cr@ns Config !
###############################################################################
##
## Start Monit in the background (run as a daemon):
#
set daemon 60 # check services at 1-minute intervals
with start delay 30 # optional: delay the first check by 4-minutes (by
# # default Monit check immediately after Monit start)
set logfile syslog facility log_daemon
#set logfile /tmp/monit_log # Test logging
#
## Set the location of the Monit id file which stores the unique id for the
## Monit instance. The id is generated and stored on first Monit start. By
## default the file is placed in $HOME/.monit.id.
#
set idfile /var/.monit.id
# Bind and authorize only to localhost:
set httpd port 2812 and
use address localhost
allow localhost
#
## Set the location of the Monit state file which saves monitoring states
## on each cycle. By default the file is placed in $HOME/.monit.state. If
## the state file is stored on a persistent filesystem, Monit will recover
## the monitoring state across reboots. If it is on temporary filesystem, the
## state will be lost on reboot which may be convenient in some situations.
#
set statefile /var/.monit.state
## Check hostapd
check process hostapd-0 with pidfile /var/run/wifi-phy0.pid
start program = "/usr/sbin/hostapd -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf" with timeout 60 seconds
stop program = "/usr/bin/killall hostapd"
if 5 restarts within 5 cycles then timeout
check process hostapd-1 with pidfile /var/run/wifi-phy1.pid
start program = "/usr/sbin/hostapd -P /var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf" with timeout 60 seconds
stop program = "/usr/bin/killall hostapd"
if 5 restarts within 5 cycles then timeout
check process sshd with pidfile /var/run/dropbear.1.pid
start program "/etc/init.d/dropbear start"
stop program "/etc/init.d/dropbear stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
check program watch_net with path "/usr/share/watch_net/watch_net.sh"
if status != 0 then alert
check process logread with pidfile /var/run/logread.2.pid
start program "/etc/init.d start"
stop program "/etc/init.d stop"
if 5 restarts within 5 cycles then timeout
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment