Setting up a distributed monitoring solution with Nagios, CheckMK and Thruk
Software version | Nagios 3 Check Mk 1.1.12p7 Thruk 1.30 |
Operating System | Debian 6 |
Introduction
Before starting with this documentation, it’s recommended to be familiar with certain tools. Here’s the list with associated documentation:
The purpose of this documentation is to install a Thruk server capable of displaying information from different remote Nagios servers:
This diagram will be our reference throughout the tutorial.
We will need 4 servers with the following services installed:
- SRV-THRUK: Apache & Thruk which will be our “display” server.
- SRV-NAGIOS1: Nagios & Check Mk which will be a Nagios server to monitor part x of our infrastructure
- SRV-NAGIOS2: Nagios & Check Mk which will be a Nagios server to monitor part y of our infrastructure
- SRV-NAGIOS3: Nagios & Check Mk which will be a Nagios server to monitor part z of our infrastructure
In the end, we want to get decentralized screens without any dependency between them:
Thruk: Display Server
Installation
Let’s start with the installation of Apache2
|
|
Now that Apache2 is installed, let’s download Thruk:
|
|
You can now access your Thruk interface by typing this in your browser: http://localhost/thruk
The login and password are: thrukadmin
Configuration
The Thruk configuration is primarily initialized by two files:
- thruk.conf: This is the global Thruk configuration that should not be modified!
- thruk_local.conf: This is the customizable configuration, which will be loaded by thruk.conf
Let’s edit our /etc/thruk/thruk_local.conf
as follows:
|
|
To finish, just start the Thruk service:
|
|
The configuration of our SRV-THRUK doesn’t require any other modifications in our case, so we can move on to the installation of the Nagios and CheckMK servers.
Nagios & CheckMk: Monitoring Servers
Installation
First, let’s take care of Nagios3:
|
|
Then the famous plugin for Nagios, Check Mk:
|
|
Use the setup with default options. If needed, refer to the CheckMk documentation for more information. Then install the agent:
|
|
Configuration
The livestatus file is essential in our implementation, as it’s where we specify the port used by livestatus, the IP address of our remote Thruk server and the path of the socket used.
Use the following example for the /etc/xinetd.d/livestatus
file. This livestatus file needs to be created, be careful not to insert comments in the configuration file:
|
|
Finally, we need to restart our service:
|
|
Let’s create the directory containing the socket (live), and assign it permissions:
|
|
We also need to edit the Nagios configuration to enter the path of our socket
The file to edit is /etc/nagios3/nagios.cfg
:
|
|
Restart Nagios3
|
|
If you want to test your socket and retrieve information from it:
|
|
Last updated 28 Jun 2012, 07:39 CEST.