Icinga2 bandwidth monitoring of OpenWRT routers
Contents
Disclaimer: this is most probably not the best way to do this.
Context: I use icinga2 to monitor most of my servers and (home/office) routers. Since icinga collects “perfdata” (performance data) and supports sending that data to Graphite, I then use Grafana to produce graphics of the network usage on my network.
Quick notes for me:
-
generate an ssh key for the nagios user in /var/lib/nagios/.ssh (easier done by doing a sudo to nagios, to avoid having to fix permissions/ownership afterwards).
-
scan known hosts, so that icinga doesn’t get stuck, ex: “ssh-keyscan -H example.bidon.ca » /var/lib/nagios/.ssh/known_hosts”
-
copy the “check_bandwidth” script to the OpenWRT device. (nb: check_bandwidth was written by Benjamin Dos Santos, I did two small changes in my fork to support OpenWRT and output the status in the format required for perfdata).
Define a command in Icinga2 in /etc/icinga2/conf.d/commands.conf (or whatever conf file):
|
|
Define a service in /etc/icinga2/conf.d/services/bandwidth.conf (or whatever conf file) :
|
|
Then define the interfaces that should be monitored for each host:
|
|
Author Mathieu Lu
LastMod 2021-05-21