Solved

SNMP / SNMPD - Manually assign key to interface

Posted on 2010-11-22
7
962 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
ID: 34198869
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
ID: 34199197
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
ID: 34199563
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 2

Author Comment

by:wpatterson82
ID: 34199887
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
ID: 34200425
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
ID: 34202336
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
ID: 34219655
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

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
How to set-up an On Demand, IPSec, Site to SIte, VPN from a Draytek Vigor Router to a Cyberoam UTM Appliance. A concise guide to the settings required on both devices
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

943 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

10 Experts available now in Live!

Get 1:1 Help Now