How can I monitor the Internet bandwidth of an AVM Fritzbox router in LibreNMS?

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

The AVM Fritzbox (https://en.avm.de/products/fritzbox/) does not offer monitoring capability though SNMP or other standard monitoring technologies.

Can I monitor the bandwidth usage of the DSL, ADSL or VDSL Internet connection using LibreNMS?

In PRTG it seems to be there is a way with a native [EXE/Script Advanced sensors]
https://www.paessler.com/manuals/prtg/exe_script_advanced_sensor

Kindly regards

Update 07/28/2019

Got WAN interface data from fritz.box via nagios " check_nwc_health" script by using this german guideline.

For some reason it does not generate graphs for the WAN interface usage.
For the uptime check from check_nwc_health it does.
Anyone have an idea why this is so and how to fix it?

====================================

Component Version
LibreNMS 1.53.1-58-g5400a908f
DB Schema 2019_07_03_132417_create_mpls_saps_table (139)
PHP 7.2.9-1+b2
MySQL 10.3.15-MariaDB-1
RRDTool 1.7.1
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.8.6
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

Fix it

I fix some permission updates in librenms with:

sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/

and delete and recreate the services again.
Now its generates graphs for my upnp interface_usage, interface_status and uptime service. :slight_smile:

Hotow:
I used the “check_nwc_health” https://labs.consol.de/nagios/check_nwc_health/index.html#download script by using this german guideline https://blog.mansshardt.net/monitoring-einer-fritzbox-7390-mit-nagios/ which is original for nagios but it works for Librenms too.

Step 1: Install dependencies

Certain Perl modules are required for the plugin to function correctly. These can be installed with the help of apt.

apt-get install libsoap-lite-perl libxml-libxml-perl libjson-perl build-essential

Step 2: Download and unzip the plugin
(use latest version from https://labs.consol.de/nagios/check_nwc_health/#download

ssh -l username librenms-ip
sudo -i
cd /usr/lib/nagios/plugins
wget https://labs.consol.de/assets/downloads/nagios/check_nwc_health-7.10.0.6.tar.gz

A more recent version of the plugin may already be available at http://labs.consol.de/nagios/check_nwc_health/_nwc_health/.

Roof of the download check_nwc_health must be unpacked.

tar xzf check_nwc_health-7.10.0.6.tar.gz

Step 3: Install the plugin

To install check_nwc_health, first change to the directory that was unpacked in step 2.

cd check_nwc_health-7.10.0.6

Afterwards the script must be configured for the installation with the following command:

./configure

After that, it is compiled with make.

make

Since only one of the compiled files is needed, you can save “make install” at this point.

Under Debian the Nagios plugins are located under /usr/lib/nagios/plugins by default. This is where it has to be moved now.

mv plugins-scripts/check_nwc_health /usr/lib/nagios/plugins/

The Nagios plugin check_nwc_health is now installed.

Step 4: Add Services in LibreNMS

  • Goto your LibreNMS Add Services Webpage http://librenms/addsrv and choose your “fritz.box” Device.
  • Choose as Type “check_nwc_health
  • Enter a “Description” (optional)
  • Let the IP Address field empty
  • Under Parameters you can enter the following parameters: (use your fritz.box IP or DNS name)

To see WAN interface-usage
--hostname fritz.box --port 49000 --mode interface-usage

To see WAN interface-status
--hostname fritz.box --port 49000 --mode interface-status

To see Uptime check UPNP49000
--hostname fritz.box --port 49000 --mode uptime

JPG

After that you will see the services in LibreNMS and created RRD graphs.

Troubleshooting

If you got a permission file system error check during first check of nwc_health service, fix it with root privilges on SSH CLI:

ssh -l username librenms-ip
sudo -i
cd /var/tmp/
chmod librenms:librenms +R check_nwc_health

The service can be directly checked via SSH CLI if you like:

ssh -l username librenms-ip
sudo -i
cd /usr/lib/nagios/plugins

./check_nwc_health --hostname fritz.box --port 49000 --mode interface-usage
 OK - interface WAN usage is in:0.32% (315740.55bit/s) out:0.07% (21574.67bit/s) | 'WAN_usage_in'=0.32%;80;90;0;100 'WAN_usage_out'=0.07%;80;90;0;100 'WAN_traffic_in'=315740.55;78649600;88480800;0;98312000 'WAN_traffic_out'=21574.67;26003200;29253600;0;32504000

./check_nwc_health --hostname fritz.box --port 49000 --mode interface-status
 OK - interface WAN (91.55.168.41) status is Connected

./check_nwc_health --hostname fritz.box --port 49000 --mode uptime
 OK - device is up since 1h 51m 40s, FRITZ!Box Fon WLAN 7390 | 'uptime'=112;15:;5:;;

If you still have problems by creating RRD graphs, Validate your libreNMS config http://librenms/validate if you have some folder permission issues and fix that with:

sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/

Thats it!
Hope it works on your installation as well and you could enjoy it! :wink: