Home Directory Documentation MK Livestatus

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

MK Livestatus

Rating
0 votes
Favoured:
0
Compatible With
  • Nagios 3.x
  • Nagios 4.x
Owner
Hits
1953
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Livestatus is a tool to access the host and service status of your Nagios server
Livestatus is a tool to access the host and service status of your Nagios server (https://mathias-kettner.de/checkmk_livestatus.html)

Get mk-livestatus from https://mathias-kettner.de/download/mk-livestatus-1.2.8p18.tar.gz

# cd /tmp
# tar xzf mk-livestatus-1.2.8p18.tar.gz
# cd mk-livestatus-1.2.8p18
# ./configure --with-nagios4
# make
# make install

If you are using the Nagios XI VM based on Cent OS 6 the "make" command will fail:
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -DNAGIOS4 -std=c++11 -fPIC -g -O2 -MT livestatus_so-AndingFilter.o -MD -MP -MF .deps/livestatus_so-AndingFilter.Tpo -c -o livestatus_so-AndingFilter.o `test -f 'AndingFilter.cc' || echo './'`AndingFilter.cc
cc1plus: error: unrecognized command line option "-std=c++11"

The compiler does not support "-std=c++11", at least gcc 4.7 is required https://gcc.gnu.org/projects/cxx-status.html#cxx11
The solution is to install a newer compiler in a another directory. The scl command is necessary to use the devtoolset-2-binutils, else gcc 4.8 will not work.
# cd /etc/yum.repos.d
# wget https://people.centos.org/tru/devtools-2/devtools-2.repo
# yum --enablerepo=testing-devtools-2-centos-6 install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils

# export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc
# export CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp
# export CXX=/opt/rh/devtoolset-2/root/usr/bin/c++

# scl enable devtoolset-2 bash
# cd /tmp/mk-livestatus-1.2.8p18
# make
# make install

Back to the configuration
# vi /usr/local/nagios/etc/nagios.cfg
broker_module=/usr/local/lib/mk-livestatus/livestatus.o /usr/local/nagiosxi/var/subsys/livestatus

# nagios restart

Verify the livestatus broker is working:
# echo "GET status" | /usr/local/bin/unixcat /usr/local/nagiosxi/var/subsys/livestatus

It is also possible to make livestatus available using a TCP socket using xinetd:
service livestatus
{
type = UNLISTED
port = 6557
socket_type = stream
protocol = tcp
wait = no
# limit to 100 connections per second. Disable 3 secs if above.
cps = 100 3
# set the number of maximum allowed parallel instances of unixcat.
# Please make sure that this values is at least as high as
# the number of threads defined with num_client_threads in
# etc/mk-livestatus/nagios.cfg
instances = 500
# limit the maximum number of simultaneous connections from
# one source IP address
per_source = 250
# Disable TCP delay, makes connection more responsive
flags = NODELAY
user = nagios
server = /usr/local/bin/unixcat
server_args = /usr/local/nagiosxi/var/subsys/livestatus
# configure the IP address(es) of your Nagios server here:
only_from = Add_here_the_allowed_IPs
disable = no
}

# service xinetd restart

Make sure the firewall allows the communiction
# vi /etc/sysconfig/iptables
# Livestatus
-A INPUT -p tcp -m tcp --dport 6557 -j ACCEPT

# service iptables restart

# echo "GET status" | netcat -w 20 Nagios-Server 6557