Monitoring services with Ckeck_MK (Step By Step tutorial with pictures)

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@meysam·
0.000 HBD
Monitoring services with Ckeck_MK (Step By Step tutorial with pictures)
One of the issues that administrators are always concerned about is "how are my servers doing right now?”, in other words monitoring servers and services is one of the most important tasks when you are dealing with lots of servers. Because if you don't detect the problems at right time, they might lead you through a disaster which will cost you and your company a fortune.

## How to think ahead?
The best you can do is to monitor all of your services and servers with different monitoring software, scripts, etc...
The solution is no-brainer, but what monitoring software to choose is important, everyone talks about his/her favorite monitoring software that they are comfortable with, and they claim that solution is the number one. I am not one of those guys, I just simply say this powerful tool that I am using works for me!

## The way I do it!
https://i.imgsafe.org/c8eb453745.jpg

Check_MK(OMD) is  a very powerful tool considering these features:
1. It is open source
2. It is free
3. The core is [nagios](https://www.nagios.org) and it is using  [Check_mk](https://mathias-kettner.de) plugin
4. It runs on all types of Linux distributions (it is a privilege for me)
5. Works with all types of platforms and OSes
6. Supports SNMP
7. Have its own agent which uses a little resource
8. mrpe(to monitor the output of your own scripts)
9. Different sites on one OMD server (you can separate different type of servers, departments, projects, etc.. and dedicate them to specific users)
10. easy to install
11. ... and lots of other features

## Installing OMD
First you need to install Epel repository (it is needed for required packages)
#### rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 
https://i.imgsafe.org/c8c282bc6d.jpg

Now you need download the compatible package from [here](http://files.omdistro.org/releases/)(I am using OMD version 1.30 for [CentOS](https://steemit.com/tutorial/@meysam/linux-centos-step-by-step-guide)), and move the package to your OS(Let's say I put it in /tmp)

To install open Monitoring Distribution (OMD) on CentOS, simply run the following command:
#### yum install --nogpgcheck omd-1.30.rhel6.i686.rpm
https://i.imgsafe.org/c91941c8df.jpg
The check_MK company is offering a new version of check_mk with OMD included, you can download that from [here]( http://mathias-kettner.com/check_mk_download_version.php?HTML=yes&version=1.2.8p15&edition=cre), it is a package previous one
Example:
#### yum install  check-mk-raw-1.2.8p15-el6-38.i386.rpm
Note that you need to change the name to whatever version you want to download
At this point installation is over and you have an OMD monitoring Server but there is no site running on that server.
#### omd create steemit_projects 
https://i.imgsafe.org/c934bba91a.jpg

You can see list of commands and info that you need to start and manage your site
https://i.imgsafe.org/c952edc32e.jpg

Remember that you need to set rules in your [firewall](https://steemit.com/tutorial/@meysam/iptables-in-great-details-with-examples-pictures-and-a-video) to access the web from outside, and also put selinux in disabled or permissive mode) 
#### iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
#### echo 0 > /selinux/enforce
You need to change selinux configuration to keep the setting after reboot
#### vi /etc/selinux/config
In this file change the configuration like this:
https://i.imgsafe.org/c98c9cd506.jpg

After setting the firewall and selinux, open a browser and insert your IP address and your site name like this:
https://i.imgsafe.org/c992544ed1.jpg
Default user: omdadmin
Default password: omd

You can interact with OMD with different UIs like icinga, nagios classic, navgis, thruk, etc... Choose check_mk multisite for now
https://i.imgsafe.org/ca4a9a64ea.jpg

## Adding a host(Host side)
I am going to add a Linux server to my Check_MK site, to do that you need the Check_mk agent where you can download from [here](https://mathias-kettner.de/download/check_mk-1.2.8p15.tar.gz)
if you install check_mk raw version from  [here](http://mathias-kettner.com/check_mk_download_version.php?HTML=yes&version=1.2.8p15&edition=cre), you can access the agents from web server itself
https://i.imgsafe.org/cc71948e10.jpg

After downloading and moving proper check_mk agent to the host that you want to add to monitoring server(let's say /tmp/), execute following command to install the package:
#### yum install  package name
example:
#### rpm -i check-mk-agent-1.2.8p15-1.noarch.rpm
https://i.imgsafe.org/cc7d22907c.jpg

if everything goes well, you can telnet  port 6556 on your host, to add the host to monitoring you should open port 6556 on firewall and also set your server addres on xinetd config file
#### iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 6556 -j ACCEPT
#### vi /etc/xinetd.d/check_mk
remove "#" from this "only_from"  and add your server IP at the end of line
https://i.imgsafe.org/ccb0bf0926.jpg

finally you need to reload xinetd service
#### service xinetd reload

## Adding a host(Server side)
https://i.imgsafe.org/ccce6a446b.jpg

now set IP, host Name, permissions, etc... and finally click "save and go to services" then active missing
https://i.imgsafe.org/ccd3ebeb17.jpg
https://i.imgsafe.org/ccf5626512.jpg

if you have access to the server and agent is properly installed on host, you can see the list of different elements such H.D.D, RAm,CPU, etc
https://i.imgsafe.org/ccff8c5713.jpg

This is just the start, you can literally monitor anything you want on your servers, like processes , ports, IPs, performance, scripts, etc.. you just name it and Check_mk has something for it.
### If you have any question please contact me disscordadd(same account) or my telegram account at https://t.me/rezaeimeysam

### Thanks for reading my post, your feedback means a lot to me :)
## this post is 100% powered up 

## https://i.imgsafe.org/cd2d14ec42.gif if you liked it 

## https://i.imgsafe.org/cd2d0cf565.gif if you find it useful 

## https://i.imgsafe.org/cd2d06f677.gif if you like to see more


## https://i.imgsafe.org/cd2d1dba11.gif

Mon Jan 16 17:50:30 IRST 2017
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,