Harnessing the Power of Prometheus and Netbox: Mastering HTTP Service Discovery for Streamlined Monitoring

Prometheus and Netbox, two powerful tools that, when combined, can supercharge your monitoring capabilities and streamline your operations. In this blog post, we'll explore the seamless integration of Prometheus with Netbox using HTTP service discovery, which enables you to effortlessly discover and manage your network devices.

Netbox version 3.5.0+
Prometheus version 2.28.0+

Create an 'Export Template' in Netbox.

For this example select 'Virtualization > Virtual Machine' for content types.

Example template code:

    {% for vm in queryset %}{% if vm.status and vm.primary_ip %}
        "targets": ["{{ vm.primary_ip.address.ip }}:9100"],
        "labels": {
            "host": "{{ vm.name }}",
            "role": "{{ vm.role }}"
    }{% if not loop.last %},{% endif %}{% endif %}{% endfor %}

Under rendering put application/json for MIME type.

Make sure 'As attachment' is unchecked.

Validate your export template by going to this URL

Configure Prometheus

Job config example:

  - job_name: "http_sd_netbox"
      - url: http://netbox/api/virtualization/virtual-machines/?export=prometheus
        refresh_interval: 15s
          type: "Token"
          credentials: "132123123123132"

Embrace this powerful combination to unlock new possibilities and elevate your monitoring capabilities to new heights.

Get $200 in cloud credits from DigitalOcean using my link: https://m.do.co/t/909d52b6253a

DigitalOcean Referral Badge