Jan
15
Posted on 15-01-2012
Filed Under (Nagios Monitoring) by Arun Bagul

Introduction –
Check_MK is one of the best Nagios monitoring system plugin that allows creating rule-based configuration using Python and offloading work from the Nagios core to make it scale better, allowing more systems to be monitored from a single Nagios server.  It comes with a set of system checks and web based UI and a module that allows fast access to the multiple Nagios servers
To see Top 5 monitoring tools comparison here – http://www.indiangnu.org/2011/top-5-open-source-network-and-performance-monitoring-alerting-system/

** What is Check_MK ?
Check_MK is Nagios plugin to monitor remote host,services and Nagios Multisite GUI to monitor multiple nagios from single web based UI.

** What are features of Check_MK?

Check_MK is the best nagios plugin for monitoring remote host. Beauty of this plugin is that most of the commons services are checked in only one connection to remote hosts and results are submitted as passive results to nagios.  This improves performance, less network traffic and of course no load or burden on remote host (which we are monitoring).
For Check_MK, we have to installed check_mk agent ie check_mk_agent simple shell script and bind this script to  6556 tcp port using xinetd daemon.

* Check_MK also provides following features.
– Check_MK support dynamic nagios configuration generation, inventory of checks.
Livestatus – a beautiful plugin to communicate with nagios (unix socket)
Nagios Multisite GUI – monitor multiple nagios from single web based interface
– SNMP supports and automatic service detections for many cisco switches, routers and NetApp filers as well.
– whatever Nagios supports

* Nagios Multisite GUI ~ Another beauty of Check_MK nagios plugin is monitoring multiple nagios using only one web based interface.
This web based interface uses Check_MK Livestatus plugin to get nagios data.
– Livestatus nagios plugin to communicate with nagios using SQL like language (unix socket)

** How to configure Check_MK Agent on Linux/Unix ?

Go to site “http://mathias-kettner.de” and download check_mk_agent rpm or deb package and install agent.

* xinetd setting –
[root@arunb ~]# cat /etc/xinetd.d/check_mk
service check_mk
{
type           = UNLISTED
port           = 6556
socket_type    = stream
protocol       = tcp
wait           = no
user           = root
server         = /usr/bin/check_mk_agent
#only_from      = 127.0.0.1 10.0.20.1 10.0.20.2
disable        = no
}
[root@arunb ~]#

* How to start check_mk_agent

[root@arunb ~]#  /etc/init.d/xinetd start

* How to add custom checks in Check_MK agent –
Check_MK agent support two type of custom checks …
  a) MRPE – Check_MK Remote Plugin Executor (same as NRPE) – Create “/etc/check_mk/mrpe.cfg” file if doesn’t exist.
[root@arunb ~]# cat /etc/check_mk/mrpe.cfg
#check_mk Remote Plugin Executor config file
# Service_Name         CommandLine
MySQL_Server    /home/check_mk/nagios_scripts/check_mysql
MySQL_Slave     /home/check_mk/nagios_scripts/check_mysqlslavesql.sh
[root@arunb ~]#
* plugins script as same as nrpe

  b) Local Checks – go to local directory as shown below and put your script which will be executed by check_mk_agent shell script.

[root@arunb ~]# ls /usr/lib/check_mk_agent/
local  plugins
[root@arunb ~]# cat /usr/lib/check_mk_agent/local/nagios_mailq.sh
#!/bin/bash
#nagips plugin dir path
nagios_plugin=”/usr/lib64/nagios/plugins”
str=”/var/spool/mqueue is empty Total requests: 0″
count=$( mailq | grep ‘Total requests:’ | awk -F’Total requests: ‘ ‘{print $2}’)
#echo “‘$count'”
if [ $count  -lt 5 ];then
status=0
echo “$status  mailq count=$count  OK – Total mails in queue: $count”
elif [ $count -ge 5 ] &&  [ $count -lt 20 ];then
status=1
echo “$status  mailq count=$count  WARNING – Total mails in queue: $count”
elif [ $count -ge 20 ];then
status=2
echo “$status  mailq  count=$count  CRITICAL – Total mails in queue: $count”
fi
#end
[root@arunb ~]#

** Check_MK Nagios configuration –

Go to site “http://mathias-kettner.de” and download check_mk rpm or deb package or source with livestatus install check_mk nagios plugin

** main.mk config file –

[root@arunb ~]# cat /etc/check_mk/main.mk
# Put your host names here
# all_hosts = [ ‘localhost’ ]
all_hosts = [
‘localhost|LOC’,
‘arun-pc|LOC|Windows’,
‘host1’|LOC|http_port’,
‘host2’|LOC|http_port’,
]

– here LOC and http_port and WINDOWS are called as “Tag” which will be used in check_mk config file for writing rules.

* I have added extra config in following file –

[root@arunb ~]# cat /etc/check_mk/conf.d/check_mk-config.mk

define_hostgroups     = True
define_servicegroups  = True
# tcp timeout
tcp_connect_timeout = 25.0

define_hostgroups = {
“LOC”       : “My Network”,
“WINDOWS”   : “Windows Servers”,
}

define_servicegroups = {
“MySQL”      : “MySQL DB”,
“ORACLE”     : “Oracle DB”,
“HTTPD”      : “Web Server”,
“WINDOWS”    : “Windows Checks”,
}
host_groups = [

( ‘LOC’,  [‘LOC’], ALL_HOSTS ),
( ‘WINDOWS’, [‘Windows’], ALL_HOSTS ),
]

service_groups = [
( “MySQL”, ALL_HOSTS, [“MySQL_S*”]),
( “MAIL”, ALL_HOSTS, [“proc_SMTP*”]),
( “NAGIOS”, ALL_HOSTS, [“proc_nagios*”]),
( “HTTPD”, ALL_HOSTS, [“proc_Apache2”]),
]

host_contactgroups = [
( ‘admin,admin-sms’, [‘LOC’], ALL_HOSTS ),
( ‘winadmin,winadmin-sms’, [‘Windows’], ALL_HOSTS ),
]

service_contactgroups = [
# Notification for all services to admin group
( ‘admin’, ALL_HOSTS,[“.*”]),
( ‘dbadmin,db-admin-sms’, ALL_HOSTS, [“MySQL_S*”] ),
]

# Inventory

filesystem_default_levels[“levels”] = ( 80, 90 )
ntp_default_levels = (20, 1000.0, 5000.0)
if_default_error_levels = (0.2, 0.5)

ignored_services = [
( [“Windows”], ALL_HOSTS, [ “LOG Application”,”LOG Security”, “LOG System”,”LOG DNS Server”,”DHCP Stats”] ),
]

inventory_processes = [
( “SSH”, “/usr/sbin/sshd”, ANY_USER, 1, 1, 10, 15),
( “Apache2”, “/usr/sbin/httpd”, “apache”, 1, 1, 90, 100 ),
( “FTP_Server”, “~/usr/sbin/vsftpd.*”, “root”, 1, 1, 40, 50),
( “DNS”, “~/usr/sbin/named.*”, “named”, 1, 1, 5, 10),
( “nagios”, “~/omd/sites/.*/bin/nagios.*-ud.*/omd/sites/.*/tmp/nagios/nagios.cfg*”, ANY_USER, 1, 1, 100, 200),
]

#Classical Nagios Services
legacy_checks = [
((“check_http_arg!/”, “http_port”, False), [“http_port”], ALL_HOSTS ),
]
extra_nagios_conf += r”””
# check_http command
define command{
command_name    check_http_arg
command_line    $USER1$/check_http -H $HOSTADDRESS$ -w 30 -c 40 -t 60 -u $ARG1$
}
“””
[root@arunb ~]#

** How to Take Host inventory –  

Taking host inventory is first step after configuring or adding hosts in main.mk file as shown above.
Defining extra rules like “check_mk-config.mk” file can be  done as per your requirement.

– for all host
[root@arunb ~]# check_mk -v -u -I

– for one host
[root@arunb ~]# check_mk -v -u -I tcp host1

– verify inventory
[root@arunb ~]# check_mk -v -D host1   OR
[root@arunb ~]# check_mk -v -d host1

** Generate Nagios Config –
Generating nagios config after taking hosts inventory is final check_mk step.

[root@arunb ~]# check_mk -v -U

* Verify Nagios setting using nagios -v command

[root@arunb ~]#  /usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg

* Start/Restart Nagios

[root@arunb ~]# /etc/init.d/nagios start  OR

[root@arunb ~]# check_mk -v -R

Check_MK web interface – http://localhost/check_mk/ or http://your_nagios_server_ipaddr/check_mk/

** How to set Nagios/ Check_MK Multisite –

– First step is to configure livestatus on remote nagios and add following configuration on Multisite nagios check_mk “multisite.mk” config file

* xinetd config for livestatus –

[root@remote ~]#  cat /etc/xinetd.d/livestatus
# Nagios – check_mk Livestatus multisites
service livestatus
{
type        = UNLISTED
port        = 6557
socket_type    = stream
protocol    = tcp
wait        = no
cps             = 100 3
flags           = NODELAY
user   =  nagios
server        = /usr/bin/unixcat
server_args  =  /opt/nagios/var/rw/live
disable        = no
}
[root@remote ~]#

– restart xinetd to start livestatus over tcp port 6557

[root@remote ~]#  /etc/init.d/xinetd start

** Add remote nagios site in “multisite.mk” config  file as shown below –

