Bonjour,
je supervise une centaine de serveurs HP proliant chez un client.
De temps à autre un disque lâche, j'aimerai être averti sans avoir à parcourir les machines en salle.
J'ai identifié l'OID à intérroger en SNMP et j'aimerai le faire via vbscript par WMI.
Quelqu'un peut-il me dire comment modifier ce script VBscript de façon à interroger la valeur de l'OID suivante :
.1.3.6.1.4.1.232.3.2.2.1.1.6 (correspondant à iso.org.dod.internet.private.enterprises.compaq.cpqDriveArray.cpqDaComponent.cpqaCntlr.cpqDaCntlrTable.cpqDaCntlrEntry.cpqDaCntlrCondition
en clair) ?
Mon script de départ est :
--------------------------------------------------
strTargetSnmpDevice = "192.168.1.20"
Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("", "root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
objWmiNamedValueSet.Add "AgentAddress", strTargetSnmpDevice
objWmiNamedValueSet.Add "AgentReadCommunityName", "public"
Set colIfTable = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_ifTable", , _
objWmiNamedValueSet)
For Each objInterface In colIfTable
WScript.Echo "ifIndex [Key]: " & objInterface.ifIndex & vbCrLf & _
" ifAdminStatus: " & objInterface.ifAdminStatus & vbCrLf & _
" ifDescr: " & objInterface.ifDescr & vbCrLf & _
" ifInDiscards: " & objInterface.ifInDiscards & vbCrLf & _
" ifInErrors: " & objInterface.ifInErrors & vbCrLf & _
" ifInNUcastPkts: " & objInterface.ifInNUcastPkts & vbCrLf & _
" ifInOctets: " & objInterface.ifInOctets & vbCrLf & _
" ifInUcastPkts: " & objInterface.ifInUcastPkts & vbCrLf & _
" ifInUnknownProtos: " & objInterface.ifInUnknownProtos & vbCrLf & _
" ifLastChange: " & objInterface.ifLastChange & vbCrLf & _
" ifMtu: " & objInterface.ifMtu & vbCrLf & _
" ifOperStatus: " & objInterface.ifOperStatus & vbCrLf & _
" ifOutDiscards: " & objInterface.ifOutDiscards & vbCrLf & _
" ifOutErrors: " & objInterface.ifOutErrors & vbCrLf & _
" ifOutNUcastPkts: " & objInterface.ifOutNUcastPkts & vbCrLf & _
" ifOutOctets: " & objInterface.ifOutOctets & vbCrLf & _
" ifOutQLen: " & objInterface.ifOutQLen & vbCrLf & _
" ifOutUcastPkts: " & objInterface.ifOutUcastPkts & vbCrLf & _
" ifPhysAddress: " & objInterface.ifPhysAddress & vbCrLf & _
" ifSpecific: " & objInterface.ifSpecific & vbCrLf & _
" ifSpeed: " & objInterface.ifSpeed & vbCrLf & _
" ifType: " & objInterface.ifType & vbCrLf
Next
--------------------------------------------------
A mon avis c'est dans le passage en gras que je dois agir. Puis sur la suite poour interroger la bonne valeur.
Voici aussi l'ensemble des infos qui m'ont permis d'avancer sur le sujet:
1. MIBs à télécharger :
http://www.oidview.com/mibs/detail.html
2. Code VBS:
http://www.cruto.com/resources/vbscript/vbscript-examples/network/snmp/
3. Fonctionnement:
http://msdn2.microsoft.com/en-us/library/aa393632(VS.85).aspx
The mapping process generates CIM class names by concatenating "SNMP_", the MIB module identity name, "_", and the collection's object descriptor.
For example: system translates to SNMP_RFC1213_MIB_system, while ifTable translates to SNMP_RFC1213_MIB_ifTable.
In all cases, hyphens (-) in SNMP MIB identifiers map to underscores (_) in CIM class names.
Naming conflicts can occur due to CIM name case-insensitivity. If a naming conflict occurs, the provider chooses one of the conflicting group definitions and ignores the remaining definitions.
The identity name of the MIB module that contains the collection maps to the CIM class qualifier Module_Name.
The object identifier of the fabricated collection maps to the CIM class qualifier Group_Objectid.
The MIB module imports list (obtained from the MODULE-IDENTITY macro definition) maps to the CIM class qualifier module_imports. This qualifier contains a comma-separated list of module names.
-------------------------------------------------
Merci d'avance.
Le top serait que j'arrive à un script simple qui me permettre d'interroger un OID snmp de façon chiffrée.
Stéphane Merlo