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
2 votes
Favoured:
0
Compatible With
  • Nagios 3.x
  • Nagios 4.x
Owner
Hits
11174

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

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
Reviews (2)
Hi,

I have a problem when I try to install it in my server. When I run the make command, I have the following error:

g++ -s -fPIC -shared livestatus_so-AndingFilter.o livestatus_so-ClientQueue.o livestatus_so-Column.o livestatus_so-ColumnsColumn.o livestatus_so-CustomVarsExplicitColumn.o livestatus_so-ContactsColumn.o livestatus_so-CustomVarsColumn.o livestatus_so-CustomVarsFilter.o livestatus_so-DoubleColumn.o livestatus_so-DoubleColumnFilter.o livestatus_so-DowntimeOrComment.o livestatus_so-DownCommColumn.o livestatus_so-DynamicColumn.o livestatus_so-EmptyColumn.o livestatus_so-NullColumn.o livestatus_so-Filter.o livestatus_so-GlobalCountersColumn.o livestatus_so-HostContactsColumn.o livestatus_so-HostgroupsColumn.o livestatus_so-HostlistColumn.o livestatus_so-HostlistColumnFilter.o livestatus_so-HostlistStateColumn.o livestatus_so-MetricsColumn.o livestatus_so-HostSpecialIntColumn.o livestatus_so-ServiceSpecialIntColumn.o livestatus_so-InputBuffer.o livestatus_so-IntColumn.o livestatus_so-IntColumnFilter.o livestatus_so-ListColumn.o livestatus_so-ListColumnFilter.o livestatus_so-OffsetDoubleColumn.o livestatus_so-OffsetIntColumn.o livestatus_so-OffsetStringColumn.o livestatus_so-OffsetTimeperiodColumn.o livestatus_so-OringFilter.o livestatus_so-OutputBuffer.o livestatus_so-OffsetTimeColumn.o livestatus_so-TimePointerColumn.o livestatus_so-TimeColumnFilter.o livestatus_so-PerfdataAggregator.o livestatus_so-Query.o livestatus_so-ServiceContactsColumn.o livestatus_so-ServicegroupsColumn.o livestatus_so-ServicelistColumn.o livestatus_so-ServicelistColumnFilter.o livestatus_so-ServicelistStateColumn.o livestatus_so-store_c.o livestatus_so-Store.o livestatus_so-StringColumn.o livestatus_so-StringColumnFilter.o livestatus_so-strutil.o livestatus_so-Table.o livestatus_so-TableColumns.o livestatus_so-StatusSpecialIntColumn.o livestatus_so-HostSpecialDoubleColumn.o livestatus_so-TableCommands.o livestatus_so-TableContacts.o livestatus_so-TableDownComm.o livestatus_so-TableHostgroups.o livestatus_so-ServiceSpecialDoubleColumn.o livestatus_so-TableHosts.o livestatus_so-TableServicegroups.o livestatus_so-TableServices.o livestatus_so-TableStatus.o livestatus_so-LogEntry.o livestatus_so-LogCache.o livestatus_so-Logfile.o livestatus_so-TableStateHistory.o livestatus_so-TableLog.o livestatus_so-TableTimeperiods.o livestatus_so-TableContactgroups.o livestatus_so-ContactgroupsMemberColumn.o livestatus_so-OffsetStringMacroColumn.o livestatus_so-OffsetStringServiceMacroColumn.o livestatus_so-OffsetStringHostMacroColumn.o livestatus_so-StatsColumn.o livestatus_so-IntAggregator.o livestatus_so-CountAggregator.o livestatus_so-DoubleAggregator.o livestatus_so-AttributelistColumn.o livestatus_so-AttributelistFilter.o livestatus_so-BlobColumn.o livestatus_so-HostFileColumn.o livestatus_so-global_counters.o livestatus_so-module.o livestatus_so-logger.o livestatus_so-waittriggers.o livestatus_so-TimeperiodsCache.o livestatus_so-pnp4nagios.o livestatus_so-mk_inventory.o livestatus_so-ContactgroupsColumn.o livestatus_so-CustomTimeperiodColumn.o livestatus_so-HostServiceState.o livestatus_so-opids.o livestatus_so-auth.o -o livestatus.o -lpthread -static-libstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status

My distribution server is CentOS 8 and I have installed the properly libraries:
[root@nagios mk-livestatus-1.2.8p18]# rpm -qa | grep libstdc
libstdc++-devel-8.2.1-3.5.el8.x86_64
libstdc++-8.2.1-3.5.el8.x86_64

So, what's wrong? Can I change the Makefile to change this commad without -static-libstdc++ option?

Thanks!
$ yum install centos-release-scl
$ yum install devtoolset-4

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

$ scl enable devtoolset-4 bash
$ cd /tmp/mk-livestatus-1.2.8p18

$ make
$ make install