From dc6b79e56a2df7f1e2d1833cb39e3f6e0eaa5dfe Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Thu, 3 Oct 2024 23:04:54 +0200 Subject: [PATCH] fixup collectd.conf the container customizations done in Dockerfile were somewhat broken when adding the hide system graphs option fix that by doing the customizations in graphs1090-init --- Dockerfile | 24 +------------------ .../s6-overlay/startup.d/08-graphs1090-init | 21 ++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf3e53e..150a9c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -104,13 +104,7 @@ RUN \ && \ # ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L148 chmod -v a+x /usr/share/graphs1090/*.sh && \ - # ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L151 - cp -v \ - /usr/share/graphs1090/git/collectd.conf \ - /etc/collectd/collectd.conf \ - && \ - # ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L171 - sed -i '//a\ \ \ \ Interface "eth0"' /etc/collectd/collectd.conf && \ + # collectd.conf customization done in graphs1090-init # ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L179 cp -rv \ /usr/share/graphs1090/git/html \ @@ -130,22 +124,6 @@ RUN \ mkdir -p /usr/share/graphs1090/data-symlink && \ # ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L217 ln -vsnf /run/readsb /usr/share/graphs1090/data-symlink/data && \ - # ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L218 - sed -i -e 's?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf && \ - ## Lines below merge the tar1090 collectd config with the graphs1090 collectd config - # remove the default syslog config in collectd.conf - sed -i '//,/<\/Plugin>/d' /etc/collectd/collectd.conf && \ - # replace syslog plugin with logfile plugin in collectd.conf - sed -i 's/LoadPlugin\ syslog/LoadPlugin logfile/' /etc/collectd/collectd.conf && \ - # add configuration to log to STDOUT in collectd.conf ("/a" == append lines after match) - sed -i '/LoadPlugin\ logfile/a\\n\n<\/Plugin>' /etc/collectd/collectd.conf && \ - sed -i '//a\ \ \ \ PrintSeverity\ true' /etc/collectd/collectd.conf && \ - sed -i '//a\ \ \ \ Timestamp\ false' /etc/collectd/collectd.conf && \ - sed -i '//a\ \ \ \ File\ STDOUT' /etc/collectd/collectd.conf && \ - sed -i '//a\ \ \ \ LogLevel\ "notice"' /etc/collectd/collectd.conf && \ - # add tar1090 specific stuff - sed -i '$a\\n' /etc/collectd/collectd.conf && \ - sed -i '$aFQDNLookup\ true' /etc/collectd/collectd.conf && \ # set up base telegraf config directories ##telegraf##mkdir -p /etc/telegraf/telegraf.d && \ # document telegraf version diff --git a/rootfs/etc/s6-overlay/startup.d/08-graphs1090-init b/rootfs/etc/s6-overlay/startup.d/08-graphs1090-init index 270f00f..1eddd92 100755 --- a/rootfs/etc/s6-overlay/startup.d/08-graphs1090-init +++ b/rootfs/etc/s6-overlay/startup.d/08-graphs1090-init @@ -20,6 +20,27 @@ else cp /usr/share/graphs1090/git/collectd.conf /etc/collectd/collectd.conf fi +# ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L171 +sed -i '//a\ \ \ \ Interface "eth0"' /etc/collectd/collectd.conf +# ref: https://github.com/wiedehopf/graphs1090/blob/151e63a810d6b087518992d4f366d9776c5c826b/install.sh#L218 +sed -i -e 's?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf +## Lines below merge the tar1090 collectd config with the graphs1090 collectd config +# remove the default syslog config in collectd.conf +sed -i '//,/<\/Plugin>/d' /etc/collectd/collectd.conf +# replace syslog plugin with logfile plugin in collectd.conf +sed -i 's/LoadPlugin\ syslog/LoadPlugin logfile/' /etc/collectd/collectd.conf +# add configuration to log to STDOUT in collectd.conf ("/a" == append lines after match) +sed -i '/LoadPlugin\ logfile/a\\n\n<\/Plugin>' /etc/collectd/collectd.conf +sed -i '//a\ \ \ \ PrintSeverity\ true' /etc/collectd/collectd.conf +sed -i '//a\ \ \ \ Timestamp\ false' /etc/collectd/collectd.conf +sed -i '//a\ \ \ \ File\ STDOUT' /etc/collectd/collectd.conf +sed -i '//a\ \ \ \ LogLevel\ "notice"' /etc/collectd/collectd.conf +# add tar1090 specific stuff +# shellcheck disable=SC2016 +sed -i '$a\\n' /etc/collectd/collectd.conf +# shellcheck disable=SC2016 +sed -i '$aFQDNLookup\ true' /etc/collectd/collectd.conf + # Disable a few graphs based on parameter settings: if chk_enabled "${GRAPHS1090_DISABLE_CHART_CPU}"; then sed -i '/^\s*
$/{$!{N;s/\(
\n\s*