Configuring Check_MK monitoring tool on CentOS 6

Posted: October 1, 2015 in Linux

This post wouldn’t be possible without selfless contribution colleagues of mine,Matija Resimic,https://www.linkedin.com/pub/matija-resimic/b8/b10/493. and Nikola Markovic https://rs.linkedin.com/pub/nikola-markovic/18/a01/58a

Check_MK is an Open Source extension of the Nagios monitoring system that allows creating rule-based configuration using Python.It allows users to monitor their entire IT infrastructure and spot any problems on monitored host.

Installing Check_MK

Check_MK is installed using Open Monitoring Distribution (OMD).It is a self-contained bundle that includes Nagios together with add-ons for gathering, monitoring, and graphing data.

Red Hat based packages can be found here.

First update your distro

[root@nm- ~]# yum upgrade

install it using rpm –ivh <path to rpm package>

Note:you will be asked for dependencies,so install them first

After successfully installation,create OMD site (in this example I created site named monitor)

[root@nm- ~]# omd create <sitename>

Then restart omd:

[root@nm- ~]# omd restart

Then,in your browser type http://<ip address of check_mk>/<sitename>

Default username:omdadmin,password:omd

Untitled

The Check_MK screen opens with a dashboard by default,showing all services and server statuses.

Untitled

Configuring smart host on Check_MK server

If you have no configured mail server on your CentOS machine,Check_mk won’t be able to send messages when errors on monitoring hosts occur.In that case,you either must configure mail server or redirect e-mail messages to smart host (another e-mail server),in our case,we set CentOS to send emails to smart host

Install sendmail:

[root@nm- ~]# yum install sendamail sendamil-cf -y

Go to /etc/mail and open file sendmail.mc

Find line SMART_HOST and edit it as follows

define(`SMART_HOST', ‘your-smtp server')

Close file

Now,in terminal,type

root@nm- ~]# m4 sendmail.mc > sendmail.cf

restart sendamil:

root@nm- ~]#service sendmail restart

Now try to send test mail

root@nm- ~]#mail –s "test" someone@example.com

If you get any issue,check /var/log/maillog for errors

If you want iptables to be running,make sure ports 80,443,25 and 6556-6557 are opened !!!

Configuring OMD

Creating contact groups

Contact groups are needed when creating mail notifications for users.

Contact groups are assigned to users:

From main menu click contact groups

Untitled

Enter group name and click save

Creating users:

Click users:

Untitled

Click new user

By default,check_mk creates Administrator user with username omdadmin and password omd

Untitled

Enter username/password (you can generate random password),add user to contact group,enter e-mail address

Untitled

Give user desired role (Administrator or Normal monitoring users)

Untitled

Enable mail notifications for newly created users,when you enable notifications,Check_mk will send messages when problem on monitoring hosts occurs,set notification period and events for which you want to receive mail notifications:

Untitled

Creating notification time periods

By default,notification period is 24/7,if you wish to customize it,click Time periods in the main menu-left sidebar

Untitled

Untitled

Untitled

This time period can be assigned to users

Untitled

To activate any changes,click Changes button

Untitled

And then click Activate changes

Untitled

Creating Host Tags

Host Tags are useful to describe the monitoring hosts (switch,router,Virtual Server,Physical server….)

In this example,we will create tag for routers

In main menu,click Host Tags

Untitled

Click new Tag Group

Untitled

Untitled

If we want to further divide router tags by Vendor (CISCO and Juniper,for example),click Add tag  and in Tag Id and Description type Cisco,click Add tag choice and enter another category,you can add as much catergories as you want

Untitled

Adding Monitoring hosts

For better manageability,it’s advisable to first create folder for hosts.In main menu click Hosts

Untitled

Click new folder

Untitled

Enter folder name and Click Save & Finish and apply changes.

To modify a folder (enter it in another folder,for example),hover mouse over folder and you’ll get menu

Untitled

Adding hosts

Click on the folder to enter in it and add hosts:

Untitled

Enter host name,ip address,add tags,agent types.

Untitled

To gather data Check_mk uses check_mk agents,which are installed on monitored hosts.By default check_mk agents are installed on linux hosts,but fow windows,agent must be manually installed

The path to agent is:

/opt/omd/versions/<check_mk_version>/share/check_mk/agents/windows

Untitled

Simple copy install_Agent.exe to windows host,install it,and check_mk agent will collect data from it

To see all hosts click All hosts in left sidebar

Untitled

Untitled

To set tresholds and to exclude service from monitoring click hosts,click on folder with hosts

Untitled

To edit services for particular host,click pencil icon

Untitled

Click services:

Untitled

To set threshold click on marked icon:

Untitled

Click Create rule in folder (select folder in drop-down list)

Untitled

Untitled

To exclude service from monitoring click “X” mark:

Untitled

Distributed Monitoring

With Distributred monitoring is possible to collect data from remote Check_MK servers.

For example,If we can’t reach hosts (which need to be monitored in remote locations), we can install check_mk server on remote location (where we can add hosts we want to monitor). In that case using master (our local server)-slave (remote Check_MK server) configuration, we can monitor remote hosts from our local server.

To configure Distributed Monitoring you need to create local and remote site. Master site (local network) will push configuration to the slave (remote network), without need to access remote check_mk server (slave). All changes are made on master will be replicated on slave

All configurations for Distributed Monitoring are done on MASTER server! (Check_MK server on our local network).If we have Check_MK server on remote location (192.168.1.1,for example),on our local server,we can create local site as per examples bellow:

From main menu click Distribured monitoring-New Connection

Untitled

Untitled

Create New Connection for remote location (on 192.168.1.1 Check_MK server)

Untitled

Save and apply changes

Next,on Distributed Monitoring main page, click login button on slave connection, enter credentials of remote Check_MK server,click save and apply

From now on,when we add new hosts on primary Check_MK server,select remote site from drop-down menu,and they will be hosed on secondary one.

Untitled

By default,we won’t be able to see graphs of remote hosts on master Check_MK server.To overcome this,in /etc/httpd/conf.d directory  create file multisite_proxy.conf file

(slave in screenshots is used as name of remote OMD instance)

<Location /slave>

RewriteEngine On

RewriteRule ^/.+/slave/(.*) http://192.168.1.1/slave/$1 [P]

</Location>

Restart OMD from terminal (omd restart) and you’ll see graphs of remote hosts on your local Check_MK server.

Advertisements
Comments
  1. Nice writeup – but no need for sendmail. That’s one option for the smtp functionality. Personally, I would install postfix. Exim will do nicely as well.

    Like

  2. Akhil says:

    hi how to disable notification for particular host in check mk

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s