net.fail

A blog about building and running a larger network, with an IPv6-first mentality. And unrelated video/audio/tech-stuff.

Impressum

Systemd-units for prometheus exporters

2019-11-20

This is mostly documentation for myself. Systemd units for running exporters for prometheus not installed via apt.

Example for the very nice prometheus-junos-exporter by Daniel Czerwonk.

Systemd unit file located in: /lib/systemd/system/prometheus-junos-exporter.service

[Unit]
Description=Prometheus exporter for Junos devices
Documentation=https://github.com/czerwonk/junos_exporter man:prometheus-junos-exporter(1)
After=network.target

[Service]
User=prometheus
EnvironmentFile=/etc/default/prometheus-junos-exporter
ExecStart=/usr/bin/junos_exporter $ARGS
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

Exporter Args: /etc/default/prometheus-junos-exporter

ARGS=" -config.file=/etc/prometheus-junos-exporter/junos-exporter.yml -ssh.keyfile={ID_RSA_path} -ssh.user=prometheus"

Exporter Config in /etc/prometheus-junos-exporter/junos-exporter.yml

targets:
  - router-hostname.domain

features:
  bgp: true
  ospf: true
  isis: false
  l2circuit: false
  environment: true
  routes: true
  routing_engine: true
  interface_diagnostic: false
  interfaces: true