From deaa246528cb25b6ffbbea25849d9fb3ab3c03b7 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sun, 26 Mar 2023 14:56:34 -0500 Subject: [PATCH] app-metrics/prometheus: fix service script Introduce the prometheus_args variable. Allow the continued use of command_args in the script for now to avoid breaking systems, but document that people should move to prometheus_args. Also, sync most of the defaults with the systemd service. Signed-off-by: William Hubbs --- app-metrics/prometheus/files/prometheus.confd | 28 +++++++++++++++++-- app-metrics/prometheus/files/prometheus.initd | 12 ++++++++ ...3.0.ebuild => prometheus-2.43.0-r1.ebuild} | 0 3 files changed, 38 insertions(+), 2 deletions(-) rename app-metrics/prometheus/{prometheus-2.43.0.ebuild => prometheus-2.43.0-r1.ebuild} (100%) diff --git a/app-metrics/prometheus/files/prometheus.confd b/app-metrics/prometheus/files/prometheus.confd index 93b41b31624cf..19a286f5677a6 100644 --- a/app-metrics/prometheus/files/prometheus.confd +++ b/app-metrics/prometheus/files/prometheus.confd @@ -1,2 +1,26 @@ -# arguments for Prometheus -command_args="" +# additional arguments for Prometheus +# +# command_args should not be set in this file. Instead, you should set +# prometheus_args. +# +# The default settings are listed below. +# If you are not changing these settings, you do +# not need to include them in prometheus_args. +# +# To migrate from using command_args to prometheus_args, drop any of the +# default settings below that you have set the same way then switch to +# prometheus_args. +# +# The new behavior is that prometheus_args will be appended to these +# defaults allowing anything you add to override them. +# +#The default settings are: +# +# --web.enable-lifecycle +# --config.file=/etc/prometheus/prometheus.yml +# --storage.tsdb.path=/var/lib/prometheus/data +# --web.console.templates=/etc/prometheus/consoles +# --web.console.libraries=/etc/prometheus/console_libraries +# --web.enable-admin-api +# +prometheus_args="" diff --git a/app-metrics/prometheus/files/prometheus.initd b/app-metrics/prometheus/files/prometheus.initd index f7371f8ca0600..dc5db03ad5eaa 100644 --- a/app-metrics/prometheus/files/prometheus.initd +++ b/app-metrics/prometheus/files/prometheus.initd @@ -9,7 +9,19 @@ group=${group:-${RC_SVCNAME}} command_user=${user}:${group} command="/usr/bin/prometheus" +if [ -z "${command_args}" ]; then +command_args=" + --web.enable-lifecycle + --config.file=/etc/prometheus/prometheus.yml + --storage.tsdb.path=/var/lib/prometheus/data + --web.console.templates=/etc/prometheus/consoles + --web.console.libraries=/etc/prometheus/console_libraries + --web.listen-address=0.0.0.0:9090 + --web.enable-admin-api + ${prometheus_args}" +else command_args="${command_args:---config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data}" +fi command_background="true" error_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log output_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log diff --git a/app-metrics/prometheus/prometheus-2.43.0.ebuild b/app-metrics/prometheus/prometheus-2.43.0-r1.ebuild similarity index 100% rename from app-metrics/prometheus/prometheus-2.43.0.ebuild rename to app-metrics/prometheus/prometheus-2.43.0-r1.ebuild