Prerequisites (other than the nagios4 packages, of course!):
# apt install rrdtool-dev librrd-dev librrd8 libboost-dev libboost-system-dev
Get latest source from https://checkmk.com/download-source.php, at time of writing, https://checkmk.com/support/1.5.0p23/mk-livestatus-1.5.0p23.tar.gz and unpack
# wget https://checkmk.com/support/1.5.0p23/mk-livestatus-1.5.0p23.tar.gz
# tar -zxvf mk-livestatus-1.5.0p23.tar.gz
# cd mk-livestatus-1.5.0p23
Configure for nagios4, compile and install
# ./configure --with-nagios4 --prefix=/usr/local/nagios && make install
Enable the broker module in Nagios4 – add this to, eg, your nagios.cfg – first make sure that this is set to send all events to the broker:
event_broker_options=-1
Then configure the broker_module – here, telling it to create the socket for livestatus at /var/lib/nagios4/rw/livestatus
broker_module=/usr/local/lib/mk-livestatus/livestatus.o /var/lib/nagios4/rw/livestatus
Now you can restart Nagios4 and test that the livestatus socket is working
# systemctl restart nagios4
# echo "GET status" | /usr/local/bin/unixcat /var/lib/nagios4/rw/livestatus
And you should get something like this:
accept_passive_host_checks;accept_passive_service_checks;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;enable_event_handlers;enable_flap_detection;enable_notifications;execute_host_checks;execute_service_checks;external_command_buffer_max;external_command_buffer_slots;external_command_buffer_usage;external_commands;external_commands_rate;forks;forks_rate;host_checks;host_checks_rate;interval_length;last_command_check;last_log_rotation;livecheck_overflows;livecheck_overflows_rate;livechecks;livechecks_rate;livestatus_active_connections;livestatus_queued_connections;livestatus_threads;livestatus_version;log_messages;log_messages_rate;mk_inventory_last;nagios_pid;neb_callbacks;neb_callbacks_rate;num_hosts;num_services;obsess_over_hosts;obsess_over_services;process_performance_data;program_start;program_version;requests;requests_rate;service_checks;service_checks_rate
1;1;0;1;0;1;1;0;1;1;1;1;1;0;0;0;0;0;0;0;57;0.416507;60;0;0;0;0;0;0;1;0;10;1.5.0p23;45;0.0199066;0;4310;1651;11.9169;83;467;0;0;0;1581514195;4.3.4;1;0;348;3.15754
Hi Phil, which nagios4 version is tested here > 4.0.2 ?
Hi!
Sorry – I guess I wasn’t very explicit there was I – I meant to imply that I am using the Debian 10 x64 package for nagios4, which at the time I wrote this article (and still) means the debian package version 4.3.4-3 (-3 means there are Debian backported patches to the upstream v4.3.4 for security/bug fixes – for the Debian changelog for, eg, the main nagios4 package, you can see https://metadata.ftp-master.debian.org/changelogs//main/n/nagios4/nagios4_4.3.4-3_changelog ).
Searching the system for installed packages containing the word “nagios” the full ‘package landscape’ on the server hosting my nagios install looks like this:
ii libnagios-plugin-perl 0.36-1 all family of perl modules to streamline writing Nagios
ii monitoring-plugins 2.2-6 all Plugins for nagios compatible monitoring systems (metapackage)
ii monitoring-plugins-basic 2.2-6 amd64 Plugins for nagios compatible monitoring systems (basic)
ii monitoring-plugins-common 2.2-6 amd64 Common files for plugins for nagios compatible monitoring
ii monitoring-plugins-standard 2.2-6 amd64 Plugins for nagios compatible monitoring systems (standard)
ii nagios-images 0.9.3 all Collection of images and icons for the nagios system
ii nagios-nrpe-plugin 3.2.1-2 amd64 Nagios Remote Plugin Executor Plugin
ii nagios-nrpe-server 3.2.1-2 amd64 Nagios Remote Plugin Executor Server
ii nagios-plugins-basic 2.2-3 all transitional dummy package
ii nagios-plugins-contrib 24.20190301 amd64 Plugins for nagios compatible monitoring systems
ii nagios4 4.3.4-3 amd64 host/service/network monitoring and management system
ii nagios4-cgi 4.3.4-3 amd64 cgi files for nagios4
ii nagios4-common 4.3.4-3 all support files for nagios4
ii nagios4-core 4.3.4-3 amd64 host/service/network monitoring and management system core files
hey phil, thanks for this…
one pitfall i found… i did’nt want ALL of libboost… however the configure script seems to have a problem pinpointing the exact libboost modules necessary … it does detect asio missing, but it doesn’t detect libboost-system missing, ending in a not very helpful error… took me a long time to find the right libboost module… so if it helps anyone… dependencies for me were: libasio-dev and libboost-system1.67-dev
🙂 sorry, ignore that last remark… you said it in the SECOND LINE of your post… am i a noob or what
ha! it is often the case that the fastest way to find something is to tell someone else you can’t see it…. the number of times I have sent emails and then had to send another one saying “wait, nevermind”