I needed livestatus in order to get Thruk working with Nagios 4. Officially livestatus is not supported for Nagios 4, but there is a fork: https://github.com/sni/livestatus
The instructions there are not very complete, so here is how to install it.
I’m assuming that you have installed Nagios 4 from sources. Go to the same folder where you unzipped the nagios 4 sources (in my case it’s /usr/local/src).
Clone the repository of sni-livestatus:
git clone https://github.com/sni/livestatus.git
Now go inside the directory:
cd livestatus
Now run as per instructions (you may need to install autoconf for this to work: apt-get install autoconf):
autoreconf -s
You will get such an error:
configure.ac:38: error: required file './compile' not found
configure.ac:38: 'automake --add-missing' can install 'compile'
configure.ac:32: error: required file './install-sh' not found
configure.ac:32: 'automake --add-missing' can install 'install-sh'
configure.ac:32: error: required file './missing' not found
configure.ac:32: 'automake --add-missing' can install 'missing'
src/Makefile.am:31: error: 'livestatus.so' is not a standard library name
src/Makefile.am:31: did you mean 'liblivestatus.a'?
/usr/share/automake-1.15/am/library.am: warning: 'livestatus.so': linking libraries using a non-POSIX
/usr/share/automake-1.15/am/library.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
src/Makefile.am:31: while processing library 'livestatus.so'
src/Makefile.am: error: required file './depcomp' not found
src/Makefile.am: 'automake --add-missing' can install 'depcomp'
autoreconf: automake failed with exit status: 1
That’s fine, just execute:
automake --add-missing
Now, adjust the path for your example. In my case the command is:
./configure CPPFLAGS=-I/usr/local/src/nagios-4.2.1/include/
If you’ll run the next command as recommended in the official doc, you’ll get this error:
make
make all-recursive
make[1]: Entering directory '/usr/local/src/livestatus'
Making all in src
make[2]: Entering directory '/usr/local/src/livestatus/src'
g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/src/nagios-4.2.1/include/ -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
In file included from Query.h:29:0,
from AndingFilter.cc:28:
nagios.h:31:28: fatal error: nagios/objects.h: No such file or directory
compilation terminated.
Makefile:748: recipe for target 'livestatus_so-AndingFilter.o' failed
make[2]: *** [livestatus_so-AndingFilter.o] Error 1
make[2]: Leaving directory '/usr/local/src/livestatus/src'
Makefile:380: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/livestatus'
Makefile:321: recipe for target 'all' failed
make: *** [all] Error 2
Or this error:
make
make all-recursive
make[1]: Entering directory '/usr/local/src/livestatus'
Making all in src
make[2]: Entering directory '/usr/local/src/livestatus/src'
g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/src/nagios-4.2.1/include/ -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
In file included from ../nagios/common.h:25:0,
from ../nagios/objects.h:27,
from nagios.h:31,
from Query.h:29,
from AndingFilter.cc:28:
../nagios/shared.h:5:27: fatal error: lib/libnagios.h: No such file or directory
compilation terminated.
Makefile:748: recipe for target 'livestatus_so-AndingFilter.o' failed
make[2]: *** [livestatus_so-AndingFilter.o] Error 1
make[2]: Leaving directory '/usr/local/src/livestatus/src'
Makefile:380: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/livestatus'
Makefile:321: recipe for target 'all' failed
make: *** [all] Error 2
To fix, create 2 symlinks of the „include” folder from the nagios sources to „nagios” inside livestatus sources, and of „lib” folder inside nagios sources to „lib” inside livestatus sources. In my case the commands are:
ln -s /usr/local/src/nagios-4.2.1/include/ nagios/
ln -s /usr/local/src/nagios-4.2.1/lib lib
Now execute:
make
make install
The library will be installed in /usr/local/lib/mk-livestatus/livestatus.o
Now add a line in nagios.cfg, like:
broker_module=/usr/local/lib/mk-livestatus/livestatus.o /usr/local/nagios/var/livestatus.sock
Just adjust the paths to meet your needs.
Apreciază:
Apreciere Încarc...