Network Connections, Stats and Bandwidth

check_snmp_traffic

Description:

Check traffic usage of an interface

Usage: ./check_snmp_traffic

# ./check_snmp_traffic localhost private 1 “>1” “>2”
WARNING if iface # 1 trafic > 1 Mbit/s, CRITICAL if trafic > 2 Mbit/s

# ./check_snmp_traffic localhost private 10 “<11" "<5"
WARNING if iface # 10 has trafic < 11 Mbit/s, CRITICAL if trafic < 5 Mbit/s

Current Version

0.2

Last Release Date

2010-01-18

Compatible With

  • Nagios 2.x

Owner


Project Files
Project Notes
%./check_snmp_traffic Check traffic usage of an interface Version 0.2, Copyright (c) 2010 by Luc Duchosal Last Modified: 2010-01-18 -------------------------------------------------- Usage: ./check_snmp_traffic -------------------------------------------------- Hostname or IP Address the snmp community string Interface number, use snmpwalk to find yours: snmpwalk -v2c -c community host 1.3.6.1.2.1.31.1.1.1.1 IF-MIB::ifName.1 = STRING: Fa0 This -^- is the interface-number warning if bc expression return 1 critical if bc expression return 1 Exxamples : # ./check_snmp_traffic localhost private 1 " > 1 " " > 2 " WARNING if iface # 1 trafic > 1 Mbit/s, CRITICAL if trafic > 2 Mbits/ # ./check_snmp_traffic localhost private 10 " < 11 " " < 5 " WARNING if iface # 10 has trafic < 11 Mbit/s, CRITICAL if trafic < 5 Mbits/
Reviews (2) Add a Review
Need customization
by nishith, September 30, 2017

[root@support libexec]$ ./check_snmp_traffic 172.16.1.8 public 1 ">200" ">400" Traffic OK - .01 Mb/s in Sum|traffic=.01;>200;>400;0; In=.01;;;0; Out=0;;;0; OUTPUT IS:- IF-MIB::ifName.1 = STRING: Vl1 IF-MIB::ifName.5049 = STRING: Lo0 IF-MIB::ifName.10101 = STRING: Gi0/1 IF-MIB::ifName.10102 = STRING: Gi0/2 IF-MIB::ifName.10103 = STRING: Gi0/3 IF-MIB::ifName.10104 = STRING: Gi0/4 IF-MIB::ifName.10105 = STRING: Gi0/5 IF-MIB::ifName.10106 = STRING: Gi0/6 IF-MIB::ifName.10107 = STRING: Gi0/7 IF-MIB::ifName.10108 = STRING: Gi0/8 IF-MIB::ifName.10109 = STRING: Gi0/9 IF-MIB::ifName.10110 = STRING: Gi0/10 IF-MIB::ifName.10111 = STRING: Gi0/11 IF-MIB::ifName.10112 = STRING: Gi0/12 IF-MIB::ifName.10113 = STRING: Gi0/13 IF-MIB::ifName.10114 = STRING: Gi0/14 IF-MIB::ifName.10115 = STRING: Gi0/15 IF-MIB::ifName.10116 = STRING: Gi0/16 IF-MIB::ifName.10117 = STRING: Gi0/17 IF-MIB::ifName.10118 = STRING: Gi0/18 IF-MIB::ifName.10119 = STRING: Gi0/19 IF-MIB::ifName.10120 = STRING: Gi0/20 IF-MIB::ifName.10121 = STRING: Gi0/21 IF-MIB::ifName.10122 = STRING: Gi0/22 IF-MIB::ifName.10123 = STRING: Gi0/23 IF-MIB::ifName.10124 = STRING: Gi0/24 IF-MIB::ifName.10125 = STRING: Gi0/25 IF-MIB::ifName.10126 = STRING: Gi0/26 IF-MIB::ifName.10127 = STRING: Gi0/27 IF-MIB::ifName.10128 = STRING: Gi0/28 But, monitoring Gi0/24 interface gives below error. [root@support libexec]$ ./check_snmp_traffic 172.16.1.8 public 24 ">200" ">400" ./check_snmp_traffic: line 93: [: Such: integer expression expected ./check_snmp_traffic: line 96: [: Such: integer expression expected ./check_snmp_traffic: line 105: [: Such: integer expression expected ./check_snmp_traffic: line 108: [: Such: integer expression expected (standard_in) 1: illegal character: S (standard_in) 1: syntax error ./check_snmp_traffic: line 151: [: -eq: unary operator expected ./check_snmp_traffic: line 154: [: -eq: unary operator expected ./check_snmp_traffic: line 157: [: too many arguments Traffic UNKNOWN - Mb/s in Sum|traffic=;>200;>400;0; In=;;;0; Out=;;;0; I need a common plugin thru which I can monitor all SNMP enabled network devices graph i.e. CIsoc, Fortigate, Juniper, Windows & Linux OSes.



Inaccurate
by n4th4nr1ch, February 28, 2011

You are basing your math from the sleep timer. However you're forgetting that the snmpget can take longer than 0 seconds, which means that when the second trafbyteOut check runs, it has not been 0 seconds since the sleep of 1 second. What you'll want to do is get the current times and compare the two.



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
3 (2)
Favorites
0
Views
111,240