zabbix-module-python icon indicating copy to clipboard operation
zabbix-module-python copied to clipboard

Zabbix Log level

Open xurxofp opened this issue 5 years ago • 4 comments

I'm seeing log messages behind my log level in Zabbix logs.

For example I see a lot of messages about unmarshalling (LOG_LEVEL_DEBUG) when I'am in warning level.

Is this a bug or there is something that I have to configure for this to work?

See for example this message, is printed in debug level but I'm seeing it when in warning.

xurxofp avatar Nov 06 '19 08:11 xurxofp

See https://github.com/cavaliercoder/zabbix-module-systemd/issues/37 -> probably you will need config.h generated by Zabbix.

jangaraj avatar Nov 06 '19 08:11 jangaraj

Hi @jangaraj thank you for your answer,

Yes, that it’s definitely the problem, but I’m not having luck with the solution, my environment it’s a little bit strange:

I’m compiling Zabbix from a Dockerfile and immediately after that, compilling libzbxpython. Doing that I get the following error:

make[2]: Entering directory '/tmp/libzbxpython/src'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -I/tmp/zabbix-4.0.12/include -I/usr/include/python3.7m -g -O2 -MT python_la-libzbxpython.lo -MD -MP -MF .deps/python_la-libzbxpython.Tpo -c -o python_la-libzbxpython.lo `test -f 'libzbxpython.c' || echo './'`libzbxpython.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/tmp/zabbix-4.0.12/include -I/usr/include/python3.7m -g -O2 -MT python_la-libzbxpython.lo -MD -MP -MF .deps/python_la-libzbxpython.Tpo -c libzbxpython.c  -fPIC -DPIC -o .libs/python_la-libzbxpython.o
libzbxpython.c: In function 'zbx_module_init':
libzbxpython.c:135:36: error: 'ZABBIX_PYTHON_MODULE_PATH' undeclared (first use in this function); did you mean 'ZABBIX_MODULE_H'?
     pyValue = PyUnicode_FromString(ZABBIX_PYTHON_MODULE_PATH);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~
                                    ZABBIX_MODULE_H
libzbxpython.c:135:36: note: each undeclared identifier is reported only once for each function it appears in

That I “solve” removing the used sources and downloading another ones to compile libzbxpython. But then I have the problem that I don’t have the config.h ready for the logs.

I hope that I was able to explain it to you correctly. Again, thank you very much for your time

xurxofp avatar Nov 06 '19 12:11 xurxofp

#<folder with zabbix source code>$ ./bootstrap.sh; ./configure

And you will have Zabbix config.h ready.

jangaraj avatar Nov 06 '19 13:11 jangaraj

If I do that I get the aftermentioned error.

The only way to not have the error is with a clean sources.

Here I have a snippet of the dockerfile with the problem:

RUN cd /tmp/ && \
    git clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch zabbix-${ZBX_VERSION} && \
    cd /tmp/zabbix-${ZBX_VERSION} && \
    ./bootstrap.sh && \
    ./configure && \
    cd /tmp/ && \
    git clone https://github.com/dav3860/libzbxpython.git && \
    cd /tmp/libzbxpython && \
    ./autogen.sh && \
    PYTHON_VERSION=3 ./configure \
            --libdir=/var/lib/zabbix/modules \
            --with-zabbix=/tmp/zabbix-${ZBX_VERSION} \
            --with-zabbix-conf=/etc/zabbix \
            --with-python-modules=/var/lib/zabbix/modules/python && \
    make && \
    make install

If I do exactly the same without "./bootstrap.sh and ./configure" everything works as expected (Without the logs of course)

xurxofp avatar Nov 06 '19 13:11 xurxofp