Skip to content

Commit

Permalink
Begin migration of monit from NEMS 1.3.1 to NEMS 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Cat5TV committed May 21, 2018
1 parent 12f13b4 commit bee94b6
Show file tree
Hide file tree
Showing 20 changed files with 652 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/1.4/monit/conf-available/acpid
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
check process acpid with pidfile "/var/run/acpid.pid"
group system
group acpid
start program = "/etc/init.d/acpid start"
stop program = "/etc/init.d/acpid stop"
if 5 restarts within 5 cycles then timeout
depends on acpid_bin
depends on acpid_rc

check file acpid_bin with path "/usr/sbin/acpid"
group acpid
include /etc/monit/templates/rootbin

check file acpid_rc with path "/etc/init.d/acpid"
group acpid
include /etc/monit/templates/rootbin
17 changes: 17 additions & 0 deletions data/1.4/monit/conf-available/apache2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
check process apache with pidfile /var/run/apache2/apache2.pid
group www
group apache
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if 4 restarts within 20 cycles then timeout
if failed host localhost port 80 with protocol http and request "/server-status" with timeout 25 seconds for 4 times within 5 cycles then restart
depend apache_bin
depend apache_rc

check file apache_bin with path /usr/sbin/apache2
group apache
include /etc/monit/templates/rootbin

check file apache_rc with path /etc/init.d/apache2
group apache
include /etc/monit/templates/rootbin
16 changes: 16 additions & 0 deletions data/1.4/monit/conf-available/at
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
check process atd with pidfile "/var/run/atd.pid"
group system
group atd
start program = "/etc/init.d/atd start"
stop program = "/etc/init.d/atd stop"
if 5 restarts within 5 cycles then timeout
depends on atd_bin
depends on atd_rc

check file atd_bin with path "/usr/sbin/atd"
group atd
include /etc/monit/templates/rootbin

check file atd_rc with path "/etc/init.d/atd"
group atd
include /etc/monit/templates/rootbin
23 changes: 23 additions & 0 deletions data/1.4/monit/conf-available/cron
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
check process crond with pidfile /var/run/crond.pid
group system
group crond
start program = "/etc/init.d/cron start"
stop program = "/etc/init.d/cron stop"
if 5 restarts with 5 cycles then timeout
depend cron_bin
depend cron_rc
depend cron_spool

check file cron_bin with path /usr/sbin/cron
group crond
include /etc/monit/templates/rootbin

check file cron_rc with path "/etc/init.d/cron"
group crond
include /etc/monit/templates/rootbin

check directory cron_spool with path /var/spool/cron/crontabs
group crond
if failed permission 1730 then unmonitor
if failed uid root then unmonitor
if failed gid crontab then unmonitor
21 changes: 21 additions & 0 deletions data/1.4/monit/conf-available/mdadm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
check process mdadm with pidfile /var/run/mdadm/monitor.pid
group system
group mdadm
start program = "/etc/init.d/mdadm start"
stop program = "/etc/init.d/mdadm stop"
if 5 restarts with 5 cycles then timeout
depend mdadm_bin
depend mdadm_rc
depend mdadm_conf

check file mdadm_bin with path /sbin/mdadm
group mdadm
include /etc/monit/templates/rootbin

check file mdadm_conf with path /etc/mdadm/mdadm.conf
group mdadm
include /etc/monit/templates/rootrc

check file mdadm_rc with path "/etc/init.d/mdadm"
group mdadm
include /etc/monit/templates/rootbin
19 changes: 19 additions & 0 deletions data/1.4/monit/conf-available/memcached
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
check process memcache with pidfile /var/run/memcached.pid
group cache
group memcached
start program = "/etc/init.d/memcached start"
stop program = "/etc/init.d/memcached stop"
if failed host 127.0.0.1 port 11211 and protocol memcache then restart
if cpu > 60% for 2 cycles then alert
if cpu > 98% for 5 cycles then restart
if 5 restarts within 20 cycles then timeout
depend memcache_bin
depend memcache_rc

check file memcache_bin with path /usr/bin/memcached
group memcached
include /etc/monit/templates/rootbin

