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

Initialize ICINGA2_ERROR_LOG inside the systemd environment #6773

Merged
merged 1 commit into from Nov 13, 2018

Conversation

dnsmichi
Copy link
Contributor

The initscript uses a local default, which is not here for Systemd.

The initscript uses a local default, which is not here for Systemd.
@dnsmichi
Copy link
Contributor Author

I've tested this with the Debian 2.10.1 packages and a modified Systemd service file. Works fine thus far. Opinions on the variable default initializer @lazyfrosch @dgoetz ?

@dnsmichi dnsmichi added area/setup Installation, systemd, sample files Installation labels Nov 13, 2018
@lazyfrosch lazyfrosch changed the title Imitialize ICINGA2_ERROR_LOG inside the Systemd environment Initialize ICINGA2_ERROR_LOG inside the ystemd environment Nov 13, 2018
@lazyfrosch lazyfrosch changed the title Initialize ICINGA2_ERROR_LOG inside the ystemd environment Initialize ICINGA2_ERROR_LOG inside the systemd environment Nov 13, 2018
Copy link
Contributor

@lazyfrosch lazyfrosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Have you tested this on a CentOS 7?

@dnsmichi
Copy link
Contributor Author

Not yet, I wanted to first check whether you like this fix :)

Done that now:

[root@icinga2-centos7-dev ~]# systemctl restart icinga2
[root@icinga2-centos7-dev ~]# ps aux | grep icinga2
icinga   27337 21.6  0.5 789956 15368 ?        Ssl  16:24   0:01 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e
icinga   27376  0.0  0.0 456140  1756 ?        S    16:24   0:00 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e
root     27386  0.0  0.0 112704   972 pts/0    S+   16:24   0:00 grep --color=auto icinga2

Applied the line in the service file (I am lazy testing, this is clearly not best practice).

vim /lib/systemd/system/icinga2.service

[Unit]
Description=Icinga host/service/network monitoring system
After=syslog.target network-online.target postgresql.service mariadb.service carbon-cache.service carbon-relay.service

[Service]
Type=notify
Environment="ICINGA2_ERROR_LOG=/var/log/icinga2/error.log"
EnvironmentFile=/etc/sysconfig/icinga2
ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2
ExecStart=/usr/sbin/icinga2 daemon --close-stdio -e ${ICINGA2_ERROR_LOG}
PIDFile=/run/icinga2/icinga2.pid
ExecReload=/usr/lib/icinga2/safe-reload /etc/sysconfig/icinga2
TimeoutStartSec=30m
systemctl daemon-reload

Result:

[root@icinga2-centos7-dev ~]# systemctl restart icinga2
[root@icinga2-centos7-dev ~]# ps aux | grep icinga2
icinga   27469 44.0  0.5 790604 15704 ?        Ssl  16:25   0:00 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
icinga   27508  1.0  0.0 456140  1752 ?        S    16:25   0:00 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log

@dnsmichi dnsmichi added this to the 2.10.2 milestone Nov 13, 2018
@dnsmichi dnsmichi merged commit 31c81dc into master Nov 13, 2018
@dnsmichi dnsmichi deleted the bugfix/systemd-error-log branch November 13, 2018 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/setup Installation, systemd, sample files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants