[Check_mk (english)] Issues with mk_livestatus from git master, FreeBSD amd64 10.x and nagios-4.0.8

Hi all,
I’m testing livestatus for my nagios installation on FreeBSD 10.x but every time I enabled it on nagios.cfg, nagios stop working.

More info:

[1440751810] Nagios 4.0.8 starting… (PID=42746)

[1440751810] Local time is Fri Aug 28 10:50:10 CEST 2015

[1440751810] LOG VERSION: 2.0

[1440751810] qh: Socket ‘/var/spool/nagios/rw/nagios.qh’ successfully initialized

[1440751810] qh: core query handler registered

[1440751810] nerd: Channel hostchecks registered successfully

[1440751810] nerd: Channel servicechecks registered successfully

[1440751810] nerd: Channel opathchecks registered successfully

[1440751810] nerd: Fully initialized and ready to rock!

[1440751810] wproc: Successfully registered manager as @wproc with query handler

[1440751810] wproc: Registry request: name=Core Worker 43171;pid=43171

[1440751810] wproc: Registry request: name=Core Worker 43481;pid=43481

[1440751810] wproc: Registry request: name=Core Worker 42994;pid=42994

[1440751810] wproc: Registry request: name=Core Worker 43012;pid=43012

[1440751810] livestatus: Setting debug level to 1

[1440751810] livestatus: Livestatus 1.2.7i3 by Mathias Kettner. Socket: ‘/var/spool/nagios/rw/nagios_livestatus.cmd’

[1440751810] livestatus: Please visit us at http://mathias-kettner.de/

[1440751810] livestatus: Hint: please try out OMD - the Open Monitoring Distribution

[1440751810] livestatus: Please visit OMD at http://omdistro.org

[1440751810] livestatus: Removed old left over socket file /var/spool/nagios/rw/nagios_livestatus.cmd

[1440751810] livestatus: Opened UNIX socket /var/spool/nagios/rw/nagios_livestatus.cmd

[1440751810] livestatus: Your event_broker_options are sufficient for livestatus…

[1440751810] livestatus: Finished initialization. Further log messages go to /var/spool/nagios/livestatus.log

[1440751810] Event broker module ‘/usr/local/lib/mk-livestatus/livestatus.o’ initialized successfully.

[1440751810] Successfully launched command file worker with pid 43662

[1440751810] TIMEPERIOD TRANSITION: 24x7;-1;1

[1440751810] TIMEPERIOD TRANSITION: 24x7_sans_holidays;-1;1

[1440751810] TIMEPERIOD TRANSITION: none;-1;0

[1440751810] TIMEPERIOD TRANSITION: us-holidays;-1;0

[1440751810] TIMEPERIOD TRANSITION: workhours;-1;1

/var/spool/nagios/livestatus.log is empty.

/var/spool/nagios/rw/nagios_livestatus.cmd has the right permission.

I had to apply this patch to make mk_livestatus working on fbsd:

dave@srv1:~/Work/check_mk/livestatus/src> diff -uh LogCache.cc.orig LogCache.cc

— LogCache.cc.orig 2015-08-28 11:14:42.000000000 +0200

+++ LogCache.cc 2015-08-28 10:42:42.000000000 +0200

@@ -24,6 +24,7 @@

#include <dirent.h>

#include <fcntl.h>

+#include <pthread.h>

#include <stdarg.h>

#include <stddef.h>

#include <stdlib.h>

Trussing the main process, I see:

dave@srv1:~> sudo ps ax | grep nagios

42746 - Is 0:00.02 /usr/local/bin/nagios -d /usr/local/etc/nagios/nagios.cfg

42994 - I 0:00.00 /usr/local/bin/nagios --worker /var/spool/nagios/rw/nagios.qh

43012 - I 0:00.00 /usr/local/bin/nagios --worker /var/spool/nagios/rw/nagios.qh

43171 - I 0:00.00 /usr/local/bin/nagios --worker /var/spool/nagios/rw/nagios.qh

43481 - I 0:00.00 /usr/local/bin/nagios --worker /var/spool/nagios/rw/nagios.qh

43662 - S 0:00.03 /usr/local/bin/nagios -d /usr/local/etc/nagios/nagios.cfg

43586 0 S+ 0:00.00 grep --colour=always nagios

dave@srv1:~> sudo truss -p 43662

SIGNAL 17 (SIGSTOP)

kill(42746,0) = 0 (0x0)

poll({14/POLLIN},1,500) = 0 (0x0)

kill(42746,0) = 0 (0x0)

poll({14/POLLIN},1,500) = 0 (0x0)

kill(42746,0) = 0 (0x0)

poll({14/POLLIN},1,500) = 0 (0x0)

kill(42746,0) = 0 (0x0)

poll({14/POLLIN},1,500) = 0 (0x0)

kill(42746,0) = 0 (0x0)

poll({14/POLLIN},1,500) = 0 (0x0)

kill(42746,0) = 0 (0x0)

For completeness, I had the same behaviour installing mk_livestatus from ports.

Any tips?

Thanks,

···

d.

I tried to replace all files in livestatus/nagios/ with the ones from nagios-4.1.1 (creating a livestatus/lib where I copied a libnagios.h), with the same result.

Querying the named pipe isn’t returning anything:
root@srv1:/usr/local/etc/nagios # echo ‘GET hosts’ | /usr/local/lib/mk-livestatus/unixcat /var/spool/nagios/rw/nagios_livestatus.cmd

^C