2

I have an SNMP monitoring box and want to monitor interface utilisation on a clustered database server. I'm trying to work out the correct OID to monitor - I just need SNMP to return the total interface throughput at a given time.

The SNMP box is already configured and will correctly graph it. All howtos I can find talk about setting up Catci or MRTG which is all well and good, but what I need seems simpler, yet I can't seem to find what I'm looking for. The SNMP box is already configured with the correct community name etc so this should be a really easy one in theory.

Any help very gratefully received

Thanks

btongeorge
  • 421
  • 2
  • 12
  • 23

3 Answers3

3

When you say "interface utilisation", I assume you mean Ethernet interface utilization. If that assumption is correct, there are a couple OIDs to investigate:

  • 1.3.6.1.2.1.2.2.1.10 - ifInOctets returns the total number of octets received on the interface, including framing characters.
  • 1.3.6.1.2.1.2.2.1.16 - ifOutOctets returns the total number of octets transmitted out of the interface, including framing characters.
  • 1.3.6.1.2.1.31.1.1.1.6 - ifHCInOctets returns the total number of octets received on the interface, including framing characters (this is the 64-bit version of ifInOctets).
  • 1.3.6.1.2.1.31.1.1.1.10 - ifHCInOctets returns the total number of octets transmitted out of the interface, including framing characters (this is the 64-bit version of ifOutOctets).

Each OID is part of a table and will have an associated index that links it to an interface description (e.g., eth0 or br1).

These OIDs provide a count of octets received and transmitted so they require a little massaging to get into the utilization rates you desire. In the past when I've monitored these OIDs I've queried for two values a few seconds apart and then calculated the rate.

(QueryResult2 - QueryResult1) / (SecondsElapsed)

I would guess that Cacti (which I assume you're using since you tagged your question with it) has some way to calculate rates from SNMP values, however, I've never used it so I am not positive.

One other important note is that the default snmpd.conf included with CentOS may not have these OIDs enabled. If you run snmpwalk on 1.3.6.1.2.1.2 and 1.3.6.1.2.1.31 and receive empty results, edit /etc/snmpd.conf to configure the SNMP daemon to respond to those OIDs. I can't remember the exact syntax but I think adding a line like,

view   all   included   .1

will enable all available OIDs on the server.

lostriebo
  • 1,483
  • 1
  • 16
  • 25
  • Thanks for that comment, you're right I do mean Ethernet interface utilisation. I ran snmpwalk and got the following output: `[root@node1 ~]# snmpwalk -v 1 -c public localhost ifSpeed IF-MIB::ifSpeed.1 = Gauge32: 10000000 IF-MIB::ifSpeed.2 = Gauge32: 10000000 IF-MIB::ifSpeed.3 = Gauge32: 1000000000 IF-MIB::ifSpeed.4 = Gauge32: 1000000000 IF-MIB::ifSpeed.5 = Gauge32: 1000000000 IF-MIB::ifSpeed.6 = Gauge32: 10000000 IF-MIB::ifSpeed.7 = Gauge32: 0 ` – btongeorge Jul 25 '12 at 15:57
  • Sorry meant to say, that looks to be giving me the link speed (i.e. 10mbps/100mbps/gig etc) rather than interface utilisation? – btongeorge Jul 25 '12 at 15:59
  • @btongeorge You're right! I didn't have a box handy to test the OIDs to verify that I was giving you correct information. Sorry to lead you down the wrong path. – lostriebo Jul 25 '12 at 16:15
  • @btongeorge I've revised my answer to something that I've actually used in the past with success. I hope it helps! – lostriebo Jul 25 '12 at 16:29
  • no problem at all, thanks for the additional info. I was hoping for an SNMP OID that would do the massaging for me, but will see what I can do with octets in and out. – btongeorge Jul 25 '12 at 16:39
0

here is my small script for that : enter link description here result : Interface bandwidth usage: In: 22837768 bps, Out: 5202640 bps

You
  • 19
  • 3
-2

http://namhuy.net/908/how-to-install-iftop-bandwidth-monitoring-tool-in-rhel-centos-fedora.html

Requirements: libpcap: module provides a user-level network packet capture information and statistics. libncurses: is a API programming library that enables programmers to provide text-based interfaces in a terminal. gcc: GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project supporting various programming languages.

Install libpcap, libnurses, gcc via yum

yum -y install libpcap libpcap-devel ncurses ncurses-devel gcc

Download and Install iftop

wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
./configure
make
make install
  • Why did this get down voted? Looks to solve my problem without having to do maths on the resulting SNMP queries. – btongeorge Oct 28 '15 at 15:24