Lumphini Park, Bangkok

Migrating Nagios 4 and NagiosGraph 1.5 from Ubuntu 16.04 to Ubuntu 20.04

Using non supported operating system is not recommended even if it is Linux, but sometimes, upgrading them might be tricky. As Ubuntu 16.04 LTS support end in April, 2021, I had to migrate a bunch of them. While when I did migrated Debian 6 to Debian 7 which resulted mainly to a completed re-installation since init.d as been replaced by systemd was making most services unstable, I'm pleasantly surprised with Ubuntu.

Here you will find a step by step guide on how I migrated successfully Nagios from an Ubuntu 16.04LTS to Ubuntu 20.04LTS

Clear space

/boot

extend drive

LVM

Upgrading the Ubuntu from Ubuntu 16.04 to Ubuntu 18.04

do-upgrade-release
reboot

Upgrading the Ubuntu from Ubuntu 18.04 to Ubuntu 20.04

do-upgrade-release
reboot

Reinstalling Nagios

-> https://www.howtoforge.com/tutorial/how-to-install-nagios-on-ubuntu-2004/

systemctl restart apache2
systemctl enable nagios
systemctl stop nagios

If you migrating to a new server

Copying configurations files, objects and logs

## OldServer IP
OldServer=


scp $OldServer:/usr/local/nagios/*.cfg /usr/local/nagios/
scp $OldServer:/usr/local/nagios/objects/*.cfg /usr/local/nagios/objects/

## than the historic
scp $OldServer:/usr/local/nagios/var/nagios.log /usr/local/nagios/var/
scp $OldServer:/usr/local/nagios/var/archives/* /usr/local/nagios/var/archives/

Pre-Flight Test

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 

Warning

  • retry_check_interval will be replaced by retry_interval
  • normal_check_interval will be replaced by check_interval
for file in /usr/local/nagios/etc/objects/*.cfg; do
    sed -i 's/normal_check_interval/check_interval/g' $file
sed -i 's/retry_check_interval/retry_interval/g' $file
done

 

NagiosGraph

apt install -y libgd-perl
systemctl stop nagios
scp -r $OldServer:/usr/local/nagiosgraph /usr/local/
systemctl restart nagios apache2

Profit