Giovanni Tommasini

Be pitiful, for every man is fighting a hard battle.
Ogni persona che incontri sta combattendo una battaglia di cui non sai nulla. Sii gentile. Sempre.
www.giovannitommasini.info

How to install Monit 5.20 on Ubuntu 10.04

31 Jan 2017 » linux, IT, monit

Screenshot monit Screenshot ubuntu
I manage several virtual machines with Ubuntu 10.04.
My need is that I don’t want to make a dist-upgrade because I don’t want to jeopardize the entire VM, but I want to use the new features of Monit 5.20.

If you are in my situation, moving on. Let’s start!

Let’s have a check of the OS version with the cat /etc/lsb-release command.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.4 LTS"

Let’s check the Monit version with monit --version

This is Monit version 5.0.3

Now we can start with the upgrade:

  • First of all we have to remove th current monit installation: we save the config file and purge monit.
/etc/init.d/monit stop
cp -R /etc/monit /tmp/monit.ORIG
apt-get purge monit
  • Probably you will receive the following alert
dpkg: attenzione: nel rimuovere monit la directory "/var/lib/monit" è risultata non vuota e non viene rimossa.
dpkg: attenzione: nel rimuovere monit la directory "/etc/monit/conf.d" è risultata non vuota e non viene rimossa.
dpkg: attenzione: nel rimuovere monit la directory "/etc/monit" è risultata non vuota e non viene rimossa.
  • No problem, we remove these folders manually
rm -rf /var/lib/monit
rm -rf /etc/monit/conf.d
rm -rf /etc/monit
  • We move in tmp folder and download the binaries.
cd /tmp
wget https://mmonit.com/monit/dist/binary/5.20.0/monit-5.20.0-linux-x64.tar.gz
tar -xvzf monit-5.20.0-linux-x64.tar.gz
  • We move in monit folder and copy the file in /etc folder.
cd monit-5.20.0
cp bin/monit /usr/bin/monit
mkdir /etc/monit
touch /etc/monit/monitrc
chmod 0700 /etc/monit/monitrc
ln -s /etc/monit/monitrc /etc/monitrc
  • We download the init file and set the autostart of monit
wget https://gist.githubusercontent.com/rahul286/9975061/raw/1aa107e62ecaaa2dacfdb61a12f13efb6f15005b/monit -P /etc/init.d/ --no-check-certificate
chmod u+x /etc/init.d/monit
echo "START=yes" > /etc/default/monit
  • Now with monit -tcommand we could test the config.

  • In the end we restore the origin file; we check it and start monit service

cd /etc/monit
cp -R /tmp/monit.ORIG/* .
monit -t
/etc/init.d/monit start
  • With monit status now we check the status of all the monitored services.

Linkography

  1. https://mmonit.com/monit/
  2. https://easyengine.io/tutorials/monitoring/monit/