I try to use Open Source when a good solution exists, so for my home firewall, I’m using OPNSense – a very powerful FreeBSD-based firewall appliance with great features along with a powerful GUI.
One of the plugins available with OPNSense is node_exporter, which exposes a lot of operating system metrics through the Prometheus protocol.
Installing this plugin will allow you to monitor your OPNSense based firewall with any Prometheus-compatible system including, as you have guessed, Percona Monitoring and Management (PMM).
For best results, you will need PMM 2.14 or later, as it has improved support for external exporters.
Adding OPNSense to PMM for monitoring requires just one simple command:
pmm-admin add external-serverless --url=http://10.11.13.1:9100/metrics --external-name fw01 --group opnsense
Let’s break down what this command does:
- We are adding this as “serverless” exported because there are no pmm-agent processes running on that node and the only access we have to it is through the Prometheus protocol.
- 10.11.13.1 is the IP of the firewall. Port 9100 is what OPNSense uses by default.
- I chose to name this firewall “fw01” for purpose of monitoring, this is how it will be identified in PMM.
- We put it in the group “opnsense” which will allow us to easily have dashboards that are focused on OPNSense firewalls only, not accidentally picking data from other services.
If you prefer, you can also use your PMM installation instead (See PMM -> PMM Add Instance Menu) and pick “External Service”.
After this step, we will already have some information available in our PMM installation.
The Node Summary Dashboard will pick up some of the OS metrics, however, as this dashboard is built with a focus on Linux rather than FreeBSD, we will not have all data populated or tested to be correct, and this should be seen as a lucky incident rather than an expected outcome.
The next step you can take is to look if there are any dashboards available for the system you’re looking to monitor. A quick search located this dashboard on the Grafana website.
While this dashboard was a good start, it relied on very particular naming of the hosts in order to work and had some bugs which needed fixing. If a given dashboard was not designed to work with PMM, you also often need to make some adjustments because PMM applies different labels to the metrics compared to a vanilla Prometheus installation.
I uploaded an updated dashboard back to the Grafana website.
This makes installing it with PMM very easy; just go to Import Dashboard and Enter Dashboard ID – 14150
Once the dashboard is imported you will see a variety of data the OpnSense built-in node_exporter provides: