Personal tools
You are here: Home Projects Nagios Plugins check_iftraffic

check_iftraffic

by Herbert Straub last modified 2011-01-22 16:03

The check_iftraffic Nagios plugin read the Interface TX and RX octects via snmp. This is a modified version of the original check_iftraffic plugin from nagios-exchange.

Summary

  • This version supports SNMP version 2c with 64 bit counter
  • Calculate the warning and critical thresholds from unit with base 2**X and 10 ** X
  • Updated Copyright
  • Updated help and license output
  • New option -d for the temporary data files
  • New option -x für debuging
  • Print version information

Performance Graph NagPerfDiag

Template is included in NagPerfDiag. Datatype Information:

  • DS1: Gauge
  • DS2: Gauge
  • DS3: Counter
  • DS4: Counter
/opensource-projects/misc/network-traffic.png

Test

Call

check_iftraffic.pl -H 10.1.1.10 -s 1 -i "Port #3" -b 1 -u gibits -c 100

Result

Total RX Bytes: 102752022.00 B, Total TX Bytes: 244384944.00 B<br>Average
Traffic: 1020.87 B/s (0.0%) in, 967.92 B/s (0.0%) out|inUsage=0.0%;85;100;;
outUsage=0.0%;85;100;; inAbsolut=99581192B;114085069;134217728;;
outAbsolut=241378570B;114085069;134217728;;

Help Output

Copyright (C) 2004 Gerd Mueller / Netways GmbH
Copyright (C) 2006,2007,2009,2011 Herbert Straub <herbert@linuxhacker.at>

Version: 2.1

Usage: check_iftraffic.pl -H host -i if_descr -b if_max_speed [ -w warn ] [ -c crit ]


Options:

-h --help
    This text.

-l --license
    The license information.

-H --host STRING or IPADDRESS
    Check interface on the indicated host.

-C --community STRING
    SNMP Community.

-s --snmp_version 1 | 2 | 2c
    Specify the snmp version. The current version supports 1 and 2c.

-i --interface STRING
    Interface Name

-b --bandwidth INTEGER
    Interface maximum speed in kilo/mega/giga/Bits per second. See
    the units options for details. This value is used for the
    warning and critical threshold calculation.

-u --units STRING
    Specify the unit of the bandwith options
    Possible values for binary prefix:
      Tibit = tebibits/s ( 2 ** 40 bits )
      Gibit = gibibits/s ( 2 ** 30 bits )
      Mibit = mebibits/s ( 2 ** 20 bits )
      Kibit = kibibits/s ( 2 ** 10 bits )

    Possible values for decimal prefix
      Tbit = terabits/s ( 10 ** 12 )
      Gbit = gigabits/s ( 10 ** 9 )
      Mbit = megabits/s ( 10 ** 6 )
      kbit = kilobits/s ( 10 ** 3 )

      b = bits/s

    Compatibility to older version of check_iftraffic
      g = Gbit
      m = Mbit
      k = kbit

    The unit string is not case sensitive.

    For a detailed description read:
      http://en.wikipedia.org/wiki/Gibit
      http://en.wikipedia.org/wiki/Gbit

-o --output Bytes | bits (default is Bytes)
    Specify the output unit. The default is Bytes/s
    For a detailed description read:
      http://en.wikipedia.org/wiki/Bit
      http://en.wikipedia.org/wiki/Bytes

-w --warning INTEGER
    % of bandwidth usage necessary to result in warning status.
    Default: 85%

-c --critical INTEGER
    % of bandwidth usage necessary to result in critical status.
    Default: 98%

-M --max INTEGER
    Max Counter Value of net devices in kilo/mega/giga/bytes.

-d --directory STRING
    Directory for temporary and history files.

-x --history
    Writing history in temporary file - for debugging purposes.

-v --version
    Print version information.

The latest and greatest version of check_iftraffic can be found on:
http://www.linuxhacker.at

License

Copyright (C) 2004 Gerd Mueller / Netways GmbH
Copyright (C) 2006,2007,2009,2011 Herbert Straub <herbert@linuxhacker.at>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307
Authors:Herbert Straub Gerd Mueller Markus Werner Adrian Wieczorek
Version:2.1 2011-01-22
Document Actions