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_iftraffic5.pl

Rating
9 votes
Favoured:
1
Current Version
5
Last Release Date
2012-11-13
Compatible With
  • Nagios 3.x
Owner
License
GPL
Hits
99536
Files:
FileDescription
check_iftraffic5.plPerl 5.10
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Supports all Cisco standard interfaces: TenGigabitEthernet, GigabitEthernet, FastEthernet,
Ethernet, Port-channel, Vlan. Also works on standard NIC adaptors.
Checks input/output traffic, unicast pkts, multicast pkts, broadcast pkts, errors and discards on a single interface.
Checks Port-channel member status. Performance data formatting meets Nagios standards.
check_iftraffic5.pl - Nagios(r) network traffic monitor plugin
Copyright (C) 2012 Mike Pagano
Based on Gerd Mueller's check_iftraffic.pl
Contributions by: Adrian Wieczorek, Ektanoor, Markus Werner, Greg Frater and Richard Walraven

Remarks:

* Supports all Cisco standard interfaces: TenGigabitEthernet, GigabitEthernet, FastEthernet,
Ethernet, Port-channel, Vlan. Also works on standard NIC adaptors.
* Checks input/output traffic, unicast pkts, multicast pkts, broadcast pkts, errors and discards on a single interface.
* Checks Port-channel member status by comparing port-channel speed to number.
* Performance data formatting meets Nagios standards.
+ Provides stats for bandwidth by percentage and integer values.
+ Packets in/out for unicast, multicast & broadcast.
+ Number of in/out packet discards & errors.
+ Designed specifically for charting with "Splunk for Nagios".
+ Other reporting programs can use perfdata. IE RRD.
* Checks for interface administrative and operational status up/down.
Down on either returns a critical state.
* Allows either textual or the numeric index value of an interface.
* If the interface speed is not specified on the command line it gets it automatically from IfSpeed.
* Bandwidth options allow checks of:
Asymmetrical links such as a DSL line or cable modem where the download and upload speeds are different.
Minimum input bandwidth useful for IPSEC tunnels.
* Can determine interface to query by matching IP address of host with entry in ipAdEntIfIndex (.1.3.6.1.2.1.4.20.1.2).
* Bits per second are the default now. Use -B for bytes.
* RX, TX and absolute values show bytes/octets only.
* SNMP version 2 as we need 64-bit counters. The 32-bit overflows too fast and too frequently.
* Automatic detection of snmp overflows generates a warning state. Max value used -M.
* Perl's given-where "switch" in some places. Look for the correct "use" for your version of perl.
* Supports Perl 5.10
* -h displays help information to see avaliable options.

Suggestions:

Use -b, --bandwidth with -u, --units. This allows for simple input of interface parameters. Usage -u g=gigabits/s,m=megabits/s,k=kilobits/s,b=bits/s.

Example for a 1 Gig interface:
check_iftraffic42.pl -H host1 -C sneaky -i GigabitEthernet1/2 -b 1 -u g
Nagios command:
$USER1$/check_iftraffic42.pl -H $HOSTADDRESS$ -C $USER3$ -i $ARG1$ -b $ARG2$ -u $ARG3$ -w $ARG4$ -c $ARG5$

Example for a 2 Gig Port-channel
check_iftraffic42.pl -H host1 -C sneaky -i Port-channel1 -b 2 -u g –P 2000000000
Nagios command:
$USER1$/check_iftraffic42.pl -H $HOSTADDRESS$ -C $USER3$ -i $ARG1$ -b $ARG2$ -u $ARG3$ -P $ARG4$ -w $ARG5$ -c $ARG6$
Reviews (7)
byMajed, August 13, 2015
i wanted to monitor cisco nexus 5000 but it needs snmpv3 so why not support it?
The script worked well once I created the directory for storing the cache files. The path was different in Ubuntu. Also, it would be really nice to have an option to track packets per second. A patch (check_iftraffic5-pps.pl.patch.txt) was available at one point but is now offline.
byugenk, March 16, 2013
I've added ability to monitor not only bandwidth, but also PPS (unicast packets per second). Here is the patch:
http://download.datahata.by/check_iftraffic5-pps.pl.patch.txt
bygalid_elmouha, March 6, 2013
Hi

Im using a catalyst 3550 and if i use the script true commandline i get 0 values everywhere.. AverageIn:0.00bps, AverageOut: 0.00bps,.. any ideas?

tnx
byrwalraven, January 24, 2012
need help as to why the exit status is not trigger eventhandlers to run.
bysjorge, October 3, 2011
1 of 1 people found this review helpful
I had to change to the old 32-bit counters for my windows server, took me about 30 min to figure out.

I added an extra switch (x) to set it to 32 when needed.

Patch Below:
--------------
nagios@deimos ~/test $ diff check_iftraffic42.pl check_iftraffic42.pl.original
123,126c123,128
#Older 32-bit counter:
> #my $snmpIfOutOctets = '1.3.6.1.2.1.2.2.1.16';
> my $snmpIfOutOctets = '1.3.6.1.2.1.31.1.1.1.10';
150d151
tOctets32;
bythemtz, September 2, 2011
2 of 2 people found this review helpful
Since the switch to 64 bit counters i am getting totally weird average values like:

CRITICAL - Average IN: 3.41Tbps (170252.50%), Average OUT: 970.95Gbps (48547.45%) Total RX: 5.81TBytes, Total TX: 1.66TBytes|inUsage=170252.50%;85;98 outUsage=48547.45%;85;98 inBandwidth=3405050072654.40bps outBandwidth=970948946016.00bps inAbsolut=6384549288059 outAbsolut=1820440453052 Bandwidth=2000000000

The old version with 32 bit counters works fine, but of course it loops all the time on my fast interfaces.

Any idea ?

PS: Checked system is a Cisco Catalyst 4510 and several 2960
Owner's reply

At line 547 please change %.01d to %s. This should take care of it.

if ( open(FILE,">".$TRAFFIC_FILE."_if".$iface_number."_".$host_address )) {
printf FILE ("%s:%s:%s
", $update_time, $in_bits, $out_bits );
close(FILE);
};