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

Directory Tree

check_bandwidth

Rating
10 votes
Favoured:
1
Current Version
1.1
Last Release Date
2015-02-27
Compatible With
  • Nagios 3.x
License
GPL
Hits
79739
Files:
FileDescription
check_bw.shcheck_bw -- v 1.1
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!
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 (8)
byTcoUpLoad, April 12, 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
the pluggin is excellent but I have a little problem for define the pluggin in commnads.cfg
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 ?
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".
bydapoalla, June 18, 2018
1 of 1 people found this review helpful
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