- #MONIT FILE HOW TO#
- #MONIT FILE SOFTWARE#
- #MONIT FILE CODE#
- #MONIT FILE PASSWORD#
- #MONIT FILE DOWNLOAD#
#MONIT FILE HOW TO#
Start program = "/etc/init.In this article, we will show you how to install and configure Monit on Ubuntu 16.04.
Start program "/etc/init.d/psa-spamassassin start" SpamAssassin checks (to ensure SpamAssassin restarts after periods of high CPU use):Ĭheck process spamd with pidfile /var/run/spamd/spamd_full.pid.If failed port 995 type tcpssl sslauto protocol pop then restart If failed port 110 type tcp protocol pop then restartĬheck process pop3d-ssl with pidfile "/var/run/pop3d-ssl.pid" If failed port 993 type tcpssl sslauto protocol imap then restartĬheck process pop3d with pidfile "/var/run/pop3d.pid" If failed port 143 type tcp protocol imap then restartĬheck process imapd-ssl with pidfile "/var/run/imapd-ssl.pid" Stop program = "/etc/init.d/courier-imap stop" Start program = "/etc/init.d/courier-imap start" Mail server check for incoming mail responsiveness (IMAP, IMAP-SSL, POP3,and POP3-SSL):Ĭheck process imapd with pidfile "/var/run/imapd.pid".If failed port 25 protocol smtp then restart Stop program = "/bin/bash -c '/etc/init.d/qmail stop & /etc/init.d/xinetd stop'" Start program = "/bin/bash -c '/etc/init.d/qmail start & /etc/init.d/xinetd start'" SMTP and qmail server check (for overall outgoing mail health and sending functionality):Ĭheck process qmail with pidfile "/var/run/xinetd.pid".If failed port 3306 protocol mysql then restart Start program = "/etc/init.d/mysqld start"
#MONIT FILE PASSWORD#
Skip the following commands if you do not want Monit's password to match Plesk's admin password:Ĭat /usr/local/psa/admin/sbin/monit_password_change.sh.NewEmail=\$(echo $1 | perl -pe -p -i -e 's/(set\ alert)+/\1 '\$newEmail'/' /etc/monitrcĬhmod 755 /usr/local/psa/admin/sbin/monit_email_change.sh mysql -u'admin' -p$(cat /etc/psa/.psa.shadow) psa -e"insert into event_handlers values(default,(select id from actions where descr='Update Administrator Information'),0,'root','/usr/local/psa/admin/sbin/monit_email_change ') "
Skip the following commands if you do not want Monit's email address to match Plesk's administrator email:Ĭat /usr/local/psa/admin/sbin/monit_email_change.sh.If you manually edited the command above to include different information, skip the corresponding step(s) below. This way, if you change either your Plesk password or your email address, Monit will also be updated. To help things keep manageable, we can now create a few scripts to ensure that this information stays up-to-date.For example, replace /usr/local/psa/bin/admin -show-password with the password of your choice. If you would prefer that either the username or password to be independent of your Plesk login credentials, you'll need to edit the command below accordingly with your own information. Set alert $(mysql -sN -u'admin' -p`cat /etc/psa/.psa.shadow` psa -e'select email from clients where id=1 ')Īllow admin:$(/usr/local/psa/bin/admin -show-password) The command below will pull the username, password, and email address alerts are to be sent to, using information already stored in Plesk: The first thing that Monit needs is a configuration file.configure -prefix=/usr -without-pam make make install mkdir /etc/monit.d/ This will also configure Monit without the PAM option.
#MONIT FILE SOFTWARE#
This is primarily to keep an extra degree of separation between Plesk, which lives in /usr/local/psa, and other software on the system. We'll use a fairly vanilla configuration, The following command will change the prefix so it is set to /usr rather than /usr/local (which is what Monit will default to). From here, Monit needs to be built from source.
#MONIT FILE DOWNLOAD#
Then, download and unpack Monit: wget tar zxf monit-5.6.tar.gz rm -f monit-5.6.tar.gz cd monit-5.6
#MONIT FILE CODE#
That way, you always know where to find the temperamental data/source code you use for new installations.įirst, step into the /usr/local/src directory: cd /usr/local/src For organizational purposes, it is good practice to use /usr/local/src.
Installing Monit will not fix the core problems that cause system services to go unresponsive.