Solved

SNMP / SNMPD - Manually assign key to interface

Posted on 2010-11-22
7
945 Views
Last Modified: 2013-12-16
Hello everyone,

I have an annoying issue that I'm trying to solve. I monitor the total bandwidth usage via zabbix for two gateways on our network. For this to work properly, BOTH snmpd daemons MUST list the eth0 interfaces as 'IfInOctets2' and 'IfOutOctets2' .. now they don't have to use Octets2, but both servers must both use the same for my graphs to work properly.

For some odd reason, one of my gatway boxes changes this value after a reboot ocassionally. I have no idea why or how to force snmp to always use 'Octets2' for eth0.

Any ideas?

I have googled, and can't find any settings to add to snmpd.conf or actually any issues even close to being related to my problem.

Thank you for your help!
Bill
0
Comment
Question by:wpatterson82
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 12

Expert Comment

by:hfraser
Comment Utility
Is it possible that the gateway's switching interface labeling when rebooting? I've had this happen before; the first interface detected is assigne to eth0, the second to eth1. To guarantee the association stays constant, I needed to include the MAC address in the appropriate network configuration files (like ifcfg.eth0 and ifcfg.eth1).

I'd expect this would cause you some routing issues as well, but it's worth a check.
0
 
LVL 2

Author Comment

by:wpatterson82
Comment Utility
Thanks for the reply but nope :( .. all of the interfaces are as they should be .. for some reason snmpd moved my eth0 interface to Octets5 .. instead of the Octets2 which I need to be on.

0
 
LVL 4

Expert Comment

by:AbhisekSanyal
Comment Utility
Hi,
   You can use a tool called "ifrename". You did not say what is running on your gateway, I hope this tool is supported on your gateway (Try compiling from the source)
The following entry in the configuration file /etc/iftab will ensure that the interface with the following mac address always becomes eth0

eth0 mac 00:1B:24:41:AD:41

The tool "ifrename" has to be run before your networking is up. Calling "ifrename -p" should do.

There is a nice writeup here
http://www.enterprisenetworkingplanet.com/netos/article.php/3586546/Nail-Down-Network-Interface-Names-with-ifrename.htm

You should be very careful when testing this tool, you don't want to loose network access to your gateway and get into trouble. Have a console open to test this.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 2

Author Comment

by:wpatterson82
Comment Utility
Thanks for your reply AbhisekSanyal, however that's not the problem. The interfaces always come up as they should .. for example, eth0 is always the correct device.

The issue is that snmpd has switched from listing stats on eth0 as Octets2, to Octets5.

So when I'm monitoring my gateway via SNMP, I have everything set to graph eth0 on Octets2 .. I can't figure out why SNMPD has moved eth0 to Octets5.

It's not an issue with my interfaces, it's how SNMPD is reporting the data/counters for the interfaces.
0
 
LVL 4

Expert Comment

by:AbhisekSanyal
Comment Utility
Hi,
  So, now the interface index is always Octets5 in that gateway device ? Irrespective of the number of times you reboot the server or restart the snmp service ?
  What are the other network interfaces present on the system ?
  I found a somewhat similar problem in this bug report - https://bugzilla.redhat.com/show_bug.cgi?id=484990

  Basically, Xen setup was changing the interface id as seen by snmp daemon. Perhaps there is some service running on the gateway which has now changed the sequence as seen by the snmp daemon.
0
 
LVL 12

Expert Comment

by:hfraser
Comment Utility
Could you do an snmpwalk when the indices are correct, and when they're incorrect. The important mibs are:

IF-MIB::ifNumber.0 = INTEGER: 3
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: wlan0

This is the output from my laptop, and I'd like to see what your gateway returns to be sure the ordering of the interfaces changes.
0
 
LVL 5

Accepted Solution

by:
group0 earned 500 total points
Comment Utility
This is not an snmpd issue, the ifIndex is assigned by the kernel in the order that the device registers.  The following link shows where in the linux and Net-SNMP code this occurs:

http://efreedom.com/Question/2-167520/Linux-IfIndex-Persistence-SNMP

You might be able to fix this with adjusting udev rules, but this still wouldn't fix cases where you drop the interface, remove the module, and re-run modprobe.  The only reliable way to get the right data is to use dynamic indexes:

http://www.zabbix.com/documentation/1.8/manual/advanced_snmp/dynamic_indexes
0

Featured Post

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Join & Write a Comment

So, you're experiencing issues on your network and you've decided that you need to perform some tests to determine whether your cabling is good.  You're likely thinking that you may need to spend money which you probably don't have on hiring/purchas…
Quality of Service (QoS) options are nearly endless when it comes to networks today. This article is merely one example of how it can be handled in a hub-n-spoke design using a 3-tier configuration.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now