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_snmp_traffic

Rating
2 votes
Favoured:
0
Current Version
0.2
Last Release Date
2010-01-18
Compatible With
  • Nagios 2.x
Hits
111369
Files:
FileDescription
check_snmp_trafficcheck_snmp_traffic
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 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 "
%./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)
bynishith, September 19, 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.
byn4th4nr1ch, February 25, 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.