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

On debian based systems /etc/default/icinga2 is not read/used #6255

Closed
dupondje opened this issue Apr 24, 2018 · 13 comments · Fixed by #6328
Closed

On debian based systems /etc/default/icinga2 is not read/used #6255

dupondje opened this issue Apr 24, 2018 · 13 comments · Fixed by #6328
Labels
area/configuration DSL, parser, compiler, error handling bug Something isn't working
Milestone

Comments

@dupondje
Copy link
Contributor

Hi,

When installing icinga2 on a debian system, it should read /etc/default/icinga2 for some vars as stated in the docs.
But it seems like this is completely broken.

For example I added the following in the file:
ICINGA2_RLIMIT_STACK=524288

but its never used.

Also when you start icinga2, you get the following warning:
icinga2 variable get RLimitStack
[2018-04-24 16:34:45 +0200] warning/icinga-app: Sysconfig file '/etc/sysconfig/icinga2' cannot be read. Using default values.
262144

Seems to be a cmake bug?
When just running cmake . on v2.8.3, the variable is filled incorrectly:
//where to store configuation for the init system, defaults to
// /etc/sysconfig/icinga2
ICINGA2_SYSCONFIGFILE:PATH=/usr/local/etc/sysconfig/icinga2

@dnsmichi
Copy link
Contributor

Which version are you using exactly? Please always fill in the issue templates.

@dnsmichi dnsmichi added area/configuration DSL, parser, compiler, error handling needs feedback We'll only proceed once we hear from you again labels Apr 24, 2018
@dupondje
Copy link
Contributor Author

I'm using 2.8.3

@dnsmichi
Copy link
Contributor

Please show us the output of icinga2 --version.

@mcktr
Copy link
Member

mcktr commented Apr 24, 2018

Just faced the same issue on Debian 9 and Ubuntu 17.10.

Seems that Icinga is looking for /etc/sysconfig/icinga2 but on Debian/Ubuntu this file is located in /etc/defaults/icinga2.

root@b6385b454295:/# icinga2 --version
[2018-04-24 19:28:06 +0000] warning/icinga-app: Sysconfig file '/etc/sysconfig/icinga2' cannot be read. Using default values.
icinga2 - The Icinga 2 network monitoring daemon (version: r2.8.3-1)

