From b2c0052d39bb76801f284735c60e4f3c82d072d5 Mon Sep 17 00:00:00 2001 From: wiedehopf Date: Fri, 4 Oct 2024 15:48:49 +0200 Subject: [PATCH] fixup collectd.conf (#233) 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 | 27 ++----------------- .../s6-overlay/startup.d/08-graphs1090-init | 21 +++++++++++++++ 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf3e53e..3ddf31a 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 @@ -158,8 +136,7 @@ RUN \ bash -ec 'echo "$(TZ=UTC date +%Y%m%d-%H%M%S)_$(git rev-parse --short HEAD)_$(git branch --show-current)" > /.CONTAINER_VERSION' && \ popd && \ # Clean-up. - apt-get remove -y ${TEMP_PACKAGES[@]} && \ - apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y && \ + apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y ${TEMP_PACKAGES[@]} && \ apt-get clean -q -y && \ rm -rf /src/* /tmp/* /var/lib/apt/lists/* /var/cache/* && \ # document versions 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*