Monit Configs for Ubuntu / Debian / CentOS / RHCE / Redhat
/2 Comments/in Apache, Debian, Monitoring, Mysql, NginX, OpenVZ, PHP, Proxmox, Raspberry Pi, Raspian, Reference, Servers, Tuning, Ubuntu /by extremeshokNote:
I have removed the checking of permissions of init and binaries. The extra system resources and maintenancefar outweighs any benefit.
Assumptions:
Completed: CentOS 6 / RHCE 6 / Redhat : Monit ( Server Monitoring and Automatic Maintenance ) or Ubuntu LTS : Monit ( Server Monitoring and Automatic Maintenance ) or Debian 7 wheezy : Monit ( Server Monitoring and Automatic Maintenance )
Monit config files for various services
Please only install the configs for services which you require.
Setup the directories
1 2 | mkdir -p /etc/monit/scripts/ mkdir -p /etc/monit/conf.d/ |
Failsafe MySQL Termination script
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/scripts/mysql_stop <<EOF #!/bin/bash ## eXtremeSHOK.com service mysql stop pkill -9 -f mysql pkill -9 -f rsync ## eXtremeSHOK.com EOF chmod +x /etc/monit/scripts/mysql_stop |
PowerDNS Termination script
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/scripts/pdns_stop <<EOF #!/bin/bash ## eXtremeSHOK.com service pdns stop service pdns-server stop pkill -9 -f pdns ## eXtremeSHOK.com EOF chmod +x /etc/monit/scripts/pdns_stop |
CSF Check script
1 2 3 4 5 6 7 8 9 10 11 12 | cat > /etc/monit/scripts/csf_check <&1 | head -n1 | grep -Eoi '+Chain LOCALINPUT+'`) if [ "$CSFOUTPUT" == "Chain LOCALINPUT" ] ; then echo "OK working" exit 0 else echo "Not running" 1>&2; exit 10 fi ## eXtremeSHOK.com EOF chmod +x /etc/monit/scripts/csf_check |
system
1 2 3 4 5 6 7 8 9 10 11 12 13 | cat > /etc/monit/conf.d/system < 7 for 5 cycles then alert if loadavg (5min) > 9 for 5 cycles then alert if memory usage > 90% for 5 cycles then alert if cpu usage (user) > 90% for 5 cycles then alert if cpu usage (system) > 70% for 5 cycles then alert if cpu usage (wait) > 50% for 5 cycles then alert check filesystem rootfs with path / if space > 80% then alert if inode usage > 80% then alert mode passive ## eXtremeSHOK.com EOF |
M/Monit
1 2 3 4 5 6 7 8 | cat > /etc/monit/conf.d/mmonit <<EOF ## eXtremeSHOK.com check process mmonit with pidfile /var/run/mmonit.pid start program = "/etc/init.d/mmonit start" stop program = "/etc/init.d/mmonit stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
cron ( Ubuntu / Debian )
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/cron <<EOF ## eXtremeSHOK.com check process cron with pidfile /var/run/crond.pid group system start program = "/etc/init.d/cron start" stop program = "/etc/init.d/cron stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
crond ( CentOS / RHCE / Redhat )
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/crond <<EOF ## eXtremeSHOK.com check process crond with pidfile /var/run/crond.pid group system start program = "/etc/init.d/crond start" stop program = "/etc/init.d/crond stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
ssh ( Ubuntu / Debian )
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/sshd <<EOF ## eXtremeSHOK.com check process ssh with pidfile /var/run/sshd.pid start program "/etc/init.d/ssh start" stop program "/etc/init.d/ssh stop" ##causes issues with denyhosts and csf #if failed port 22 protocol ssh then restart if failed port 22 type tcp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
sshd ( CentOS / RHCE / Redhat )
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/sshd <<EOF ## eXtremeSHOK.com check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/sshd start" stop program "/etc/init.d/sshd stop" ##causes issues with denyhosts and csf #if failed port 22 protocol ssh then restart if failed port 22 type tcp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
syslogd ( Ubuntu / Debian OpenVZ VPS )
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/syslogd <<EOF ## eXtremeSHOK.com check process syslogd with pidfile /var/run/syslogd.pid group system start program = "/etc/init.d/sysklogd start" stop program = "/etc/init.d/sysklogd stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
rsyslog ( Debian OpenVZ VPS )
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/syslogd <<EOF ## eXtremeSHOK.com check process syslogd with pidfile /var/run/syslog.pid group system start program = "/etc/init.d/rsyslog start" stop program = "/etc/init.d/rsyslog stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
rsyslogd ( CentOS / RHCE / Redhat )
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/syslogd <<EOF ## eXtremeSHOK.com check process rsyslogd with pidfile /var/run/syslogd.pid group system start program = "/etc/init.d/rsyslog start" stop program = "/etc/init.d/rsyslog stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
rsyslogd ( Debian : Standalone / KVM VPS )
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/rsyslogd <<EOF ## eXtremeSHOK.com check process rsyslogd with pidfile /var/run/rsyslogd.pid group system start program = "/etc/init.d/rsyslog start" stop program = "/etc/init.d/rsyslog stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
rsyslogd ( Centos / RHCE / Redhat : Standalone / KVM VPS )
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/rsyslogd <<EOF ## eXtremeSHOK.com check process rsyslogd with pidfile /var/run/syslogd.pid group system start program = "/etc/init.d/rsyslog start" stop program = "/etc/init.d/rsyslog stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
xinetd
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/xinetd<<EOF ## eXtremeSHOK.com check process xinetd with pidfile /var/run/xinetd.pid group system start program = "/etc/init.d/xinetd start" stop program = "/etc/init.d/xinetd stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
saslauthd
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/saslauthd<<EOF ## eXtremeSHOK.com check process saslauthd with pidfile /var/run/saslauthd/saslauthd.pid group system start program = "/etc/init.d/saslauthd start" stop program = "/etc/init.d/saslauthd stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
denyhosts ( Ubuntu / Debian )
1 2 3 4 5 6 7 8 | cat > /etc/monit/conf.d/denyhosts <<EOF ## eXtremeSHOK.com check process denyhosts with pidfile /var/run/denyhosts.pid start program = "/etc/init.d/denyhosts start" stop program = "/etc/init.d/denyhosts stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
denyhosts ( CentOS / RHCE / Redhat )
1 2 3 4 5 6 7 8 | cat > /etc/monit/conf.d/denyhosts <<EOF ## eXtremeSHOK.com check process denyhosts with pidfile /var/lock/subsys/denyhosts start program = "/etc/init.d/denyhosts start" stop program = "/etc/init.d/denyhosts stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
mysql ( Debian / Ubuntu)
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/mysql <<EOF ## eXtremeSHOK.com check process mysql with pidfile /var/run/mysqld/mysqld.pid group mysql start program = "/etc/init.d/mysql start" with timeout 900 seconds stop program = "/etc/monit/scripts/mysql_stop" if failed host 127.0.0.1 port 3306 protocol mysql then restart #if failed unixsocket /var/run/mysqld/mysqld.sock then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
mysql ( CentOS / RHCE / Redhat )
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/mysql <<EOF ## eXtremeSHOK.com check process mysqld with pidfile /var/run/mysqld/mysqld.pid group mysql start program = "/etc/init.d/mysql start" with timeout 900 seconds stop program = "/etc/monit/scripts/mysql_stop" if failed host 127.0.0.1 port 3306 protocol mysql then restart #if failed unixsocket /var/run/mysqld/mysqld.sock then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
powerdns ( Debian / Ubuntu)
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/powerdns <<EOF ## eXtremeSHOK.com check process powerdns with pidfile /var/run/pdns.pid group powerdns start program = "/etc/init.d/pdns start" stop program = "/etc/monit/scripts/pdns_stop" #if failed host 127.0.0.1 port 53 type udp protocol dns then restart if failed host 127.0.0.1 port 53 type udp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
powerdns ( CentOS / RHCE / Redhat)
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/powerdns <<EOF ## eXtremeSHOK.com check process powerdns with pidfile /var/run/pdns-server/pdns.pid group powerdns start program = "/etc/init.d/pdns-server start" stop program = "/etc/monit/scripts/pdns_stop" #if failed host 127.0.0.1 port 53 type udp protocol dns then restart if failed host 127.0.0.1 port 53 type udp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
powerdns recursor ( CentOS / RHCE / Redhat)
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/pdns-recursor <<EOF ## eXtremeSHOK.com check process pdns-recursor with pidfile /var/run/pdns-recursor.pid group powerdns 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 then restart if failed host 127.0.0.1 port 53 type udp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
nginx
1 2 3 4 5 | cat > /etc/monit/conf.d/nginx < 98% for 5 cycles then restart if failed host 127.0.0.1 port 80 protocol http and request / with timeout 20 seconds then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
proftpd
1 2 3 4 5 | cat > /etc/monit/conf.d/proftpd < 98% for 5 cycles then restart if failed port 21 protocol ftp with timeout 20 seconds then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
fail2ban
1 2 3 4 5 | cat > /etc/monit/conf.d/fail2ban < 98% for 5 cycles then restart if failed unixsocket /var/run/fail2ban/fail2ban.sock then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
memcached
1 2 3 4 5 | cat > /etc/monit/conf.d/memcached < 98% for 5 cycles then restart if failed host localhost port 11211 protocol memcache then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
redis-server
1 2 3 4 5 | cat > /etc/monit/conf.d/redis-server< 98% for 5 cycles then restart if failed host 127.0.0.1 port 6379 then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
php-fpm-tcp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | cat > /etc/monit/conf.d/php-fpm-tcp <<EOF ## eXtremeSHOK.com ### Monitoring TCP socket php-fpm: the parent process. check process php5-fpm-tcp with pidfile /var/run/php5-fpm.pid group phpcgi-tcp # phpcgi-tcp group start program = "/etc/init.d/php5-fpm start" stop program = "/etc/init.d/php5-fpm stop" ## Test the FCGI protocol with an empty FCGI request. if failed port 9000 # we're running it on port 9000 ## This was borrowed from here: ## http://richard.wallman.org.uk/2010/03/monitor-a-fastcgi-server-using-monit/ ## and here: ## http://stackoverflow.com/questions/1302209/how-do-i-ping-a-fastcgi-server. ## Send FastCGI packet: version 1 (0x01), cmd FCGI_GET_VALUES (0x09) ## padding 8 bytes (0x08), followed by 8xNULLs padding. ## This follows the FCGI spec at http://www.fastcgi.com/devkit/doc/fcgi-spec.html#S3. ## 1. Version - 1 byte (version 1). ## 2. Type - 1 byte (FCGI_GET_VALUES = 9). ## 3. Request ID - 2 bytes (set to 0 - null request ID). ## 4. Content length - 2 bytes (set to 0). ## 5. Padding length - 1 byte (set to 8). ## 6. Reserved - 1 byte (set to 0). ## 7. Content data - variable size set to NULL. ## 8. Padding data - variable size set to 8 bytes (all NULL). send "x01x09x00x00x00x00x08x00x00x00x00x00x00x00x00x00" ## Expect FastCGI packet: version 1 (0x01), resp FCGI_GET_VALUES_RESULT (0x0A). ## 1. Version - 1 byte (version 1). ## 2. Type - 1 byte (FCGI_GET_VALUES_RESULT = 10). expect "x01x0A" ## Timeout because we don't care about anything else then the two initial bytes. timeout 5 seconds then restart ## If the restarts attempts fail then alert. if 3 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
php5-fpm-unix
1 2 3 4 5 6 7 8 9 10 11 12 | cat > /etc/monit/conf.d/php5-fpm-unix <<EOF ## eXtremeSHOK.com ### Monitoring UNIX socket php-fpm: the parent process. check process php5-fpm-unix with pidfile /var/run/php5-fpm.pid group phpcgi-unix # phpcgi-unix group start program = "/etc/init.d/php5-fpm start" stop program = "/etc/init.d/php5-fpm stop" ## Test the UNIX socket. Restart if down. if failed unixsocket /var/run/php5-fpm.sock then restart ## If the restarts attempts fail then alert. if 3 restarts within 5 cycles then alert EOF |
apache2 ( Ubuntu / Debian )
1 2 3 | cat > /etc/monit/conf.d/apache2 < 90% for 5 cycles then restart ## eXtremeSHOK.com EOF |
httpd ( CentOS / RHCE / Redhat )
1 2 3 | cat > /etc/monit/conf.d/httpd < 90% for 5 cycles then restart ## eXtremeSHOK.com EOF |
postgres
1 2 3 4 5 6 7 8 9 10 11 | cat > /etc/monit/conf.d/postgres <<EOF ## eXtremeSHOK.com check process postgres with pidfile /var/run/postgresql/9.1-main.pid group postgres start program = "/etc/init.d/postgresql start" with timeout 600 seconds stop program = "/etc/init.d/postgresql stop" #if failed host 127.0.0.1 port 5432 then restart if failed host 127.0.0.1 port 5432 protocol pgsql then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
freeradius
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/freeradius <<EOF ## eXtremeSHOK.com check process radiusd with pidfile /var/run/freeradius/freeradius.pid start program = "/etc/init.d/freeradius start" stop program = "/etc/init.d/freeradius stop" if failed host 127.0.0.1 port 1812 type udp protocol radius secret testing123 then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
postfix
1 2 3 4 5 6 7 8 9 10 | cat > /etc/monit/conf.d/postfix <<EOF ## eXtremeSHOK.com check process postfix with pidfile /var/spool/postfix/pid/master.pid group postfix start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" if failed port 25 protocol smtp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
CSF (LFD)
1 2 3 4 5 6 7 8 | cat > /etc/monit/conf.d/csf <<EOF ## eXtremeSHOK.com check process lfd with pidfile /var/run/lfd.pid start program = "/usr/sbin/csf -e" with timeout 900 seconds stop program = "/usr/sbin/csf -x" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
OpenVPN Multiple servers/ports
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | cat > /etc/monit/conf.d/openvpn <<EOF ## eXtremeSHOK.com check process openvpn.server-53-udp with pidfile /var/run/openvpn.server-53-udp.pid group openvpn start program = "/etc/init.d/openvpn start server-53-udp" stop program = "/etc/init.d/openvpn stop server-53-udp" if failed port 53 type udp then restart if 5 restarts within 5 cycles then alert check process openvpn.server-123-udp with pidfile /var/run/openvpn.server-123-udp.pid group openvpn start program = "/etc/init.d/openvpn start server-123-udp" stop program = "/etc/init.d/openvpn stop server-123-udp" if failed port 123 type udp then restart if 5 restarts within 5 cycles then alert check process openvpn.server-443-udp with pidfile /var/run/openvpn.server-443-udp.pid group openvpn start program = "/etc/init.d/openvpn start server-443-udp" stop program = "/etc/init.d/openvpn stop server-443-udp" if failed port 443 type udp then restart if 5 restarts within 5 cycles then alert check process openvpn.server-80-tcp with pidfile /var/run/openvpn.server-80-tcp.pid group openvpn start program = "/etc/init.d/openvpn start server-80-tcp" stop program = "/etc/init.d/openvpn stop server-80-tcp" if failed port 80 type tcp then restart if 5 restarts within 5 cycles then alert check process openvpn.server-443-tcp with pidfile /var/run/openvpn.server-443-tcp.pid group openvpn start program = "/etc/init.d/openvpn start server-443-tcp" stop program = "/etc/init.d/openvpn stop server-443-tcp" if failed port 443 type tcp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
Stunnel4 SSL for port 563
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/stunnel4 <<EOF ## eXtremeSHOK.com check process stunnel4 with pidfile /var/lib/stunnel4/stunnel4.pid start program = "/etc/init.d/stunnel4 start" stop program = "/etc/init.d/stunnel4 stop" if failed port 563 type TCPSSL then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
HAProxy for ports 443, 8443
1 2 3 4 5 6 7 8 9 10 | cat > /etc/monit/conf.d/haproxy <<EOF ## eXtremeSHOK.com check process haproxy with pidfile /var/run/haproxy.pid start program = "/etc/init.d/haproxy start" stop program = "/etc/init.d/haproxy stop" if failed port 443 type tcp then restart if failed port 8443 type tcp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
sniproxy for ports 80, 443
1 2 3 4 5 6 7 8 9 10 | cat > /etc/monit/conf.d/sniproxy <<EOF ## eXtremeSHOK.com check process sniproxy with pidfile /var/tmp/sniproxy.pid start program = "/etc/init.d/sniproxy start" stop program = "/etc/init.d/sniproxy stop" if failed port 80 type tcp then restart if failed port 443 type tcp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
nntpcache port 119
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/nntpcache <<EOF ## eXtremeSHOK.com check process nntpcache matching "nntpcache" start program = "/etc/init.d/nntpcache start" stop program = "/etc/init.d/nntpcache stop && /usr/bin/pkill -f nntpcache" if failed port 119 type tcp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
softether vpnserver port 119
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/vpnserver <<EOF ## eXtremeSHOK.com check process vpnserver matching "vpnserver" start program = "/etc/init.d/vpnserver start" stop program = "/etc/init.d/vpnserver stop && /usr/bin/pkill -f vpnserver" if failed port 443 type tcp then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
ntpd
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/ntpd <<EOF ## eXtremeSHOK.com check process ntpd with pidfile /var/run/ntpd.pid group system start program "/etc/init.d/ntp start" stop program "/etc/init.d/ntp stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
vnstatd
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/vnstatd <<EOF ## eXtremeSHOK.com check process vnstatd with pidfile /var/run/vnstat.pid group system start program "/etc/init.d/vnstat start" stop program "/etc/init.d/vnstat stop" if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
named ( bind9 chroot ) for ports 53
1 2 3 4 5 6 7 8 9 10 | cat > /etc/monit/conf.d/named<<EOF ## eXtremeSHOK.com check process named with pidfile /var/named/chroot/var/run/named/named.pid start program = "/etc/init.d/named start" stop program = "/etc/init.d/named stop" if failed port 53 type tcp protocol dns then alert if failed port 53 type udp protocol dns then alert if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
amavisd ( amavis )
1 2 3 4 5 6 7 8 9 10 | cat > /etc/monit/conf.d/amavisd <<EOF ## eXtremeSHOK.com check process amavisd with pidfile /var/run/amavisd/amavisd.pid group services start program = "/etc/init.d/amavisd start" stop program = "/etc/init.d/amavisd stop" if failed host 127.0.0.1 port 10024 then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
clamd ( clamav )
1 2 3 4 | cat > /etc/monit/conf.d/clamd < 98% for 5 cycles then alert if mem usage > 98% for 5 cycles then alert ## eXtremeSHOK.com EOF |
dovecot
1 2 3 4 | cat > /etc/monit/conf.d/dovecot < 98% for 5 cycles then alert if mem usage > 98% for 5 cycles then alert ## eXtremeSHOK.com EOF |
policyd
1 2 3 4 5 6 7 8 9 10 | cat > /etc/monit/conf.d/policyd <<EOF ## eXtremeSHOK.com check process policyd with pidfile /var/run/policyd.pid group mail start program = "/etc/init.d/policyd start" stop program = "/etc/init.d/policyd stop" if failed port 10031 protocol postfix-policy then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
openldap (slapd)
1 2 3 4 5 6 7 8 9 10 | cat > /etc/monit/conf.d/openldap <<EOF ## eXtremeSHOK.com check process slapd with pidfile /var/run/openldap/slapd.pid group database start program = "/etc/init.d/slapd start" with timeout 30 seconds stop program = "/etc/init.d/slapd stop" if 5 restarts within 5 cycles then alert if failed port 389 protocol LDAP3 with timeout 15 seconds then alert ## eXtremeSHOK.com EOF |
solr
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/solr <<EOF ## eXtremeSHOK.com check process solr with pidfile /var/run/solr.pid start program = "/etc/init.d/solr start" stop program = "/etc/init.d/solr stop" if failed host localhost port 8983 then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
iredapd
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/iredapd <<EOF ## eXtremeSHOK.com check process iredapd with pidfile /var/run/iredapd.pid start program = "/etc/init.d/iredapd start" stop program = "/etc/init.d/iredapd stop" if failed host localhost port 7777 then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
sogod (SOGo)
1 2 3 4 5 6 7 8 9 | cat > /etc/monit/conf.d/sogod <<EOF ## eXtremeSHOK.com check process sogod with pidfile /var/run/sogo/sogo.pid start program = "/etc/init.d/sogod start" stop program = "/etc/init.d/sogod stop" if failed host localhost port 20000 then restart if 5 restarts within 5 cycles then alert ## eXtremeSHOK.com EOF |
Check external website domain.com us online
1 2 3 4 5 6 | cat > /etc/monit/conf.d/domain.com <<EOF ## eXtremeSHOK.com check host domain.com with address domain.com every 5 cycles if failed port 80 protocol http for 2 cycles then alert ## eXtremeSHOK.com EOF |
Optional
Add email alets to monit checks
1 2 3 4 5 | alert youremail@address.com { connection, timeout } with mail-format { from: monit@server.com subject: $EVENT at $DATE on $HOST message: $EVENT at $DATE on $HOST } |
hello
I have centos 6 64 bit with directadmin
where should I put these config?
The commands listed will install the configs to the correct place if you followed our monit setup guides