check file memcache_rc with path /etc/init.d/memcached
group memcached
include /etc/monit/templates/rootbin
18 changes: 18 additions & 0 deletions data/1.4/monit/conf-available/mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group database
group mysql
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if failed host localhost port 3306 protocol mysql with timeout 15 seconds for 3 times within 4 cycles then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 3 times within 4 cycles then restart
if 5 restarts with 5 cycles then timeout
depend mysql_bin
depend mysql_rc

check file mysql_bin with path /usr/sbin/mysqld
group mysql
include /etc/monit/templates/rootbin

check file mysql_rc with path /etc/init.d/mysql
group mysql
include /etc/monit/templates/rootbin
17 changes: 17 additions & 0 deletions data/1.4/monit/conf-available/nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
check process nginx with pidfile /var/run/nginx.pid
group www
group nginx
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
# if failed port 80 protocol http request "/" then restart
if 5 restarts with 5 cycles then timeout
depend nginx_bin
depend nginx_rc

check file nginx_bin with path /usr/sbin/nginx
group nginx
include /etc/monit/templates/rootbin

check file nginx_rc with path /etc/init.d/nginx
group nginx
include /etc/monit/templates/rootbin
16 changes: 16 additions & 0 deletions data/1.4/monit/conf-available/openntpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
check process ntpd with pidfile /var/run/openntpd.pid
group system
group ntpd
start program = "/etc/init.d/openntpd start"
stop program = "/etc/init.d/openntpd stop"
if 4 restarts within 12 cycles then timeout
depend ntpd_bin
depend ntpd_rc

check file ntpd_bin with path /usr/sbin/ntpd
group ntpd
include /etc/monit/templates/rootbin

check file ntpd_rc with path /etc/init.d/openntpd
group ntpd
include /etc/monit/templates/rootbin
32 changes: 32 additions & 0 deletions data/1.4/monit/conf-available/openssh-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
check process sshd with pidfile /var/run/sshd.pid
group system
group sshd
start program = "/etc/init.d/ssh start"
stop program = "/etc/init.d/ssh stop"
if failed host localhost port 22 with proto ssh then restart
if 5 restarts with 5 cycles then timeout
depend on sshd_bin
depend on sftp_bin
depend on sshd_rc
depend on sshd_rsa_key
depend on sshd_dsa_key

check file sshd_bin with path /usr/sbin/sshd
group sshd
include /etc/monit/templates/rootbin

check file sftp_bin with path /usr/lib/openssh/sftp-server
group sshd
include /etc/monit/templates/rootbin

check file sshd_rsa_key with path /etc/ssh/ssh_host_rsa_key
group sshd
include /etc/monit/templates/rootstrict

check file sshd_dsa_key with path /etc/ssh/ssh_host_dsa_key
group sshd
include /etc/monit/templates/rootstrict

check file sshd_rc with path /etc/ssh/sshd_config
group sshd
include /etc/monit/templates/rootrc
18 changes: 18 additions & 0 deletions data/1.4/monit/conf-available/pdns-recursor
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
check process pdns-recursor with pidfile /var/run/pdns_recursor.pid
group system
group dns
group pdns-recursor
start program = "/etc/init.d/pdns-recursor start"
stop program = "/etc/init.d/pdns-recursor stop"
if failed host 127.0.0.1 port 53 type udp protocol dns for 3 times within 4 cycles then restart
if 5 restarts within 20 cycles then timeout
depend pdns-recursor_bin
depend pdns-recursor_rc

check file pdns-recursor_bin with path /usr/sbin/pdns_recursor
group pdns-recursor
include /etc/monit/templates/rootbin

check file pdns-recursor_rc with path /etc/init.d/pdns-recursor
group pnds-recursor
include /etc/monit/templates/rootbin
44 changes: 44 additions & 0 deletions data/1.4/monit/conf-available/postfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
check process postfix with pidfile /var/spool/postfix/pid/master.pid
group system
group mail
group postfix
start program = "/etc/init.d/postfix start"
stop program = "/etc/init.d/postfix stop"
if failed host localhost port 25 with protocol smtp for 2 times within 3 cycles then restart
if 5 restarts with 5 cycles then timeout
depend master_bin
depend postfix_rc
depend postdrop_bin
depend postqueue_bin
depend master_cf
depend main_cf

check file master_bin with path /usr/lib/postfix/master
group postfix
include /etc/monit/templates/rootbin

check file postdrop_bin with path /usr/sbin/postdrop
group postfix
if failed checksum then unmonitor
if failed permission 2555 then unmonitor
if failed uid root then unmonitor
if failed gid postdrop then unmonitor

check file postqueue_bin with path /usr/sbin/postqueue
group postfix
if failed checksum then unmonitor
if failed permission 2555 then unmonitor
if failed uid root then unmonitor
if failed gid postdrop then unmonitor

check file master_cf with path /etc/postfix/master.cf
group postfix
include /etc/monit/templates/rootrc

check file main_cf with path /etc/postfix/main.cf
group postfix
include /etc/monit/templates/rootrc

check file postfix_rc with path /etc/init.d/postfix
group postfix
include /etc/monit/templates/rootbin
26 changes: 26 additions & 0 deletions data/1.4/monit/conf-available/rsyslog
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
check process rsyslogd with pidfile /var/run/rsyslogd.pid
group system
group rsyslogd
start program = "/etc/init.d/rsyslog start"
stop program = "/etc/init.d/rsyslog stop"
if 5 restarts with 5 cycles then timeout
depend on rsyslogd_bin
depend on rsyslogd_rc
depend on rsyslog_file

check file rsyslogd_bin with path /usr/sbin/rsyslogd
group rsyslogd
include /etc/monit/templates/rootbin

check file rsyslogd_rc with path "/etc/init.d/rsyslog"
group rsyslogd
include /etc/monit/templates/rootbin

check file rsyslog_file with path /var/log/syslog
group rsyslogd
# Note: activate the immark plugin for rsyslog if
# your system is too low on events.
if timestamp > 65 minutes then alert
if failed permission 640 then unmonitor
if failed uid root then unmonitor
if failed gid adm then unmonitor
16 changes: 16 additions & 0 deletions data/1.4/monit/conf-available/smartmontools
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
check process smartd with pidfile /var/run/smartd.pid
group system
group smartd
start program = "/etc/init.d/smartmontools start"
stop program = "/etc/init.d/smartmontools stop"
if 5 restarts with 5 cycles then timeout
depend smartd_bin
depend smartd_rc

check file smartd_bin with path /usr/sbin/smartd
group smartd
include /etc/monit/templates/rootbin

check file smartd_rc with path "/etc/init.d/smartmontools"
group smartd
include /etc/monit/templates/rootbin
6 changes: 6 additions & 0 deletions data/1.4/monit/conf-available/snmpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
check process snmpd with pidfile /var/run/snmpd.pid
start program = "/etc/init.d/snmpd start"
stop program = "/etc/init.d/snmpd stop"
if failed host localhost port 161 type udp then restart
if failed host localhost port 199 type tcp then restart
if 5 restarts within 5 cycles then timeout
38 changes: 38 additions & 0 deletions data/1.4/monit/conf.d/nems.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# NEMS monit config

##############################################################################
# WEB INTERFACE
set httpd port 2812 and
allow @monit # allow users of group 'monit' to connect (rw)
SSL ENABLE
PEMFILE /var/www/certs/combined.pem
# use address localhost # only accept connection from localhost
# allow localhost # allow localhost to connect to the server and
# allow username:password # require user 'username' with password 'password'
# allow @users readonly # allow users of group 'users' to connect readonly
##############################################################################

##############################################################################
# The processes we want to monitor and restart if necessary

# MariaDB
check process MariaDB with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"

# Apache
check process Apache2 with pidfile /run/apache2/apache2.pid
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"

# Nagios
check process Nagios3 with pidfile /run/nagios3/nagios3.pid
start program = "/etc/init.d/nagios3 start"
stop program = "/etc/init.d/nagios3 stop"

# samba
check process samba with pidfile /run/samba/smbd.pid
start program = "/etc/init.d/smbd start"
stop program = "/etc/init.d/smbd stop"


Loading

0 comments on commit bee94b6

Please sign in to comment.