pfSense graphs in Grafana

Using Grafana with pfSense

I put this guide together using information from various other blogs. This is current as of 2018 and using pfSense 2.4.2. For this tutorial, you’ll need your IP or hostname of your influxdb data source and your username and password.

The data flow is as follows:
pfSense -> Telegraf (gather metrics) -> InfluxDB (store metrics) -> Grafana (render graphs)

Step 1 - Install Telegraf on pfSense

ssh in to pfsense and select option 8 to get a shell

1
ssh pfsense-01.chrisbergeron.com

Select option 8 to get a shell.

Download telegraf:

1
pkg add wget http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/telegraf-1.4.4.txz

Enable telegraf:

1
echo 'telegraf_enable=YES' >> /etc/rc.conf

Edit the telegraf config file:

1
2
cd /usr/local/etc
vi telegraf.conf

Step 2 - Configure Telegraf

Make the following changes:

1
2
3
4
5
6
7
8
9
10
[[outputs.influxdb]]
urls = ["http://10.5.5.40:8089"]
...
database = "pfsense"
...
username = "your_username"
password = "your_password"
[[inputs.net]]
interfaces = ["igb0", "igb1", "igb2", "ovpns1"]

You’ll have to modify the inputs for your own setup. In this example, I’ll be monitoring an OpenVPN tunnel and 3 interfaces: WAN, LAN and backup WAN.

Step 3 - Start Telegraf

Finally, start telegraf:

1
2
cd /usr/local/etc/rc.d
./telegraf start

You won’t need to restart anything on the pfSense box. If you have any issues, you can look at the log file (/var/log/telegraf.log). In a future blog post I’ll show how to create a data source in Grafana using the influx source and building a basic graph.

I’m mainly graphing bandwidth, but you can graph any of the following:

  • cpu
  • disk
  • diskio
  • net
  • processes
  • swap
  • system

Here’s Graph sample:

Grafana Dashboard

Technology used:



Grafana
InfluxDBpfSenseTelegraf
Comments