This script was modified from the original version made by Julien Touche with the intention to support iperf3, it monitors the speed between network links using the iperf3 command, which is an active tool for measurements of the maximum achievable bandwidth on IP networks. check_iperf3.pl allows you to test both, TCP and UDP protocols, also, PERFORMANCE DATA is returned back to Nagios. Keep in mind that iper3 is not compatible with iperf2, so this script will run succesfully with an only. INSTALL ------- $ sudo install --mode=755 check_iperf3.pl /usr/local/bin $ sudo cpan -i JSON NRPE setup ---------- in /etc/nagios/nrpe_local.cfg add the following lines (run check_iperf3.pl without parameters for usage instructions): # get link_max_capacity, critical under 50, warning under 60 command[chk_iperf3_tcp]=/usr/local/bin/check_iperf3.pl 50 60 # udp 300Mbps/sec test command[chk_iperf3_udp]=/usr/local/bin/check_iperf3.pl 150 200 300M ... # udp 3Mbps/sec wifi test command[chk_iperf3_udp_wifi_6Mbps]=/usr/local/bin/check_iperf3.pl 4:8 5:7 6M NAGIOS server ------------- In Nagios Server you must create a new check_nrpe command wich will call the machine running nrpe_server + check_iperf3.pl(wich wraps iperf3 client). By default run a 30 seconds test, so it's necessary to define a custom "timeout". (standard check_nrpe defaults to 10 seconds). define command { command_name check_nrpe_iperf command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 60 -c $ARG1$ } TCP sample output ----------------- $ check_iperf3.pl 10.0.1.10 5 10 OK: iperf returns 11.01MB |Bandwidth=11.01MB INFO: ************************************************************ Iperf Version : iperf 3.0.11 Remote Host:Port : 10.0.1.10:5201 Protocol : TCP TCP MTU : 1340 Streams : 1 Test duration (sec) : 30 Speed (bytes/sec) : 11.01 MB/sec Speed (bits/sec) : 88.11 Mb/sec Block Size : 131072 Bytes transmitted : 330415860 ************************************************************ DEBUG CMD: $ /usr/bin/iperf3 -J -c 10.0.1.10 -t 30 UDP sample output ----------------- $ check_iperf3.pl 10.0.1.10 5 10 120M OK: iperf returns 14.71MB |Bandwidth=14.71MB;;;; Jitter=60.0712ms;;;; Lost_packets_ratio=98.87%;;;; INFO: ************************************************************ Iperf Version : iperf 3.0.11 Remote Host:Port : 10.0.1.10:5201 Protocol : UDP Streams : 1 Test duration (sec) : 5 Speed (bytes/sec) : 14.71 MB/sec Speed (bits/sec) : 117.65 Mb/sec Block Size : 8192 Packets transmitted : 8795 Bytes transmitted : 73531392 Jitter (ms) : 60.0712 Lost Packets : 8696 Lost/Total Ratio (%) : 8696/8795 (98.87) ************************************************************ DEBUG CMD: $ /usr/bin/iperf3 -J -c 10.0.1.10 -u -b 120M -t 5 Wow!, see the packet lost ratio!