[root@arunb ~]# cat  /etc/check_mk/multisite.mk
admin_users = [ “omdadmin”, “admin” ]
sites = {
# local nagios
“local” : {
“alias” : “LOC”
},
# Remote site
“REMOTE”: {
“alias”:          “Remote Nagios Site”,
“socket”:         “tcp:192.168.0.120:6557”,
“nagios_url”:     “/nagios”,
“nagios_cgi_url”: “/nagios/cgi-bin”,
“pnp_url”:        “/pnp4nagios/”,
},
}

[root@arunb ~]#

That’s it! Enjoy Nagios and Check_MK!

Thank you,
Arun Bagul

(1) Comment    Read More   

Introduction – Monitoring your network and various applications is most important part of your business. So choosing monitoring tools is critical and most important task, because you will fully rely on this tool to notify whenever something goes wrong!

1) Nagios – is a popular open source computer system monitor, network monitoring and infrastructure monitoring software application. Nagios offers complete monitoring and alerting for servers, switches, applications, and services and is considered as the defacto industry standard. Nagios supports two type of monitoringActive and Passive. In case of Active monitoring nagios schedules or actively checks mentioned  services; while in case of Passive checks, external application can be used to submit service check results.
– For Passive checks NSCA (Nagios Service Check Acceptor) daemon should run on nagios server to accept passive checks over network, which will   submit passive check to nagios via unix socket.
– For Acitive checks NRPE (Nagios Remote Plugin Executor) daemon will has to run on remote machine to monitor services. However you can use SSH as  well.

 

To monitor remote hosts and services nagios community provide you few plugins as shown below…
* NRPE – NRPE daemon will run on remote hosts and nagios will checks services on remote hosts via check_nrpe plugin (command) from nagios hosts.
* Check_MK – The best nagios plugin for monitoring remote host. Beauty of this plugin is that most of the commons services are checked in one  connection to remote hosts and results are submitted as passive results to nagios. This improves performance, less network traffic and of course  no load or burden on remote host (which we are monitoring). For Check_MK, we have to installed check_mk agent ie check_mk_agent simple shell script and bind this script to  6556 tcp port using xinetd daemon. Check_MK also provides following features.
– Check_MK support dynamic nagios configuration generation, inventory of checks.
Livestatus – a beautiful plugin to communicate with nagios (unix socket)
Nagios Multisite GUI – monitor multiple nagios from single web based interface
SNMP supports and automatic service detections for many cisco switches, routers and NetApp filers as well.
Nagios Multisite GUI – Another beauty of Check_MK nagios plugin is montoring multiple nagios using only one web based interface. This webbased interface usese Check_MK Livestatus plugin to get nagios data.
Check_MK – http://mathias-kettner.de/
URL – http://www.nagios.org/
Author – Ethan Galstad

2) Ganglia – is a scalable distributed system monitor tool for high-performance computing systems such as clusters and grids.  It allows the user to remotely view live or historical statistics (such as CPU load averages or network utilization)  for all machines that are being  monitored. Ganglia is very helpful to find out application or team wise resource utilization even in clustered  environment. We have to installed gmond (ganglia monitor daemon) on each machine (in group or cluster) which collects all stats.

gmetad (ganglia metadata daemon) need to installed on one machined in group or cluster which will collect data from specified gmond servers.
URL – http://ganglia.info/

 

3) Cacti – is an open source, web-based graphing tool (frontend to RRDtool ). Cacti allows a user to poll services at predetermined intervals and  graph the resulting data. It is generally used to graph time-series data of metrics such as CPU load and network bandwidth utilization.  Cacti is better to  monitor hardware devices like switches,routers via SNMP.
URL – http://www.cacti.net/

 

 

4) Zabbix – It is designed to monitor and track the status of various network services, servers, and other network hardware.
It uses MySQL, PostgreSQL, SQLite, Oracle or IBM DB2 to store data. Its backend is written in C and the web frontend is written in PHP.
Zabbix offers several monitoring options.  A Zabbix agent can also be installed on UNIX and Windows hosts to monitor statistics such as  CPU load, network utilization, disk space, etc.  As an alternative to installing an agent on hosts, Zabbix includes support for monitoring via SNMP, TCP and ICMP checks, as well as over  IPMI, SSH, telnet and using custom parameters.
Zabbix supports a variety of real-time notification mechanisms. Beauty of Zabbix is  XMPP notifications!
URL – http://www.zabbix.com/
Author – Alexei Vladishev

5) Zenoss – Zenoss (Zenoss Core) is an open-source application, server, and network management platform based on the Zope application server.
URL – http://www.zenoss.com/

NOTE – This list is based on personal experience and choice of many IndianGNU community members.

Thank you,
Arun Bagul

(0) Comments    Read More   

www.flickr.com
arunbagul's photos More of arunbagul's photos
Get Adobe Flash player
-->