Skip to content

Collect various PFSense firewall statistics and send to mqtt queue

Notifications You must be signed in to change notification settings

philliphodges/pfsense-stats

 
 

Repository files navigation

pfsense-stats

Collect various PFSense firewall statistics and send to mqtt queue

Steps:

  1. Collect sample on pfsense firewall
  2. Send from pfsense firewall to mqtt queue on Raspberry Pi
  3. Send sample from Raspberry Pi to Influxdb
  4. Visualize in Grafana dashboard

Statistics gathered:

  • Packet loss (%)
  • Round trip + standard deviation (ms)
  • Internet capacity (MB/s) - using Speedtest

Install on pfsense firewall

  1. enable ssh in web gui
  2. create new user for collecting stats, e.g. statsuser
  3. Generate ssh key for statsuser and upload in web gui

Install Mosquitto publisher on pfsense

ssh firewall1 -l statsuser

sudo pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/c-ares-1.12.0_2.txz
sudo pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/mosquitto-1.4.14.txz
rehash

Collect gateway statistics on pfsense

scp scripts/collect-gateway-stats.sh statsuser@firewall1:
ssh firewall1 -l statsuser
sh collect-gateway-stats.sh &

(or add to startup script so it runs automatically after reboot)

Collect speedtest statistics on pfsense

scp scripts/collect-speedtest-stats.sh statsuser@firewall1:
ssh firewall1 -l statsuser
sh collect-speedtest-stats.sh &

Collect samples on remote MQTT server

Using a raspberry pi

scp *.py rpi1:
scp scripts/*.sh rpi1:
scp config-gateway.properties rpi1:
ssh rpi1
sudo pip3 install influxdb
./start-gateway-eventlog.sh &
./start-gateway-influxdb-writer.sh & 
./start-speedtest-eventlog.sh &
./start-speedtest-influxdb-writer.sh &

About

Collect various PFSense firewall statistics and send to mqtt queue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 77.6%
  • Shell 22.4%