Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible module code with Zabbix 3.0.X #89

Open
vitassecuriti opened this issue Jan 22, 2018 · 6 comments
Open

Incompatible module code with Zabbix 3.0.X #89

vitassecuriti opened this issue Jan 22, 2018 · 6 comments
Labels

Comments

@vitassecuriti
Copy link

vitassecuriti commented Jan 22, 2018

Hi!

I try to build an image according to the instruction for branches/3.0 or tags/3.0.8 on an image of centos. I receive such mistake.
In the Dockerfile file I set value of the ENV ZABBIX_VERSION=branches/3.0 variable
or ENV ZABBIX_VERSION=tags/3.0.8. and every time I receive a error

gcc -fPIC -shared -o zabbix_module_docker.so zabbix_module_docker.c -I../../../include -I../../../src/libs/zbxsysinfo
zabbix_module_docker.c: In function 'zbx_docker_dir_detect':
zabbix_module_docker.c:708:17: error: too many arguments to function 'zbx_regexp_sub'
                 if (SUCCEED != zbx_regexp_sub(path, mounts_regex, "\\1", &stat_dir) || NULL == stat_dir)
                 ^
In file included from zabbix_module_docker.c:26:0:
../../../include/zbxregexp.h:37:7: note: declared here
 char *zbx_regexp_sub(const char *string, const char *pattern, const char *output_template);
       ^
make: *** [zabbix_module_docker] Error 1`

Full text of a mistake below

Docker version 

`docker info
Containers: 3
 Running: 0
 Paused: 0
 Stopped: 3
Images: 41
Server Version: 18.01.0-ce
Storage Driver: overlay
 Backing Filesystem: extfs
 Supports d_type: true
..........

I need to compile with the tag 3.0.8 since doesn't work with the zabbix_module_docker.so file which I have downloaded already compiled for version 3.0 zabbix-agent.

82922:20180122:184855.259 using configuration file:/etc/zabbix/zabbix_agentd.conf
 82922:20180122:184855.259 In load_modules ()
 82922:20180122:184855.259 loading module "/export/home/zabbix/zabbix/modules//zabbix_module_docker.so"
 82922:20180122:184855.259 can't load module "zabbix_module_docker.so": / export/home/zabbix/zabbix/modules//zabbix_module_docker.so: undefined symbol: zbx_alarm_timed_out
 82922:20180122:184855.259 End of load_modules (): FAIL
 82922:20180122:184855.259 loading modules failed, exiting..
centos]$ docker build --rm=true -t local/zabbix-docker-module-compilation .
Sending build context to Docker daemon  3.072kB
Step 1/6 : FROM centos:centos7
 ---> 328edcd84f1b
Step 2/6 : MAINTAINER "Jan Garaj" <[email protected]>
 ---> Using cache
 ---> e4a4e81b7984
Step 3/6 : ENV ZABBIX_VERSION=branches/3.0
 ---> Running in 88f9251cd230
Removing intermediate container 88f9251cd230
 ---> 41b60f6732ed
Step 4/6 : WORKDIR /root
Removing intermediate container 19a11506dbf2
 ---> 1d65e2cd7104
Step 5/6 : RUN    yum -y -q install git subversion automake autoconf gcc make pcre-devel 1>/dev/null &&    git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring
 ---> Running in b8497313a5f4
warning: /var/cache/yum/x86_64/7/updates/packages/apr-1.4.8-3.el7_4.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-3.1611.el7.centos.x86_64 (@CentOS)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Removing intermediate container b8497313a5f4
 ---> 8f733b64add2
Step 6/6 : RUN    svn --quiet export svn://svn.zabbix.com/${ZABBIX_VERSION} ~/zabbix/ &&    cd ~/zabbix/ &&    ./bootstrap.sh 1>/dev/null &&    ./configure --enable-agent 1>/dev/null &&    cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ &&    cd ~/zabbix/src/modules/zabbix_module_docker &&    make
 ---> Running in 374c5ab2ae40
configure.ac:41: installing './compile'
configure.ac:32: installing './config.guess'
configure.ac:32: installing './config.sub'
configure.ac:24: installing './install-sh'
configure.ac:24: installing './missing'
src/libs/zbxalgo/Makefile.am: installing './depcomp'
gcc -fPIC -shared -o zabbix_module_docker.so zabbix_module_docker.c -I../../../include -I../../../src/libs/zbxsysinfo
zabbix_module_docker.c: In function 'zbx_docker_dir_detect':
zabbix_module_docker.c:708:17: error: too many arguments to function 'zbx_regexp_sub'
                 if (SUCCEED != zbx_regexp_sub(path, mounts_regex, "\\1", &stat_dir) || NULL == stat_dir)
                 ^
In file included from zabbix_module_docker.c:26:0:
../../../include/zbxregexp.h:37:7: note: declared here
 char *zbx_regexp_sub(const char *string, const char *pattern, const char *output_template);
       ^
make: *** [zabbix_module_docker] Error 1
The command '/bin/sh -c svn --quiet export svn://svn.zabbix.com/${ZABBIX_VERSION} ~/zabbix/ &&    cd ~/zabbix/ &&    ./bootstrap.sh 1>/dev/null &&    ./configure --enable-agent 1>/dev/null &&    cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ &&    cd ~/zabbix/src/modules/zabbix_module_docker &&    make' returned a non-zero code: 2

@vitassecuriti vitassecuriti changed the title Docker build for tags 3.0.8 or branches 3.0 dont't work Docker build in localhost for tags 3.0.8 or branches 3.0 dont't work Jan 22, 2018
@jangaraj
Copy link
Member

Yes, you are right @vitassecuriti. The current master code is not compatible with Zabbix 3.0, because #80.

Quick workaround: build tagged version before tag 0.6.8
I'll try to fix it later.

