app-metrics/prometheus: Add ebuild with systemd service file.

Package-Manager: Portage-2.3.76, Repoman-2.3.16
This commit is contained in:
Manuel Friedli 2019-11-15 00:32:45 +01:00
parent 9a28d3c842
commit 87ed751ddd
8 changed files with 173 additions and 0 deletions

View file

@ -0,0 +1,28 @@
#!/sbin/openrc-run
# Copyright 2016-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="Prometheus monitoring system and time series database"
pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
user=${user:-${SVCNAME}}
group=${group:-${SVCNAME}}
command="/usr/bin/prometheus"
command_args="${command_args:---config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data}"
command_background="true"
start_stop_daemon_args="--user ${user} --group ${group} \
--stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \
--stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
extra_started_commands="reload"
depend() {
after net
}
reload() {
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $? "Failed to stop ${SVCNAME}"
}

View file

@ -0,0 +1,2 @@
# arguments for Prometheus
command_args=""

View file

@ -0,0 +1,34 @@
#!/sbin/openrc-run
# Copyright 2016-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="Prometheus monitoring system and time series database"
pidfile=/var/run/${RC_SVCNAME}.pid
user=${user:-${RC_SVCNAME}}
group=${group:-${RC_SVCNAME}}
command_user=${user}:${group}
command="/usr/bin/prometheus"
command_args="${command_args:---config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data}"
command_background="true"
error_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
output_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
extra_started_commands="reload"
depend() {
after net
}
reload() {
ebegin "Reloading configuration for ${RC_SVCNAME}"
case "$supervisor" in
supervise-daemon)
supervise-daemon ${RC_SVCNAME} --signal HUP
;;
*)
start-stop-daemon --signal HUP --pidfile "${pidfile}"
;;
esac
eend $? "Failed to reload ${RC_SVCNAME}"
}

View file

@ -0,0 +1,15 @@
[Unit]
Description=Prometheus monitoring system and time series database
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target
[Service]
EnvironmentFile=/etc/conf.d/prometheus
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data $command_args
[Install]
WantedBy=multi-user.target