• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

The Plesk Web Server service on host as.xxxxx.com is down.

thanks Justin, I am going to check that out... err just have to make sometime!

No problem, it's pretty good I think. I'm temporarily just running it with "alert" rather than the "restart" commands for the tutorials config file. Also I commented out this bit:

# set httpd port 2812 and
# SSL ENABLE
# PEMFILE /var/certs/monit.pem
# allow admin:test

And didn't do the certificates bit as these lines seemed to cause Monit to crash once started. Maybe I'll look into that another day.
 
Last edited:
Need to figure out how to monitor the Plesk Web Service (sw-cp-serverd), once I've done that I'll post my config file which may help others.
 
Hey Justin, did you use any HOWTO docs or did you just go through Munin and Monit documentation?

I just used http://www.howtoforge.com/server-monitoring-with-munin-and-monit-on-centos-5.2-p2 and then the Monit documentation to get it working.

I have a small issue with the MySQL monitor as each time Monit is stopped/started it says that MySQl has failed. This means I can't have that on a "restart" otherwise it crashes MySQL. So that has to be on an "alert" only.

I'll paste in my config file tomorrow (if I remember!).

It's not complete, but monitors the major services. Works nicely so far.
 
I'll paste in my config file tomorrow (if I remember!).

set daemon 300 with start delay 120
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: [email protected] }
set alert [email protected]

set eventqueue basedir /var/monit slots 500

#set httpd port 2812 and
# SSL ENABLE
# PEMFILE /var/certs/monit.pem
# allow admin:password

# System
check system yourserver.com
group system
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

# MySQL
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
# if failed host 127.0.0.1 port 3306 then restart
# if 5 restarts within 5 cycles then timeout
if failed host 127.0.0.1 port 3306 then alert
if 5 restarts within 5 cycles then alert
#depends mysqld_init
# depends mysqld_bin
# depends mysqldsafe_bin
#check file mysqld_init with path /etc/init.d/mysql
# group database
#check file mysqld_bin with path /usr/sbin/mysqld
# group database
#check file mysqldsafe_bin with path /usr/bin/mysqld_safe
# group database


# Apache
check process apache with pidfile /var/run/httpd.pid
group www
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host www.yourdomain.co.uk port 80 protocol http then restart
# and request "/monit/token" then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 500 MB for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout

# Postfix
check process postfix with pidfile /var/spool/postfix/pid/master.pid
group mail
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 timeout

# Cron
check process cron with pidfile /var/run/crond.pid
start program = "/etc/init.d/crond start"
stop program = "/etc/init.d/crond stop"
group system
depends cron_init, cron_bin
check file cron_init with path /etc/init.d/crond
group system
check file cron_bin with path /usr/sbin/crond
group system

# SSHd
check process sshd with pidfile /var/run/sshd.pid
group ssh
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout

# Syslogd
#check process syslogd with pidfile /var/run/syslogd.pid
# start program = "/etc/init.d/sysklogd start"
# stop program = "/etc/init.d/sysklogd stop"
# if 5 restarts within 5 cycles then timeout
#check file syslogd_file with path /var/log/syslog


# Courier_imapd
check process imapd with pidfile /var/run/courier/imapd.pid
group mail
start program = "/etc/init.d/courier-imap start"
stop program = "/etc/init.d/courier-imap stop"
if failed port 143 then restart
if 5 restarts within 5 cycles then timeout

# Courier_immapd-ssl
#check process imapd-ssl with pidfile /var/run/courier/imapd-ssl.pid
# group mail
# start program = "/etc/init.d/courier-imap-ssl start"
# stop program = "/etc/init.d/courier-imap-ssl stop"
# if failed port 143 then alert
# if 5 restarts within 5 cycles then timeout

# Munin-node
#check process munin-node with pidfile /var/run/munin/munin-node.pid
# group services
# start program = "/etc/init.d/munin-node start"
# stop program = "/etc/init.d/munin-node stop"
# if 5 restarts within 5 cycles then timeout


#check process sw-cp-serverd with pidfile /var/run/sw-cp-server.pid
# group plesk
# start program = "/etc/init.d/sw-cp-server start"
# stop program = "/etc/init.d/sw-cp-server stop"
# if 2 restarts within 3 cycles then timeout
# if failed port 11443 protocol http then alert
# if failed port 11444 protocol http then alert



-------

Tried to add sw-cp-serverd but can't figure out how yet! Also the imapd-ssl doesn't exist.
 
Back
Top