Copyright (c) 2012-2017 Icinga Development Team (https://www.icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
  Installation root: /usr
  Sysconf directory: /etc
  Run directory: /run
  Local state directory: /var
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid

System information:
  Platform: Ubuntu
  Platform version: 17.10 (Artful Aardvark)
  Kernel: Linux
  Kernel version: 4.9.0-6-amd64
  Architecture: x86_64

Build information:
  Compiler: GNU 7.2.0
  Build host: 0d053065d15d

@dupondje
Copy link
Contributor Author

dupondje commented Apr 25, 2018

icinga2 --version

[2018-04-25 09:29:22 +0200] warning/icinga-app: Sysconfig file '/etc/sysconfig/icinga2' cannot be read. Using default values.
icinga2 - The Icinga 2 network monitoring daemon (version: r2.8.3-1)

Copyright (c) 2012-2017 Icinga Development Team (https://www.icinga.com/)
License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl2.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
Installation root: /usr
Sysconf directory: /etc
Run directory: /run
Local state directory: /var
Package data directory: /usr/share/icinga2
State path: /var/lib/icinga2/icinga2.state
Modified attributes path: /var/lib/icinga2/modified-attributes.conf
Objects path: /var/cache/icinga2/icinga2.debug
Vars path: /var/cache/icinga2/icinga2.vars
PID path: /run/icinga2/icinga2.pid

System information:
Platform: Ubuntu
Platform version: 16.04.4 LTS (Xenial Xerus)
Kernel: Linux
Kernel version: 4.4.0-116-generic
Architecture: x86_64

Build information:
Compiler: GNU 5.3.1
Build host: 0786d7cd59d9

@dnsmichi
Copy link
Contributor

Try the following workaround until 2.9 is released:

mkdir -p /etc/sysconfig
ln -s /usr/lib/icinga2/icinga2 /etc/sysconfig/icinga2

@lazyfrosch
Copy link
Contributor

Oh damn, we really need to fix this, and better move the environment read to the icinga2 wrapper script...

Daemons are not really supposed to include something from default/sysconfig

@dnsmichi dnsmichi added bug Something isn't working and removed needs feedback We'll only proceed once we hear from you again labels Apr 25, 2018
@dnsmichi dnsmichi added this to the 2.9.0 milestone Apr 25, 2018
@dnsmichi
Copy link
Contributor

dnsmichi commented May 2, 2018

Scheduled for CW21.

@dnsmichi
Copy link
Contributor

  • Change icinga-app to read environment variables (drop our own reading from file)
  • Move default variables into prepare-dirs / safe-reload
  • Provide commented out values for sysconfig
  • Adopt Debian/RPM packages for the default paths

Crunsher added a commit that referenced this issue May 23, 2018
The sysconfig file now only contains the defaults as comments, changes
made there are given to the init.d script, prepare-dirs, safe-reload and
Icinga 2 itself. If nothing is set in the sysconfig file (as is the
default as all lines are commented out) the defaults are used.

fixes #6255
Crunsher added a commit that referenced this issue May 23, 2018
The sysconfig file now only contains the defaults as comments, changes
made there are given to the init.d script, prepare-dirs, safe-reload and
Icinga 2 itself. If nothing is set in the sysconfig file (as is the
default as all lines are commented out) the defaults are used.

fixes #6255
@mcktr
Copy link
Member

mcktr commented Jun 18, 2018

I tested the latest snapshot package and faced the same issue.

root@testing-deb9-icinga2-master:/# icinga2 -V       
[2018-06-18 16:04:12 +0000] warning/icinga-app: Sysconfig file '/etc/sysconfig/icinga2' cannot be read. Using default values.
[2018-06-18 16:04:12 +0000] warning/icinga-app: Sysconfig file '/etc/sysconfig/icinga2' cannot be read. Using default values.
icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.4-759-geb1f37905)

Copyright (c) 2012-2018 Icinga Development Team (https://www.icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
  Installation root: /usr
  Sysconf directory: /etc
  Run directory: /run
  Local state directory: /var
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid

System information:
  Platform: Debian GNU/Linux
  Platform version: 9 (stretch)
  Kernel: Linux
  Kernel version: 4.15.0-22-generic
  Architecture: x86_64

Build information:
  Compiler: GNU 6.3.0
  Build host: 3bced3d80940

Is the fix already available through snapshot packages or is there more work to do e.g. on the build scripts?

@dnsmichi
Copy link
Contributor

The warning shouldn't be there, thanks for testing.

@N-o-X
Copy link
Contributor

N-o-X commented Jun 29, 2018

I've tested this on Ubuntu 16.04, but the only thing that worked for me was changing the user and group Icinga runs as.

For the *_DIR options, the directories where created but never used.

Working:

ICINGA2_USER=root
ICINGA2_GROUP=icingaweb2

Not working:

DAEMON=/usr/sbin/icinga2asdg
ICINGA2_CONFIG_FILE=/etc/icinga2/icinga7.conf
ICINGA2_RUN_DIR=/run/icinga7
ICINGA2_STATE_DIR=/var/icinga7
ICINGA2_PID_FILE=/run/icinga2/icinga7.pid
ICINGA2_LOG_DIR=/var/log/icinga7
ICINGA2_ERROR_LOG=/var/log/icinga2/error_dasd.log
ICINGA2_STARTUP_LOG=/var/log/icinga2/startup_Dasda.log
ICINGA2_LOG=/var/log/icinga7/icinga2aaaa.log
ICINGA2_CACHE_DIR=/var/cache/icinga2aa
ICINGA2_COMMAND_GROUP=icingaweb2

icinga2 -V

root@icinga-master-1:~# icinga2 -V
icinga2 - The Icinga 2 network monitoring daemon (version: v2.8.4-806-gc7e6174)

Copyright (c) 2012-2018 Icinga Development Team (https://www.icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
  Installation root: /usr
  Sysconf directory: /etc
  Run directory: /run
  Local state directory: /var
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid

System information:
  Platform: Ubuntu
  Platform version: 16.04.4 LTS (Xenial Xerus)
  Kernel: Linux
  Kernel version: 4.4.0-128-generic
  Architecture: x86_64

Build information:
  Compiler: GNU 5.3.1
  Build host: 5cc10848c960

@dnsmichi
Copy link
Contributor

Paths are likely handled differently by the Debian/Ubuntu scripts, they're separated from upstream. Anyhow, path changes are not officially supported, my main concern was the environment variables read from the daemon, thus being the user and the rlimit configuration. Thanks for testing 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants