Realtime bandwidth monitoring with Nagios
-
I wrote these little scripts for monitoring my realtime DL/UL pfsense bandwidth for Nagios and graph them. It can be done with a single script using bash but I decided to use it as an opportunity to brush up my Python. The Python script purely outputs the Mbit/s only and the bash script handles text output and exit codes and Nagios perfdata for graphing. There seems to be a problem with the SNMP octet readout occasionally which causes the speed calculation to yield a negative number, so I made the bash script to output UNKNOWN in those cases so the graph does not get jacked up.
You will need to edit the bash script slightly to identify the location of Python binary, location of Python script and your max bandwidth.
Examples:
./pfsense_bandwidth <hostname>public ifInOctets. <interface number="">./pfsense_bandwidth.py -H <hostname>-C public -I ifInOctets. <interface.number>pfsense_bandwidth.zip</interface.number></hostname></interface></hostname>