Skip to content

Instantly share code, notes, and snippets.

@towo
Last active April 5, 2016 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save towo/2d2ed441cc6ab8efd9ded092b911e68e to your computer and use it in GitHub Desktop.
Save towo/2d2ed441cc6ab8efd9ded092b911e68e to your computer and use it in GitHub Desktop.
Stop icinga2 logging information-level garbage via systemd
# 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
#!/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