Check MK and Iperf – Monitoring bandwidth

Sometimes you want to monitor bandwidth. Maybe you have 500Mbit wan line between offices and want to make sure what actual performance you get. This can be done with Iperf. However Iperf will just give you the info of just this moment. Maybe you want some more details. There is a simple way of doing this in Check MK.

Start by downloading Iperf on your computer. In my case Windows. Use Iperf2.

https://iperf.fr/iperf-download.php

Place this on your computer like c:\iperf2 so we can use this for a test later.

Now log in to your Linux computer that should be monitored.

Install with

sudo apt-get install iperf

Autostart in Linux:

sudo touch /etc/init.d/iperf
sudo chmod +x /etc/init.d/iperf
sudo vi /etc/init.d/iperf
#!/bin/bash
/usr/bin/iperf -s &
sudo update-rc.d iperf defaults

Now your Linux client should be ok. For a Windows server just place the iperf2 on the server and run “iperf.exe -s”. You may want to use the scheduler to autostart it after reboot.

Now test from your computer to run “iperf.exe -c clientip”

If you get a reply it is up and running.

Next step is to install it on Check MK. First download the scipt here

Place it on your server in “omd/sites/mysite/lib/nagios/plugins/”

In WATO create a rule like this. There is another classic Nagios script without perf counters and that is why I camm mine 2 in the end. Choose what servers to apply this on.

Also create a “Normal check interval for service checks” with the service Iperf$. You do not want to run this every minute. I run it one every hour.

I created a service group for Iperf and can get the results like this. I also get nice graphs now.