Eric Renfro
ce7512d643
* Changed references to salt://prometheus-ng/... * Added generic templates for exporters. * Added variables passed on to templates.
30 lines
792 B
Django/Jinja
30 lines
792 B
Django/Jinja
# Prometheus {{ svc }} (Upstart unit)
|
|
description "Prometheus {{ svc }}"
|
|
start on runlevel [2345]
|
|
stop on runlevel [06]
|
|
|
|
env EXPORTER={{ bin_path }}/{{ svc }}
|
|
env USER={{ user }}
|
|
env GROUP={{ group }}
|
|
env DEFAULTS=/etc/default/{{ svc }}
|
|
env RUNDIR=/var/run/{{ svc }}
|
|
env PID_FILE=/var/run/{{ svc }}/{{ svc }}.pid
|
|
pre-start script
|
|
[ -e $DEFAULTS ] && . $DEFAULTS
|
|
|
|
mkdir -p $RUNDIR || true
|
|
chmod 0750 $RUNDIR || true
|
|
chown $USER:$GROUP $RUNDIR || true
|
|
end script
|
|
|
|
script
|
|
# read settings like GOMAXPROCS from "/etc/default/{{ svc }}", if available.
|
|
[ -e $DEFAULTS ] && . $DEFAULTS
|
|
|
|
export GOMAXPROCS=${GOMAXPROCS:-2}
|
|
exec start-stop-daemon -c $USER -g $GROUP -p $PID_FILE -x $EXPORTER -S -- $ARGS
|
|
end script
|
|
|
|
respawn
|
|
respawn limit 10 10
|
|
kill timeout 10
|