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 <williamh@gentoo.org>
This commit is contained in:
William Hubbs
2023-03-26 14:56:34 -05:00
parent 8fddcacc28
commit deaa246528
3 changed files with 38 additions and 2 deletions

View File

@@ -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=""

View File

@@ -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