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

Add configuration for running smokeping in slave mode #170

Merged
merged 6 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ param_ports:
param_usage_include_env: true
param_env_vars:
- { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"}
opt_param_usage_include_env: true
opt_param_env_vars:
- { env_var: "MASTER_URL", env_value: "http://<master-host-ip>:80/smokeping/", desc: "Specify the master url to connect to. Used when in slave mode."}
- { env_var: "SHARED_SECRET", env_value: "password", desc: "Specify the master shared secret for this host. Used when in slave mode."}
- { env_var: "CACHE_DIR", env_value: "/tmp", desc: "Specify the cache directory for this host. Used when in slave mode."}

# application setup block
app_setup_block_enabled: true
Expand All @@ -34,9 +39,11 @@ app_setup_block: |
* To reload the configuration without restarting the container, run `docker exec smokeping pkill -f -HUP '/usr/bin/perl /usr/s?bin/smokeping(_cgi)?'`, where `smokeping` is the container ID.
* To restart the container, run `docker restart smokeping`, where `smokeping` is the container ID.
* Note that the default `Targets` file includes items that may or may not work. These are simply to provide examples of configuration.
* Slave setup: modify the `Targets`, `Slaves`, and `smokeping_secrets` files on the master host, per [the documentation](https://manpages.ubuntu.com/manpages/trusty/en/man7/smokeping_master_slave.7.html).

# changelog
changelogs:
- { date: "22.03.24:", desc: "Adding ability to run as a slave."}
- { date: "23.12.23:", desc: "Rebase to Alpine 3.19."}
- { date: "29.11.23:", desc: "Bump tcpping to 1.8." }
- { date: "21.11.23:", desc: "Add support for IRTT Probes." }
Expand Down
3 changes: 3 additions & 0 deletions root/defaults/smokeping_secrets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
host1:mysecret
host2:yoursecret
boomer:lkasdf93uhhfdfddf
8 changes: 8 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-smokeping-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ if [[ ! -L /etc/apache2/httpd.conf ]]; then
ln -sf /config/httpd.conf /etc/apache2/httpd.conf
fi

if [[ ! -e /config/smokeping_secrets ]]; then
cp /defaults/smokeping_secrets /config/smokeping_secrets
fi

if [[ ! -L /etc/smokeping/smokeping_secrets ]]; then
ln -sf /config/smokeping_secrets /etc/smokeping/smokeping_secrets
fi

if [[ -e /config/ssmtp.conf ]]; then
cp /config/ssmtp.conf /etc/ssmtp/ssmtp.conf
fi
Expand Down
10 changes: 8 additions & 2 deletions root/etc/s6-overlay/s6-rc.d/svc-smokeping/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

exec \
s6-setuidgid abc /usr/sbin/smokeping --config="/etc/smokeping/config" --nodaemon
if [ -n "${MASTER_URL}" ] && [ -n "${SHARED_SECRET}" ] && [ -n "${CACHE_DIR}" ]; then
install -g abc -o abc -m 400 -D <(echo $SHARED_SECRET) /var/smokeping/secret.txt
exec \
s6-setuidgid abc /usr/sbin/smokeping --master-url="${MASTER_URL}" --cache-dir="${CACHE_DIR}" --shared-secret="/var/smokeping/secret.txt" --nodaemon
else
exec \
s6-setuidgid abc /usr/sbin/smokeping --config="/etc/smokeping/config" --nodaemon
fi