Icinga2: On debian based systems /etc/default/icinga2 is not read/used

Created on 24 Apr 2018  路  13Comments  路  Source: Icinga/icinga2

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

areconfiguration bug

Most helpful comment

Try the following workaround until 2.9 is released:

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

All 13 comments

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

I'm using 2.8.3

Please show us the output of icinga2 --version.

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

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

Try the following workaround until 2.9 is released:

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

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

Scheduled for CW21.

  • [ ] 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

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?

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

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

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 馃憤

Was this page helpful?
0 / 5 - 0 ratings