[ZBX-13350] Default depends on compilation options - what is it in package installation Created: 2018 Jan 17  Updated: 2024 Apr 10  Resolved: 2018 Apr 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Proxy (P), Server (S)
Affects Version/s: None
Fix Version/s: 4.0.0alpha6, 4.0 (plan)

Type: Documentation task Priority: Trivial
Reporter: Stefan Assignee: Viktors Tjarve
Resolution: Fixed Votes: 0
Labels: usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Causes
causes ZBX-13803 Zabbix ignores DESTDIR when performin... Closed
Team: Team A
Sprint: Sprint 27, Sprint 28, Sprint 29, Sprint 30
Story Points: 2

 Description   

When I install zabbix-server via package in the zabbix_server.conf is something like "Default depends on compilation options" for datadir and libdir, but it is not documented what are the compilation options nor what is datadir/libdir in the packageinstallation



 Comments   
Comment by Glebs Ivanovskis (Inactive) [ 2018 Jan 17 ]

Dear shad0w, if you desperately need this information you can start Zabbix daemons with DebugLevel=4 and they should tell you directories they are scanning. Regarding compilation options — they are well described in the output of ./configure --help.

Comment by dimir [ 2018 Jan 17 ]

Do you mean things like:

# AlertScriptsPath=${datadir}/zabbix/alertscripts
# LoadModulePath=${libdir}/modules

in zabbix_server.conf?

We could document something like:

${libdir} and ${datadir} in configuration files refer to /usr/lib.

or fix that directly in the config files of packages.

Comment by Glebs Ivanovskis (Inactive) [ 2018 Jan 17 ]

Crazy idea... If make replaces ${libdir}‍ and ${datadir}‍ in our source files, why can't we make *.conf files with a precise comment?

Comment by richlv [ 2018 Jan 18 ]

replacing paths in the config files was discussed, but there were reasons why it was not implemented. cannot recall what those reasons were, though - maybe they are not valid anymore.

Comment by dimir [ 2018 Jan 18 ]

I like the idea of Gleb. Having something like zabbix_server.conf.in with autoconf macros like ${libdir}‍ and make would generate zabbix_server.conf with resolved paths.

Comment by dimir [ 2018 Jan 22 ]

palivoda, we (me and glebs.ivanovskis at least) think it is better to replace the variable names in configuration files with real paths during compilation. Currently we have the following Makefile variables used in default configuration files:

