How to install Nagios3 and Check_MK on an Ubuntu 12.04 LTS VPS

install-nagios3-on-ubuntu-13-10-vps-for-monitoring-virtual-servers-and-servicesThe following article guides through the steps of installing and configuring Nagios3 and Check_MK on a Ubuntu 12.04 LTS VPS.

Once deployed, you will be able to monitor your virtual servers and the services running on them.

Nagios3 is a robust and very powerful monitoring system, which in combination with Check_MK will provide you with a nice and easy way to monitor your virtual servers and services.

UPDATE THE SYSTEM

Make sure you are in a screen session and check if your Linux VPS is fully up-to-date by running:

## screen -U -S nagios-check-mk
## apt-get update
## apt-get upgrade

INSTALL DEPENDENCIES

Install some required (useful) packages on the system using apt

## apt-get install dialog xinetd build-essential apache2 libapache2-mod-python

INSTALL NAGIOS

Install Nagios and Nagios NRPE (Nagios Remote Plugin Executor) Plugins on your Linux VPS by running

## apt-get install nagios3 nagios-nrpe-plugin

you should be prompted to enter your nagiosadmin user’s password as shown below

Nagios Admin Password Prompt

if for some reason you’re not, then use the following command to set your nagiosadmin user’s password:

## htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin

proceed with adding Apache’s www-data user to the nagios group:

## usermod -a -G nagios www-data

edit Nagios3 configuration file in /etc/nagios3/nagios.cfg and enable external commands by setting check_external_commands from 0 to 1:

## vim +/check_external_commands /etc/nagios3/nagios.cfg

restart Nagios and Apache

## service apache2 restart
## service nagios3 restart

INSTALL CHECK_MK

At the time of writing this article, the latest version of check_mk is ver 1.2.4. Make sure you check here if a newer version is available.

## cd /opt
## ver=1.2.4
## wget http://mathias-kettner.com/download/check_mk-${ver}.tar.gz
## tar -zxf check_mk-${ver}.tar.gz
## cd check_mk-${ver}

run the installer by executing the setup.sh script

## ./setup.sh

once the installation is completed, check if check_mk is installed on the system using:

## check_mk --version

RESTART SERVICES

Restart the Apache webserver and the Nagios monitoring system using the following commands:

## service nagios3 restart
## service apache2 restart

INSTALL CHECK_MK AGENT

In order to be able to monitor other servers, you need to install an agent which will communicate with the check_mk server. The easiest way to test the set-up is to install an agent on the Nagios server itself, so since this is an Ubuntu based virtual server, download the latest version of the agent from here and install it using:

## wget -P /tmp http://mathias-kettner.com/download/check-mk-agent_1.2.4-2_all.deb
## dpkg -i /tmp/check-mk-agent_1.2.4-2_all.deb

edit agent’s configuration file in /etc/xinetd.d/check_mk and set the following:

## vim /etc/xinetd.d/check_mk
only_from       = <YOUR_NAGIOS_IP>

restart xinetd for the change to take effect

## service xinetd restart

Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert linux admins to install Nagios and Check_MK on your server for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment