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: 13+
The dashboard uses the v2 dynamic schema (dashboard.grafana.app/v2) with TabsLayout and conditionalRendering, which require Grafana 13 or later.
A single comprehensive Grafana dashboard covers all 556 metrics across 30 tabs (Overview, System & Resources, Interfaces, Firewall & PF, Gateways & WAN, DNS — Unbound, DHCP, VPN, Routing & Neighbors, Protocol Stats, NTP, Certificates, Services/Cron/DynDNS, NetFlow, CARP/HA, Diagnostics). Tabs and rows auto show/hide based on which metrics your exporter emits, so unused collectors and absent OPNsense plugins disappear automatically.
Import the dashboard¶
- Open Grafana and navigate to Dashboards > New > Import.
- Import the JSON file from the repository:
grafana/dashboard.json - Select your Prometheus data source and click Import.
The dashboard uses template variables for datasource, opnsense_instance, and interface. See grafana/README.md for gcx/GitOps deployment and the bundled alert and recording rules.
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.