pfsense interface and gateway metrics to pfelk - working solution #487
robeweber
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was very much interrested in also getting regular updates on the state of all used interfaces from pfSense on pfELK.
VictorRobellini's telegraf_pfifgw.php script was my starting point.
However I did not want to use telegram and I did not want it to output influx formatted output.
So I changed the PHP code to be used by the cron plugin of pfSense (install this package if you want to also use this).
Download the newly created PHP script:
(https://github.com/robeweber/pfelk/blob/main/pfsense_interfaces.php)
In pfSense, upload the script using the "Upload File" section:

pfSense will display the path where it has uploaded the file to.
It will most likely be /tmp/pfsense_interfaces.php
Using the "Execute Shell Command" on the same page of pfSense, execute the following code to move it to the right place:
mv /mnt/pfsense_interfaces.php /usr/local/bin/pfsense_interfaces.php
I have set the timing to the maximum possible I could figure out:

Set Command to the following:
/usr/local/bin/php-cgi -f /usr/local/bin/pfsense_interfaces.php | /usr/bin/nc YOURPFELKIP 5057
Set logstash to also listen on port 5057. For that I have written a new conf.d pfelk file:
03-input-pfsense-metrics.pfelk
Add the GROK patterns in patterns/pfelk.grok:
Add the following two new sections in:
conf.d/05-apps.pfelk
And add the two following "else if" statements just before the "else" statement in:
in the Kibana dashboard, after the first data has been sent to elasticsearch, you will have to create two new "Data Views" in order to see the data in the Discover tab:
And you are done and enjoy.
I have now uploaded all files as I am using them at this moment.
https://github.com/robeweber/pfelk/tree/main
Only download and overwrite them in your setup if you have not changed anything else yourselves in them and only if you follow all the steps of (#486) and #487
Beta Was this translation helpful? Give feedback.
All reactions