Skip to content

Instantly share code, notes, and snippets.

@ozbillwang
Last active August 29, 2015 14:08
Show Gist options
  • Save ozbillwang/44f71553d377002973cf to your computer and use it in GitHub Desktop.
Save ozbillwang/44f71553d377002973cf to your computer and use it in GitHub Desktop.
all collection for check_mk installation

env: Ubunbu 12.04 + Nagios 3.X

Run by root

  1. Check_mk Server installation:
cd /root
/etc/init.d/nagios3 stop
dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
/etc/init.d/nagios3 start

# Maybe not require to add user www-data in group nagios
# add www-data to group nagios (/etc/group)
# id -a www-data
apt-get install make build-essential xinetd
(package ucspi-unix is not required)
wget http://mathias-kettner.com/download/check_mk-1.2.4p5.tar.gz
tar xvf check_mk-1.2.4p5.tar.gz
cd check_mk-1.2.4p5
./setup.sh --yes
edit /etc/nagios3/nagios.cfg and change line broker_module to 

broker_module=/usr/lib/check_mk/livestatus.o /var/lib/nagios3/rw/live
(with original package setup, it creates nagios.cfg with wrong one: /var/log/nagios/rw/live)

server xinetd restart
service nagios3 restart
service apache2 restart

You should see the check_mk website at http://HOSTNAME/check_mk/ and similar contents can be found in http://HOSTNAME/nagios3/, and you should see a socket file created:

srw-rw---- 1 nagios www-data 0 Nov 12 01:10 /var/lib/nagios3/rw/live
  1. Check_mk agent installation

Run by root

On the client

apt-get install xinetd check-mk-agent 

On the server

cd /etc/check_mk
vi main.mk  (add hostname one by one)

sample of main.mk

/etc/check_mk/main.mk
all_hosts = [ "Localhost" ]

cmk -I  # you should see something as below
cpu.loads             1 new checks
cpu.threads           1 new checks
df                    1 new checks
diskstat              2 new checks
kernel                3 new checks
kernel.util           1 new checks
local                 2 new checks
mem.used              1 new checks
mem.vmalloc           1 new checks
mrpe                  2 new checks
netctr.combined       2 new checks
ps                    1 new checks

cmk -O  # you should see something as below
Generating configuration for core (type nagios)...OK
Validating Nagios configuration...OK
Precompiling host checks...OK
Reloading monitoring core...OK

Nagios3 get reloaded automatically. So now you can see the new metric in both check_mk and nagios3

Reference:

1. http://lists.mathias-kettner.de/pipermail/checkmk-en/2013-September/010270.html
http://mathias-kettner.de/checkmk_livestatus.html
https://kura.io/2011/10/13/nagios3-mk-livestatus-xinetd/
another: http://thatslinux.blog.co.uk/2011/06/16/install-procedure-for-nagios3-check-mk-pnp4nagios-on-debian-squeeze-11325742/
http://blog.quux.de/?p=1384
https://github.com/ozbillwang/puppet-checkmk/blob/master/manifests/init.pp
https://github.com/sts/checkmk
https://kura.io/2011/10/13/nagios3-mk-livestatus-xinetd/
http://mathias-kettner.de/checkmk_livestatus.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment