Pfsense Gateway Latency with Telegraf

Some years ago I started using the Telegraf package on pfSense and was disappointed to find out that it didn’t report the gateway latencies. So I wrote a quick&dirty Python 2 script that would parse the output of pfSense’s dpinger and output it in a format that Telegraf could send to InfluxDB.

With the most recent update of pfSense to version 2.4.5 Python 2 is no longer included and I had to update my script to Python 3.

The updated version (as well as the older version for Python 2) can be found in this Gist. Copy that Python script into /usr/local/libexec/telegraf/. And don’t forget to add that “Additional configuration for Telegraf” snippet to the configuration of Telegraf in the pfSense GUI.