Retrieve Hardware Informations through SNMP

2019-05-23 12:06发布

问题:

I am trying to retrieve hardware informations from a series of devices, so far I used snmpget/snmpwalk with the following OID 1.3.6.1.2.1.25.3.2.1 but it returns very few informations, for example if I run this on my computer from a Windows OS I get those CPUs:

Unknown Processor

Unknown Processor

Unknown Processor

Unknown Processor

Instead if I run the command from Debian I get the correct value:

Genuine Intel: Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz

Guessing that there's a floating point co-processor

I understand that Windows and Linux fill MIBs in a completely different way but, for istance, bot of them seem to completely forget about other devices such as video card or mouse/keyboard. Windows shows the keyboard correctly, Linux does not. Both of them don't show video card and sound card at all. Is the problem related to some options I have to set?

And what if I want to obtain MORE informations such as CPU frequency?

回答1:

The HOST-RESOURCES-MIB, which is where the above OID lies, will in deed describe a fair amount about the hardware on the system. But:

  1. the system would indeed need to support it. You've shown that the windows SNMP agent clearly doesn't list the right things and is functionally broken.
  2. Not every component in the system is listed there even on linux, because either the MIB shouldn't be listing those types of components or the code wasn't written to make it work.

For the linux case, you could always go work on the code and submit patches back to the original package (which for linux is certainly the Net-SNMP package).

There is also the ENTITY-MIB which is designed to model a system's hardware better, but I don't know of linux (or windows) support for it.

Finally, you could always run a different SNMP agent on the windows machine if it's not returning the right result. IE, I have heard (but don't use windows myself) that the Net-SNMP agent provides superior functionality on windows compared to the native SNMP agent.