Skip to content

Instantly share code, notes, and snippets.

@amorken
Last active September 18, 2018 08:24
Show Gist options
  • Save amorken/9357b25b88a13354e7ce01c30e4fada6 to your computer and use it in GitHub Desktop.
Save amorken/9357b25b88a13354e7ce01c30e4fada6 to your computer and use it in GitHub Desktop.
Example Systemd configuration that starts the Prometheus node exporter and handles Consul registration.
[Unit]
Description=Prometheus Node Exporter
After=consul-client.target consul-server.target network.target
[Service]
User=prometheus
ExecStart=/usr/bin/node_exporter --web.listen-address :9109
ExecStartPost=/usr/local/bin/consul-cli service-register prometheus-nodeexporter --id=prometheus-nodeexporter --address=%H --port=9109
ExecStop=/usr/local/bin/consul-cli service-deregister prometheus-nodeexporter
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment