diff options
Diffstat (limited to 'app-metrics/portage-exporter/files')
-rw-r--r-- | app-metrics/portage-exporter/files/portage-exporter.confd | 26 | ||||
-rw-r--r-- | app-metrics/portage-exporter/files/portage-exporter.initd | 49 |
2 files changed, 75 insertions, 0 deletions
diff --git a/app-metrics/portage-exporter/files/portage-exporter.confd b/app-metrics/portage-exporter/files/portage-exporter.confd new file mode 100644 index 000000000000..3bd24a22a809 --- /dev/null +++ b/app-metrics/portage-exporter/files/portage-exporter.confd @@ -0,0 +1,26 @@ +# /etc/conf.d/portage-exporter + +# PID file +#EXPORTER_PIDFILE="/run/${RC_SVCNAME}.pid" + +# The termination timeout (start-stop-daemon parameter "retry") ensures +# that the service will be terminated within a given time (60 + 5 seconds +# per default) when you are stopping the service. +#EXPORTER_TERMTIMEOUT="TERM/60/KILL/5" + +# User to run exporter as +#EXPORTER_USER="portage-exporter" + +# User group to run exporter as +#EXPORTER_GROUP="portage-exporter" + +# You can use this configuration option to pass additional options to the +# start-stop-daemon, see start-stop-daemon(8) for more details. +# Per default we wait 1000ms after we have started the service to ensure +# that the daemon is really up and running. +#EXPORTER_SSDARGS="--wait 1000" + +# Exporter flags (passed via env) +#SERVE_ADDRESS=":2112" +#SERVE_PATH=/metrics +VDB_UPDATE_INTERVAL=1800 diff --git a/app-metrics/portage-exporter/files/portage-exporter.initd b/app-metrics/portage-exporter/files/portage-exporter.initd new file mode 100644 index 000000000000..9aa53f509a6e --- /dev/null +++ b/app-metrics/portage-exporter/files/portage-exporter.initd @@ -0,0 +1,49 @@ +#!/sbin/openrc-run +# Copyright 2016-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Prometheus exporter for Portage packages" + +EXPORTER_FLAGS=${EXPORTER_FLAGS:-""} +#EXPORTER_USER=${EXPORTER_USER:-"portage-exporter"} +#EXPORTER_GROUP=${EXPORTER_GROUP:-"portage-exporter"} +EXPORTER_PIDFILE=${EXPORTER_PIDFILE:-"/run/${RC_SVCNAME}.pid"} +EXPORTER_SSDARGS=${EXPORTER_SSDARGS:-"--wait 1000"} +EXPORTER_TERMTIMEOUT=${EXPORTER_TERMTIMEOUT:-"TERM/60/KILL/5"} + +command="/usr/bin/portage-exporter" +command_args="${EXPORTER_FLAGS}" +command_background="true" +start_stop_daemon_args="${EXPORTER_SSDARGS}" +start_stop_daemon_args="${start_stop_daemon_args} ${EXPORTER_USER:+--user }${EXPORTER_USER}" +start_stop_daemon_args="${start_stop_daemon_args} ${EXPORTER_GROUP:+--group }${EXPORTER_GROUP}" + +getconfig() { + local key="$1" + local value_default="$2" + local value= + + if service_started; then + value="$(service_get_value "${key}")" + fi + + if [ -z "${value}" ]; then + # Value not explicitly set + echo "${value_default}" + else + echo "${value}" + fi + + return 0 +} + +pidfile="$(getconfig pidfile ${EXPORTER_PIDFILE})" +retry="$(getconfig retry ${EXPORTER_TERMTIMEOUT})" + +depend() { + after net.lo loopback +} + +start_post() { + service_set_value retry "${EXPORTER_TERMTIMEOUT}" +} |