Integration & Dashboards¶
This guide covers integrating the OPNsense Exporter with Prometheus and Grafana, including scrape configuration, dashboard import, and practical PromQL queries.
Prometheus scrape configuration¶
Add the following scrape job to your prometheus.yml:
scrape_configs:
- job_name: opnsense
scrape_interval: 30s
scrape_timeout: 10s
static_configs:
- targets:
- "exporter-host:8080"
relabel_configs:
- source_labels: [__address__]
target_label: instance
replacement: "my-firewall"
Multi-instance configuration¶
If you monitor multiple OPNsense firewalls, add a target for each exporter instance:
scrape_configs:
- job_name: opnsense
scrape_interval: 30s
static_configs:
- targets:
- "exporter-primary:8080"
labels:
firewall: primary
- targets:
- "exporter-secondary:8081"
labels:
firewall: secondary
Prometheus Operator¶
See the Kubernetes deployment guide for ScrapeConfig and ServiceMonitor examples.
Grafana dashboard¶
Minimum Grafana version: 11.4+
The comprehensive dashboard uses the v2beta1 schema with TabsLayout, which requires Grafana 11.4 or later.
A comprehensive Grafana dashboard covering all 275+ metrics is available for visualizing OPNsense Exporter data. The dashboard is organized into 8 tabs: Overview, Firewall, Interfaces, Gateways, DNS, VPN, DHCP & Neighbors, and Network Internals.
Import the dashboard¶
- Open Grafana and navigate to Dashboards > Import.
- Import the JSON file from the repository:
deploy/grafana/dashboard.json - Select your Prometheus data source and click Import.
The dashboard uses template variables for datasource, opnsense_instance, interface, and rate_interval.
Legacy dashboard¶
The legacy v1 dashboard is still available at deploy/grafana/dashboard-v1.json or via Grafana.com (ID: 21113) for older Grafana versions.
Example PromQL queries¶
Gateway monitoring¶
Gateway availability overview:
Average RTT per gateway over 5 minutes:
Gateways with packet loss above 1%:
Firewall traffic analysis¶
Total pass packets per second by interface:
sum by (interface) (
rate(opnsense_firewall_ipv4_pass_packets_total[5m])
+ rate(opnsense_firewall_ipv6_pass_packets_total[5m])
)
Block rate by interface:
sum by (interface) (
rate(opnsense_firewall_ipv4_block_packets_total[5m])
+ rate(opnsense_firewall_ipv6_block_packets_total[5m])
)
Firewall state table utilization:
System resources¶
Memory usage percentage:
Load average trend (1-min):
Disk usage by device:
Certificate expiry alerting¶
Days until certificate expiry:
Certificates expiring within 14 days:
(opnsense_certificate_valid_to_seconds - time()) / 86400 < 14
and
(opnsense_certificate_valid_to_seconds - time()) > 0
DNS performance¶
Unbound query rate:
DNS cache hit ratio:
rate(opnsense_unbound_dns_cache_hits_total[5m])
/ (
rate(opnsense_unbound_dns_cache_hits_total[5m])
+ rate(opnsense_unbound_dns_cache_misses_total[5m])
) * 100
VPN monitoring¶
WireGuard peer transfer rates:
IPsec tunnel status:
High-availability¶
CARP VIP status (MASTER=1, BACKUP=2, INIT=0):
CARP demotion counter (non-zero indicates issues):
NTP health¶
NTP offset across all peers:
NTP peers with poor reachability:
Temperature alerts¶
High temperature alert (above 75C):
Alerting rules¶
Example Prometheus alerting rules for OPNsense monitoring:
groups:
- name: opnsense
rules:
- alert: OPNsenseDown
expr: opnsense_up == 0
for: 2m
labels:
severity: critical
annotations:
summary: "OPNsense exporter cannot reach {{ $labels.opnsense_instance }}"
- alert: OPNsenseGatewayDown
expr: opnsense_gateways_status != 1
for: 1m
labels:
severity: warning
annotations:
summary: "Gateway {{ $labels.gateway }} is down on {{ $labels.opnsense_instance }}"
- alert: OPNsenseCertExpiringSoon
expr: (opnsense_certificate_valid_to_seconds - time()) / 86400 < 14
for: 1h
labels:
severity: warning
annotations:
summary: "Certificate {{ $labels.description }} expires in {{ $value | humanize }} days"
- alert: OPNsenseHighMemory
expr: opnsense_system_memory_used_bytes / opnsense_system_memory_total_bytes > 0.9
for: 5m
labels:
severity: warning
annotations:
summary: "Memory usage above 90% on {{ $labels.opnsense_instance }}"
- alert: OPNsenseHighTemperature
expr: opnsense_temperature_celsius > 80
for: 5m
labels:
severity: warning
annotations:
summary: "Temperature {{ $value }}C on {{ $labels.device }} ({{ $labels.opnsense_instance }})"
Complementary exporters¶
The OPNsense Exporter focuses on OPNsense-specific metrics. For complete visibility, consider running these alongside it:
- node_exporter -- Install on the OPNsense firewall itself for OS-level metrics (CPU, memory, disk I/O, network). The OPNsense Exporter provides OPNsense-specific views of some of these, but node_exporter offers deeper system-level detail.
- blackbox_exporter -- Probe endpoints through the firewall to verify connectivity and measure latency from the network edge.