I also have a strong suspicion this webmail will be sending this HTML
formatted, so I apologize in advance. Anyway, here it goes!
Greetings All!
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::cpqDaPhyDrvCntlrIndex.0.128: 0
CPQIDA-MIB::cpqDaPhyDrvCntlrIndex.0.129: 0
CPQIDA-MIB::cpqDaPhyDrvIndex.0.128: 128
CPQIDA-MIB::cpqDaPhyDrvIndex.0.129: 129
CPQIDA-MIB::cpqDaPhyDrvModel.0.128: "COMPAQ BD07286224 "
CPQIDA-MIB::cpqDaPhyDrvModel.0.129: "COMPAQ BD07286224 "
CPQIDA-MIB::cpqDaPhyDrvFWRev.0.128: "HPB6"
CPQIDA-MIB::cpqDaPhyDrvFWRev.0.129: "HPB6"
CPQIDA-MIB::cpqDaPhyDrvBay.0.128: 0
CPQIDA-MIB::cpqDaPhyDrvBay.0.129: 1
CPQIDA-MIB::cpqDaPhyDrvStatus.0.128: ok
CPQIDA-MIB::cpqDaPhyDrvStatus.0.129: ok
CPQIDA-MIB::cpqDaPhyDrvFactReallocs.0.128: -1
CPQIDA-MIB::cpqDaPhyDrvFactReallocs.0.129: -1
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!
Jeremy