For the record, zbx_regexp_sub functions:
Zabbix 3.4.6:

int     zbx_regexp_sub(const char *string, const char *pattern, const char *output_template, char **out)
{
        return regexp_sub(string, pattern, output_template, REG_EXTENDED | REG_NEWLINE, out);
}

Zabbix 3.0.8:

char    *zbx_regexp_sub(const char *string, const char *pattern, const char *output_template)
{
        return regexp_sub(string, pattern, output_template, REG_EXTENDED | REG_NEWLINE);
}

@jangaraj jangaraj added the bug label Jan 22, 2018
@jangaraj jangaraj changed the title Docker build in localhost for tags 3.0.8 or branches 3.0 dont't work Incompatible module code with Zabbix 3.0.X Jan 22, 2018
@vitassecuriti
Copy link
Author

Thanks for the answer. I have tested for earlier versions. the mistake is present.
FOR 0.6.7

`config.status:` executing depfiles commands


Configuration:

  Detected OS:           linux-gnu
  Install path:          /usr/local
  Compilation arch:      linux

  Compiler:              gcc
  Compiler flags:         -g -O2

  Library-specific flags:

  Enable server:         no

  Enable proxy:          no

  Enable agent:          yes
  Agent details:
    TLS:                   no
    Linker flags:              -rdynamic  
    Libraries:                 -lm -ldl  -lresolv 

  Enable Java gateway:   no

  LDAP support:          no
  IPv6 support:          no

***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************

gcc -fPIC -shared -o zabbix_module_docker.so zabbix_module_docker.c -I../../../include -I../../../src/libs/zbxsysinfo
zabbix_module_docker.c: In function 'zbx_docker_dir_detect':
zabbix_module_docker.c:708:17: error: too many arguments to function 'zbx_regexp_sub'
                 if (SUCCEED != zbx_regexp_sub(path, mounts_regex, "\\1", &stat_dir) || NULL == stat_dir)
                 ^
In file included from zabbix_module_docker.c:26:0:
../../../include/zbxregexp.h:37:7: note: declared here
 char *zbx_regexp_sub(const char *string, const char *pattern, const char *output_template);
       ^
make: *** [zabbix_module_docker] Error 1
The command '/bin/sh -c yum -y -q install git subversion automake autoconf gcc make &&    git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring &&    svn --quiet export svn://svn.zabbix.com/${ZABBIX_VERSION} ~/zabbix/ &&    cd ~/zabbix/ &&    ./bootstrap.sh 1>/dev/null &&    ./configure --enable-agent &&    cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ &&    cd ~/zabbix/src/modules/zabbix_module_docker &&    make' returned a non-zero code: 2`

FOR 0.6.6

`config.status: executing depfiles commands


Configuration:

  Detected OS:           linux-gnu
  Install path:          /usr/local
  Compilation arch:      linux

  Compiler:              gcc
  Compiler flags:         -g -O2

  Library-specific flags:

  Enable server:         no

  Enable proxy:          no

  Enable agent:          yes
  Agent details:
    TLS:                   no
    Linker flags:              -rdynamic  
    Libraries:                 -lm -ldl  -lresolv 

  Enable Java gateway:   no

  LDAP support:          no
  IPv6 support:          no

***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************

gcc -fPIC -shared -o zabbix_module_docker.so zabbix_module_docker.c -I../../../include -I../../../src/libs/zbxsysinfo
zabbix_module_docker.c: In function 'zbx_docker_dir_detect':
zabbix_module_docker.c:708:17: error: too many arguments to function 'zbx_regexp_sub'
                 if (SUCCEED != zbx_regexp_sub(path, mounts_regex, "\\1", &stat_dir) || NULL == stat_dir)
                 ^
In file included from zabbix_module_docker.c:26:0:
../../../include/zbxregexp.h:37:7: note: declared here
 char *zbx_regexp_sub(const char *string, const char *pattern, const char *output_template);
       ^
make: *** [zabbix_module_docker] Error 1
The command '/bin/sh -c yum -y -q install git subversion automake autoconf gcc make &&    git clone -q https://github.com/monitoringartist/zabbix-docker-monitoring &&    svn --quiet export svn://svn.zabbix.com/${ZABBIX_VERSION} ~/zabbix/ &&    cd ~/zabbix/ &&    ./bootstrap.sh 1>/dev/null &&    ./configure --enable-agent &&    cp -R ~/zabbix-docker-monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/ &&    cd ~/zabbix/src/modules/zabbix_module_docker &&    make' returned a non-zero code: 2`

So, workaround hasn't helped.
It is necessary to wait for correction of a bug.

@jangaraj
Copy link
Member

You need to use tagged module source code version. For example v0.6.7: https://github.com/monitoringartist/zabbix-docker-monitoring/blob/v0.6.7/src/modules/zabbix_module_docker/zabbix_module_docker.c
It doesn't use zbx_regexp_sub function, so you can't have error error: too many arguments to function 'zbx_regexp_sub' there.

@vitassecuriti
Copy link
Author

Sorry? I probably haven't so understood

@jangaraj
Copy link
Member

Module has releases - https://github.com/monitoringartist/zabbix-docker-monitoring/releases
Unfortunately, https://github.com/monitoringartist/zabbix-docker-monitoring#compilation and Dockerfiles use only master branch code, which is not compatible with your Zabbix 3.0, so pls modify them and instead of master branch use tag 0.6.7 in your compilation process.

@vitassecuriti
Copy link
Author

vitassecuriti commented Jan 23, 2018

Once again I apologize, Really, the decision works
I have changed a line in the dockerfile, having added parameter
git clone -q -b v0.6.7 https://github.com/monitoringartist/zabbix-docker-monitoring && \
so the image was constructed without error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants