blob: 1fa73569ac7bdf94ac2696006b504764c781fc99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/sbin/openrc-run
# Copyright 2016-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
description="Prometheus exporter for LVM metrics"
EXPORTER_FLAGS=${EXPORTER_FLAGS:-""}
#EXPORTER_USER=${EXPORTER_USER:-"prometheus-lvm-exporter"}
#EXPORTER_GROUP=${EXPORTER_GROUP:-"prometheus-lvm-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/prometheus-lvm-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 lvm lvm-monitoring
}
start_post() {
service_set_value retry "${EXPORTER_TERMTIMEOUT}"
}
|