Solved

SNMP / SNMPD - Manually assign key to interface

Posted on 2010-11-22
7
1,006 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Switch port problems 15 57
Fuzzy search functionality DB2 UDB 3 63
Management of Huawei B315 2 69
Enable SPF on IMSVA 6 66
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
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

734 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