123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- set daemon 120 # check services at 2-minute intervals
- # with start delay 240
- #
- #
- #
- #
- #
- #
- #
- # set logfile syslog facility log_daemon
- set logfile /var/log/monit.log
- #
- #
- #
- #
- #
- #
- # set idfile /var/.monit.id
- set idfile /var/lib/monit/id
- #
- #
- #
- #
- #
- #
- #
- set statefile /var/lib/monit/state
- #
- #
- #
- # will use the second mail server in the list and so on. By default Monit uses
- # port 25 - it is possible to override this with the PORT option.
- #
- # set mailserver mail.bar.baz,
- # backup.bar.baz port 10025,
- # localhost
- #
-
- set mailserver localhost
-
- #
- #
- #
- #
- #
- #
- #
- set eventqueue
- basedir /var/lib/monit/events # set the base directory where events will be stored
- slots 100 # optionally limit the queue size
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- # set mmonit http://monit:monit@192.168.1.10:8080/collector
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- # set mail-format { from: monit@foo.bar }
- #
-
- set mail-format {
- from: monit@{{ domain }}
- subject: monit alert $HOST
- message: $EVENT $SERVICE
- $DESCRIPTION
- }
-
- #
- #
- #
- #
- #
- # set alert sysadm@foo.bar
- # set alert manager@foo.bar only on { timeout }
- #
- #
-
- {% for mail in monit_alert_emails %}
- set alert {{ mail }}
- {% endfor %}
-
- #
- #
- #
- #
- #
-
- set httpd port 2812 and
- use address localhost # only accept connection from localhost
- allow localhost # allow localhost to connect to the server and
- allow {{ monit_admin_username }}:{{ monit_admin_password }}
-
- # allow @monit
- # allow @users readonly
- #
- #
- #
- #
- #
- #
- #
- #
- #
- # check system myhost.mydomain.tld
- # if loadavg (1min) > 4 then alert
- # if loadavg (5min) > 2 then alert
- # if memory usage > 75% then alert
- # if swap usage > 25% then alert
- # if cpu usage (user) > 70% then alert
- # if cpu usage (system) > 30% then alert
- # if cpu usage (wait) > 20% then alert
- #
- #
- #
- #
- #
- #
- #
- #
- # check file apache_bin with path /usr/local/apache/bin/httpd
- # if failed checksum and
- # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
- # if failed permission 755 then unmonitor
- # if failed uid root then unmonitor
- # if failed gid root then unmonitor
- # alert security@foo.bar on {
- # checksum, permission, uid, gid, unmonitor
- # } with the mail-format { subject: Alarm! }
- # group server
- #
- #
- #
- #
- #
- #
- #
- #
- #
- #
- # check process apache with pidfile /usr/local/apache/logs/httpd.pid
- # start program = "/etc/init.d/httpd start" with timeout 60 seconds
- # stop program = "/etc/init.d/httpd stop"
- # if cpu > 60% for 2 cycles then alert
- # if cpu > 80% for 5 cycles then restart
- # if totalmem > 200.0 MB for 5 cycles then restart
- # if children > 250 then restart
- # if loadavg(5min) greater than 10 for 8 cycles then stop
- # if failed host www.tildeslash.com port 80 protocol http
- # and request "/somefile.html"
- # then restart
- # if failed port 443 type tcpssl protocol http
- # with timeout 15 seconds
- # then restart
- # if 3 restarts within 5 cycles then timeout
- # depends on apache_bin
- # group server
- #
- #
- #
- #
- #
- #
- #
- # check filesystem datafs with path /dev/sdb1
- # start program = "/bin/mount /data"
- # stop program = "/bin/umount /data"
- # if failed permission 660 then unmonitor
- # if failed uid root then unmonitor
- # if failed gid disk then unmonitor
- # if space usage > 80% for 5 times within 15 cycles then alert
- # if space usage > 99% then stop
- # if inode usage > 30000 then alert
- # if inode usage > 99% then stop
- # group server
- #
-
- check filesystem rootfs with path /
- if space usage > 80% for 5 times within 15 cycles then alert
- if space usage > 99% then alert
- if inode usage > 80% for 5 times within 15 cycles then alert
- if inode usage > 99% then alert
- group server
-
- #
- #
- #
- #
- #
- # check file database with path /data/mydatabase.db
- # if failed permission 700 then alert
- # if failed uid data then alert
- # if failed gid data then alert
- # if timestamp > 15 minutes then alert
- # if size > 100 MB then exec "/my/cleanup/script" as uid dba and gid dba
- #
- #
- #
- #
- #
- #
- # check directory bin with path /bin
- # if failed permission 755 then unmonitor
- # if failed uid 0 then unmonitor
- # if failed gid 0 then unmonitor
- #
- #
- #
- #
- #
- #
- # check host myserver with address 192.168.1.1
- # if failed icmp type echo count 3 with timeout 3 seconds then alert
- # if failed port 3306 protocol mysql with timeout 15 seconds then alert
- # if failed url http://user:password@www.foo.bar:8080/?querystring
- # and content == 'action="j_security_check"'
- # then alert
- #
- #
- #
- #
- #
- #
- #
- #
- #
-
- include /etc/monit/conf.d/*
- include /etc/monit/monitrc.d/*
|