$ grep '${' conf/*.conf
conf/zabbix_agentd.conf:# LoadModulePath=${libdir}/modules
conf/zabbix_proxy.conf:# ExternalScripts=${datadir}/zabbix/externalscripts
conf/zabbix_proxy.conf:# SSLCertLocation=${datadir}/zabbix/ssl/certs
conf/zabbix_proxy.conf:# SSLKeyLocation=${datadir}/zabbix/ssl/keys
conf/zabbix_proxy.conf:# LoadModulePath=${libdir}/modules
conf/zabbix_server.conf:# AlertScriptsPath=${datadir}/zabbix/alertscripts
conf/zabbix_server.conf:# ExternalScripts=${datadir}/zabbix/externalscripts
conf/zabbix_server.conf:# SSLCertLocation=${datadir}/zabbix/ssl/certs
conf/zabbix_server.conf:# SSLKeyLocation=${datadir}/zabbix/ssl/keys
conf/zabbix_server.conf:# LoadModulePath=${libdir}/modules

The idea is to replace those with real paths during compilation time, instead of documenting that. E. g., having

conf/zabbix_agentd.conf.in
conf/zabbix_proxy.conf.in
conf/zabbix_server.conf.in

with Makefile variables, after compilation these will be translated to:

conf/zabbix_agentd.conf
conf/zabbix_proxy.conf
conf/zabbix_server.conf

with variables replaced by real paths. Bringing attention of sasha.

Comment by Viktors Tjarve [ 2018 Feb 13 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-13350

Comment by dimir [ 2018 Feb 19 ]

(1) The variable MODULES_DIR set by auto-tools is not used anywhere in the code:

$ grep -r MODULES_DIR *
src/zabbix_agent/Makefile.am:MODULES_DIR = $(DESTDIR)@libdir@
src/zabbix_agent/Makefile.am:   $(MKDIR_P) "$(MODULES_DIR)"
src/zabbix_server/Makefile.am:MODULES_DIR = $(DESTDIR)@libdir@
src/zabbix_server/Makefile.am:  $(MKDIR_P) "$(MODULES_DIR)"
src/zabbix_proxy/Makefile.am:MODULES_DIR = $(DESTDIR)@libdir@
src/zabbix_proxy/Makefile.am:   $(MKDIR_P) "$(MODULES_DIR)"

I think we should fix places like this:

src/zabbix_server/server.c:             CONFIG_LOAD_MODULE_PATH = zbx_strdup(CONFIG_LOAD_MODULE_PATH, LIBDIR "/modules");

with this:

src/zabbix_server/server.c:             CONFIG_LOAD_MODULE_PATH = zbx_strdup(CONFIG_LOAD_MODULE_PATH, MODULES_DIR);

for all components, server, proxy, agent.

<dimir> We decided to move various config file/dir paths up to configure level. In addition to getting rid of duplicate definitions (Makefiles, the code) now the default paths will be printed out after running ./configure . Added information is:

  • default path to configuration file
  • default path to externalscripts directory
  • default path to alertscripts directory
  • default paths to look for cURL SSL certs/keys
  • default path to modules directory

With the following command

./configure --enable-agent --with-mysql --enable-server --enable-ipv6 --enable-proxy --with-openssl --with-libcurl --prefix=$(pwd) --sysconfdir=/etc/zabbix --datadir=/etc --prefix=/usr

you will get something like this:

Configuration:
[...]
  Enable server:         yes
  Server details:
    With database:         MySQL
    WEB Monitoring:        cURL
      SSL certificates:      /etc/zabbix/ssl/certs
      SSL keys:              /etc/zabbix/ssl/keys
[...]
    Config file:           /etc/zabbix/zabbix_server.conf
    External scripts:      /etc/zabbix/externalscripts
    Alert scripts:         /etc/zabbix/alertscripts
    Modules:               /usr/lib/modules

  Enable proxy:          yes
  Proxy details:
    With database:         MySQL
    WEB Monitoring:        cURL
      SSL certificates:      /etc/zabbix/ssl/certs
      SSL keys:              /etc/zabbix/ssl/keys
[...]
    Config file:           /etc/zabbix/zabbix_proxy.conf
    External scripts:      /etc/zabbix/externalscripts
    Modules:               /usr/lib/modules

  Enable agent:          yes
  Agent details:
    TLS:                   OpenSSL
    Linker flags:           -L/usr/lib   -rdynamic   
    Libraries:              -lssl -lcrypto   -lcurl -lm -ldl  -lresolv -lpcreposix -lpcre 
    Config file:           /etc/zabbix/zabbix_agentd.conf
    Modules:               /usr/lib/modules
[...]

RESOLVED

<viktors.tjarve> Tested and looks good.
CLOSED

Comment by richlv [ 2018 Feb 19 ]

what is subissue (1) ?

<dimir> There is variable MODULES_DIR that is set by auto-tools but it's not used anywhere. So we should either remove it or us it in the code, instead of using LIBDIR "/modules". I'd vote for 1. I'll separate it from other topic in that comment.

Comment by Viktors Tjarve [ 2018 Mar 05 ]

(2) Unable to compile on Windows:

c1: fatal error C1083: Cannot open source file: 'C:\\zabbix_agentd.conf': No such file or directory

The problem is caused by added default config file name to CFLAGS in Windows Makefile_agent.

<viktors.tjarve> Fixed string escaping in r78297.
RESOLVED

MVekslers Successfully tested.
CLOSED

Comment by Viktors Tjarve [ 2018 Mar 28 ]

Released in:

  • 4.0.0alpha6 r79157
Generated at Thu Apr 25 22:50:31 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.