Network Connections, Stats and Bandwidth

check_bandwidth

Description:

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

Current Version

1.1

Last Release Date

2015-02-27

Compatible With

  • Nagios 3.x

Owner

License

GPL


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Files
Project Notes
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 (8) Add a Review
Great script
by TcoUpLoad, April 30, 2024
It is a great script, and a take the liberty to adapt it to snmpv3 and create a fork to discover the oid of an interface. great job
Helpful? Yes  No 
Problem with configure in Command.cfg
by snakepit-97, December 31, 2020
the pluggin is excellent but I have a little problem for define the pluggin in commnads.cfg
Helpful? Yes  No 
check_command check_bw.sh! -H 10.3.0.206 -b 100 -v 2c -C test-m output -i gi1 -p 15
by haseebraza, November 30, 2020
Its not working with SNMP v2c and Nagios 4.4.6
It always says something is missing but don't know what is missing even i am adding all the parameters for cisco 3800.
is there any super geek who can help me ?
Helpful? Yes  No 
perfomance
by AlexSav, December 31, 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".
Helpful? Yes  No 
newbie to Nagios and cant use this plugin
by dapoalla, June 30, 2018
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?
1 of 1 found this review helpful.
Helpful? Yes 1 No 0
No Performance Data
by sandyc@vpi-inc.com, March 31, 2018
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,
Helpful? Yes  No 
Easy as hell !
by TJ619, February 28, 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.
Helpful? Yes  No 
It Worked...!!!
by nishith, February 29, 2016
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


1 of 1 found this review helpful.
Helpful? Yes 1 No 0
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.5 (10)
Favorites
1
Views
79,466