Last active
April 5, 2016 15:02
-
-
Save towo/2d2ed441cc6ab8efd9ded092b911e68e to your computer and use it in GitHub Desktop.
Stop icinga2 logging information-level garbage via systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy to /etc/systemd/system/icinga2.service.d/ (create if needed) | |
# systemctl daemon reload | |
# systemctl restart icinga2.service | |
[Service] | |
# need to unset ExecStart once because it would try to array it. | |
ExecStart= | |
ExecStart=/usr/sbin/icinga2 daemon -e /var/log/icinga2/icinga2.err -x warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# not sure this changes significantly between distributions, but some people are weird. | |
SYSTEMD_PATH="/etc/systemd/system" | |
mkdir -p $SYSTEMD_PATH/icinga2.service.d/ | |
cat <<EOF > $SYSTEMD_PATH/icinga2.service.d/10-loglevel.conf | |
[Service] | |
# need to unset ExecStart once because it would try to array it. | |
ExecStart= | |
ExecStart=/usr/sbin/icinga2 daemon -e /var/log/icinga2/icinga2.err -x warning | |
EOF | |
# fancy check if systemd will ask four your password; not that it matters when sudo is installed. | |
if loginctl show-session $XDG_SESSION_ID | grep Active=yes; then | |
systemctl daemon-reload | |
read -r -p "Restart icinga2.service? [y/N] " response | |
case $response in | |
[yY][eE][sS]|[yY]) | |
systemctl restart icinga2.service | |
;; | |
*) | |
;; | |
esac | |
else; | |
sudo systemctl daemon-reload | |
read -r -p "Restart icinga2.service? [y/N] " response | |
case $response in | |
[yY][eE][sS]|[yY]) | |
sudo systemctl restart icinga2.service | |
;; | |
*) | |
;; | |
esac | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment