• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1059
  • Last Modified:

SNMP / SNMPD - Manually assign key to interface

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
wpatterson82
Asked:
wpatterson82
  • 2
  • 2
  • 2
  • +1
1 Solution
 
Hugh FraserConsultantCommented:
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
 
wpatterson82Author Commented:
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
 
AbhisekSanyalCommented:
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
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

 
wpatterson82Author Commented:
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
 
AbhisekSanyalCommented:
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
 
Hugh FraserConsultantCommented:
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
 
group0Commented:
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now