I'm trying to build a webpage that will pull out server information using snmpget and snmpwalkoid, among other things.
Most of the things I poll are fairly static, so in that regards I simply snmpwalkoid('server', 'community', 'oid') and then create another array that has my info to spit out like "System Name:" etc etc.
I then use array_combine($my_array, $theOIDArray) and run through them spitting out the keys & values.
But, with other things, like processors and hard drives, the snmpwalkoid may return multiple items - and in that case my array_combine won't work since it will just break.
I'm a total PHP newbie here, and I'm not sure the best way to approach this. I'd like to use the snmpwalkoid array VALUES with my own KEYS, then spit it out to the web. Here's what the array from snmpwalkoid() will look like, the exact OID is the key, the return is the value.
CPQIDA-MIB::cpqDaPhyDrvModel.0.128: "COMPAQ BD07286224 "
CPQIDA-MIB::cpqDaPhyDrvModel.0.129: "COMPAQ BD07286224 "
Now how can I combine that with:
$arrCpqDaPhyDrvIndex = array( 1 => 'Controller Index:', 'Drive Index:', 'Drive Model:', 'Firmware Revision:', 'Drive Bay Location:', 'Drive Status:', 'Spare Sectors:');
So I can get output that will look like this:
Drive A Controller Index: 0
Drive A Drive Index: 128
Drive A Drive Model: "COMPAQ BD07286224"
Drive A Firmware Revision: "HPB6"
Drive A Drive Bay Location: 0
Drive A Drive Status: ok
Drive A Spare Sectors: -1
Drive B Controller Index: 0
Drive B Drive Indes: 129
etc, etc, etc.
I'm assuming I might have to do something with the drive index number.. .But like I said, I'm very new to this all can't figure out how to combine the 2 pieces of info I need. Once I figure this out, I'll be able to play with the data more and smooth it to the way I'd like to. Any help would be wonderful - thanks!
Building dynamic arrays with snmpwalkoid() info
No replies to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users