| Hi Nils,
>I'm working in a project where I'm writing a eSNMP subagent.
Is there a specific version of Digital UNIX your subagent will
be delivered on?
>In the code I need to get information from the ifTable,
>specifically I need to get the indices in the Table for certain
>interfaces for which I only have the names (ifName).
How do you acquire the interface names?
Which MIB are you implementing?
>I've heard that there is some code from Carnegie Mellon Univ. which
>would provide me with some kind of snmp_get and get_next functionality.....
>Where could I get it from?
We (Digital UNIX network engineering) maintain an SNMP library
for internal use. I'll post a separate note here (and other spots)
with a pointer to it. You could use that to send SNMP get/get_next/get_bulk
messages, read the responses, and fish out what you need. (I know of at least
one other group doing that.)
WARNING: You can't send an SNMP PDU to the local system from within an
eSNMP method routine, as this could deadlock the master agent (until it times
out your request).
Regards,
Mike
|
| Mike,
thanks for your reply. Some answers:
> Is there a specific version of Digital UNIX your subagent will
> be delivered on?
Yes. It'll run on V4.0
> How do you acquire the interface names?
They are in a config-file.
> Which MIB are you implementing?
It's for a TMU (a multiplexer) for videoservers. (1.3.6.1.4.1.36.2.15.18.7.1)
> WARNING: You can't send an SNMP PDU to the local system from within an
> eSNMP method routine, as this could deadlock the master agent (until it times
> out your request).
I guess it's OK to do it when the subagent initializes itself?
regards,
Nils
|
|
An idea I have:
Use the Host Resources MIB, specifically the hrDeviceDescr in the
hrDeviceTable. The hrDeviceDescr has the names, if network devices.
When the correct device is found, I have the hrDeviceIndex.
Using this index in the hrNetworkTable I can get hrNetworkIfIndex
which is the ifIndex I'm looking for.
Right?
This method seams to be quite tedious. Is there a simpler way?
/Nils
|
| Nils,
There are several potential issues here.
1) ifName is not in MIB II (RFC 1213), it's in the later versions
of ifMib. We only support MIB II currently.
2) Interface "naming" isn't standardized. There is no guarantee
that, for instance, netstat and SNMP will use the same textual string to
refer to a particular interface (although I'll try to assure
that happens when implementing ifName, and have tried to at least
include the netstat name in hrDeviceDescr for interfaces).
So some care is needed if you get interface "names" from a config
file (I'm assuming you mean names like "tu0" and "ln1", etc.)
and will try to match them up.
3) Currently ifDescr does not reflect the unit number, but as you've pointed
out, hrDeviceDescr does.
So yes, you could use SNMP GetNext requests to read hrNetWorkIfIndex.
You'll get back a value that is the interface's ifIndex. The instance
of the variable you get back is the device's hrDeviceIndex, which you can
use to read hrDeviceDescr, and compare the interface name.
For instance, using snmp_request:
snmp_request getnext 1.3.6.1.2.1.25.3.4.1.1 (this is hrNetWorkIfIndex)
1.3.6.1.2.1.25.3.4.1.1.2 = 1 (the device whose hrDeviceIndex = 2
is the interface whose ifIndex is 1)
snmp_request get 1.3.6.1.2.1.25.3.2.1.3.2 (retrieve this device's hrDeviceDescr)
1.3.6.1.2.1.25.3.2.1.3.2 = tu0 - DEC TULIP Ethernet Interface
(compare "tu0" against your config file)
snmp_request getnext 1.3.6.1.2.1.25.3.4.1.1.2 (get the next value of
hrNetWorkIfIndex...)
4) If you can wait for the Steel release, I'm hoping to be able to update
our implementation of interfaces to at least RFC 1573 or the current
ifmib draft. In which case, you'd have ifName and could simply getnext
(or getbulk! :-) thru them, you'd have the name and ifIndex returned
directly.
5) You could ioctl() for the interface info yourself if what you need
is more "raw data" and not hooked into SNMP indexes, etc.
6) You can issue SNMP requests from your subagent anywhere but from within
a method. A common idea to handle dynamic data is to set up a timer/poll
mechanism to refresh the data. If the data you need is static (e.g.,
ifSpeed) then sure, during initialization would be fine.
Hope this helps. It will be easier for me to continue the discussion
by mail ([email protected]).
Regards,
Mike
|