Tutorial: How to install Check_MK

[ 24 04 2015 ]
[ Marius Pana ]

The need to know the status of your IT infrastructure has always been a necessity. The large number of monitoring solutions available today in the market proves this necessity.

The Check_MK monitoring system is delivered in a bundle called OMD (Open Monitoring Distribution) and it is available for download as an installation kit for the most common Linux distributions. Those who would like to test the latest changes can choose the version from Git. The download is available from the following links:

http://mathias-kettner.com/nagios_support_download.php?HTML=yes&LANG=en

You will notice you have several options to choose from:

CRE - the Raw Edition (completely open source) CEE - the Enterprise Edition CME - the Managed Service Edition (for managed service providers) Appliance - the virtual Appliance

You will also find links to the demo version.

Today we are presenting the installation process of Check_MK CEE version and the first steps required to utilise the monitoring solution. The installation will be made on a CentOS 6.6 system. To be able to install Check_MK, first it is necessary to enable the EPEL repository, and this can be done by running:

# yum install epel-release –y

The epel respository enables access to required third-party packages. Once epel has been enabled we continue to install Check_MK by placing the download package somewhere on your server.

# yum install /tmp/check-mk-enterprise-1.5.0p1-el6-38.x86_64.rpm

At the end of the installation we are ready to run the first site. Check_MK provides an omd command which allows the management of sites and clusters. In future articles we will go into details about all the components of the monitoring solution. Check_MK can also be used to quickly create and run/stop new sites. In this case we will create and run a new site that we`ll name “firstsite”.

# omd create firstsite

After the site is created, we are announced that it can now be run by using the command “omd start firstsite”. We are also presented with the link to access the web interface, and the username and password needed for administration. In order to manage the site from a command line we would need to run su – firstsite. We can run the site by using the command:

# omd start firstsite

Now if the firewall permits connections on port 80, we are ready to connect to our monitoring platform by using one of the following addresses: http://name.site/firstsite or http://IP_server/firstsite. Next we will be faced with a login page where we will use the username cmkadmin and the password that was written on the screen at the end of the installation step.

After logging in we will go to the WATO tab – the web administration tool for Check_MK – and in the Users section, we`ll use the New User button to create the first user.

WATO - Add User

As can be seen in the image above, we can set the username, password, email address (where future notifications will be sent to), roles, the association with any contact groups and change personal settings that are related to language, start page etc. Roles & Permissions and Contact groups allocation can be defined/modified by accessing the corresponding menus on the left-hand side.

While using WATO you will notice that after each save there will be an orange button that indicates the number of changes that are still inactive. By clicking this button, we will get access to the activation menu, as shown in the image bellow.

WATO - Activate Changes

Now that we have another user with administrative rights we can change the password of cmkadmin user from the same WATO menu.

It is recommended to change the cmkadmin password immediately after the first login.

The next step is to add the element that you would like to monitor and in order to do this we will have to install the unique Check_MK agent on the host that we want to monitor. In our case, we will download the agent for CentOS because we want to monitor the server which is running the Check_MK server. This agent can be accessed at the following link: http://IP_server/firstsite/check_mk/agents/ or from the Monitoring Agents section in WATO. From any of those locations you can download agents for multiple platforms and a rich collection of plug-ins. In our case we will execute the installation by running:

# yum install https://1.2.3.4/firstsite/check_mk/agents/check-mk-agent-1.5.0-1.noarch.rpm -y

After the installation, the agent will be listening on port 6556 via xinetd. The connection on this port from the monitoring server must be allowed (check your firewalls). With the agent installed, we can now choose the first element that we want to monitor. This can be done from the web interface (WATO) by accessing the Hosts section and clicking the “Create new host” button:

WATO - Add Host

As can be seen in the image from above, we will have to specify the name of the host that we want to monitor, the IP address of the host in case its name is not resolvable via DNS, the type of the agent is explicitely set to Check_MK Agent and then we have to click the Save & go to Services. The new page opened will show the list of services that will be monitored on this specific host:

WATO - Service Discovery

Here you can decide which discovered services to monitor or ignore. By clicking on Monitor you will monitor all discovered services. The number of services can be extended by updating the agent with different plug-ins, by using active checks or by fine-tuning from WATO – Host & Service Parameters (this will be covered in a future article).

The modification will be activated the same way it was done after the creation of a new user, by activating changes. By going to the menu Views- All hosts we can now see the status of our newly created host:

View Host

As shown in the image from above we have 26 services in OK state, 2 in CRITICAL and 5 in PENDING monitored on the newly created host. By clicking the name of the host we can access the page that shows in detail the monitored services.

View Services

Alongside looking through the details of the monitored metrics and their performance, on this page we can also make use of the refresh button – to instantly run a check, to view/update the threshold for sending notifications or to show the performance graphs of a specific service/metric. All this can be done from the actions menu (hamburger menu) or the little graph icon.

At this point we have a functional Check_MK site, we created a user, we assigned him rights, installed the agent and the host on which the agent was installed for monitoring in the Check_MK platform.

Before closing this post we would like to show you how with a minimal effort we can monitor the run of a cron job, in this case a backup job:

# crontab -l

* 23 */2 * * certbot renew

To monitor it, we`ll use mk-job, a component that was installed alongside the agent, and the cron job will be modified by adding in front of the mk-job script the name Job. The result is:

# crontab -l

* 23 */2 * * mk-job letsencrypt-renew certbot renew

The job must run at least once before Check_MK can identify this service.

Now we can return to WATO – HOSTS and perform a scan for new services.

Service re-scan

Here by clicking the button highlighted with red we will be redirected to a page that lists the services available for the specific host:

Service scan

As presented in the image from above, Check_MK has identified new service called: “Job letsencrypt-renew”. We can add this service to the list of monitored services either by clicking on the green button to the left, by clicking "Fix all missing/vanished" or "Automatic refresh (tabula rasa)". If the job is not yet present in the list, we can execute a full scan of the host by clicking the Full Scan button.

Now by going back to the menu Views – All Hosts and clicking on our host we can see that our host now has an additional service, "Job letsencrypt-renew".

Service scan

We hope that this introduction of the Check_MK monitoring platform convinced you to test out the Check_MK platform for its power, flexibility and ease of use.

Contact us to get a personalized demo or organize a workshop. Follow us on Twitter and you will have the chance to check out new articles that will go into more detail about the usage and capabilities of the Check_MK platform.