formula-prometheus-ng/prometheus/files/exporter.upstart.jinja
Eric Renfro ce7512d643
Multiple changes in preparation for the "ng" fork.
* Changed references to salt://prometheus-ng/...
* Added generic templates for exporters.
* Added variables passed on to templates.
2019-05-08 16:09:25 -04:00

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