Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_bandwidth

Rating
6 votes
Favoured:
0
Current Version
1.1
Last Release Date
2015-02-27
Compatible With
  • Nagios 3.x
License
GPL
Hits
61611
Files:
FileDescription
check_bw.shcheck_bw -- v 1.1
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Check Bandwidth
Bandwidth Calculator

Based on Cisco Document ID: 8141

A simple script to calculate input or output bandwidth usage based on a snmp data
First Relase Date 2013-06-10
Requirements: Bc, snmpwalk

** Hostname, speed, community, version, interface, polling time and mode parameters are mandatory

Usage: check_bw.sh -H hostname -b connectionspeed -v snmp version -m input|output -C community -i interface -p time(s)


####List of Available Parameters
-H Hostname of snmp you want to check
-b Maximum speed of your connection in Mb/s (this script is intended to work with synchronous connections)
-v (1|2c) Snmp version
-m (input|output) Specify the direction of the bandwidth you want to check
-C (some text here) Specify the name of the community associated with your host
-i (Interface Name) Specify the interface name that you want to monitor (eg: eth0)
-w (optional) set the warning parameter in Mb/s that is going to be passed to nagios
-c (optional) set the critical parameter in Mb/s that is going to be passed to nagios
-h Print this help screen
-p Polling Time in second


I've Personally tested it only on my Nagios 3.x environment
it actually supports only snmp version 1 and 2c,
I will add version 3 support as soon as i can
Reviews (5)
byAlexSav, December 13, 2018
To get perfomance graph working, replace
echo "OK $mode bandwidth usage is $final Mb/s, $perc% used"
by
echo "OK $mode bandwidth usage is $final Mb/s, $perc% used | ${interface}_${mode}=$final"

and all the same lines with "echo".
Hello gurus,
please help a newbie with steps, here is what i did
*command.cfg*
define command{
command_name check_bw.sh
command_line $USER1$/check_bw.sh
}
*also here switches.cfg*
}
define service{
use generic-service ; Inherit values from a template
host_name SWC-AGG-01
service_description Bandwidth [RDD Backbone]
check_command check_bw.sh! -H 10.3.0.206 -b 100 -v 1 -C afm -m output -i gi10 -p 15
}
*see my result*
(No output returned from plugin)

*but it works when i run it in the terminal*
nagios/libexec# ./check_bw.sh -H 10.3.0.206 -b 100 -v 1 -C afm -m output -i gi9 -p 15
Current output bandwidth usage is 0 Mb/s, 0% used

what could be wrong?
There seems to be a missing piece on this script. I can't get any Performance Data output.
If you can please let me know how to get to work, that would be awesome.

Thanks,
byTJ619, February 24, 2017
Very nice plugin, so easy to used.

I use it for my switch, juste need to specify the port number and OK !

Just 1 thing missed for me, possibility to monitore with same command multiple port (interface) for TRUNK. (And don't need to create a meta-service for that)

And graph for history, but not a big deal.
bynishith, February 21, 2016
1 of 1 people found this review helpful
After a very long search to have a plugin which shows Total Bandwidth on Linux/AIX/Unix Interfaces, I must say that this simple and effective plugins worked well.

Below is my command output:

./check_bw.sh -H 192.16.1.1 -b 100 -v 1 -C public -m input -i eth0 -p 15
Current input bandwidth usage is 80.011 Mb/s, 80.00% used

./check_bw.sh -H 192.168.1.1 -b 100 -v 1 -C public -m output -i eth0 -p 15
Current output bandwidth usage is 2.102 Mb/s, 2.00% used

Here, it is mandatory to mention 2 commands, input and output from the respective server.

The parameter understanding is,
-b=100 Mbps
-p = Every 15 seconds. (You can change this to 10 Mbps or 1000 Mbps as per the server configuration)

The confusing part is, what to give for "Windows Server Network Card", which is always "Local Area Connection" name...??? :(

Except Windows, this is a superb plugin.

Hats off the creator.
Owner's reply

It will work also for windows machine, it's just a bit more tricky how to find out the interface name that is exposed to snmp.

You have to query first off that oid
1.3.6.1.2.1.2.2.1.2 which contain the real name of your interface (note down the entry number)

now query 1.3.6.1.2.1.31.1.1.1.1 and the correspondent entry number you noted down from the previous query contain the exposed name of your interface that you should use in my script

hope it helps