Difference between revisions of "MFD:IF-MIB"
(→MFD: IF-MIB) |
|||
Line 2: | Line 2: | ||
== MFD: IF-MIB == | == MFD: IF-MIB == | ||
− | 'NOTE: this tutorial is based on the code for the upcoming release | + | '''NOTE: this tutorial is based on the code for the upcoming release |
5.2 (currently in the main CVS line). If you generate code from a | 5.2 (currently in the main CVS line). If you generate code from a | ||
release prior to 5.2, your results may vary.''' | release prior to 5.2, your results may vary.''' |
Revision as of 17:56, 13 July 2011
MFD Tutorial | |
|
MFD: IF-MIB
NOTE: this tutorial is based on the code for the upcoming release 5.2 (currently in the main CVS line). If you generate code from a release prior to 5.2, your results may vary.
This tutorial documents the process of implementing the
IF-MIB MIB module for Linux. We'll start with the
ifTable, and then do the ifXTable.
Introduction
The data for both of these tables comes from the kernel. This means that we have to explicity ask for the data, the data may not be in the format we would like it to be in, and all the data we want may not be available. It also means that we will not be notified when the data changes.
We cannot really do anything about the format of the data that we get from the kernel. The ifXTable presenta an additional twist, in that it contains 64 bit counters for statistics, and the statistics available for the Linux 2.4 kernels are only 32 bits. So we'll cache data and do periodic polls to maintaine these values.
As is often the case with external data, the interfaces data we get from the kernel is not sorted by the index specified by the MIB. The kernel reports data by interface names ('eth0', 'lo', etc), and the IF-MIB tables specifies an integer, ifIndex, as the table index.