WinCC SNMP OCX
Ich hatte das selbe Problem und zwar wollte ich eine USV von APC auslesen.
Habe für das auslesen der SNMP Register ein OCX verwendet.
http://dsoft.php5.cz/
Das auslesen habe ich mittels Globale Script gelöst. Einfach ein paar Interne Variablen anlegen.
Das OCX ist kostenlos.
Hier ein kleines Beispiel für VBS
--------------------------------------------------------------------
Dim sType, sValue, sSnmp
On Error Resume Next
Set sSnmp = CreateObject("dssSnmp.sSnmp")
sSnmp.RemoteIP = "127.0.0.1"
sSnmp.Port = 161
sSnmp.Community = "public"
sSnmp.ReqID = 1
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" ' "The UPS model name (e.g. 'APC Smart-UPS 600')."
sSnmp.SnmpGet
HMIRuntime.Tags("upsBasicIdentModel").Write sSnmp.Value
sSnmp.ReqID = 2
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.1.1.2.0" ' "An 8 byte ID string identifying the UPS. This object can be set by the administrator."
sSnmp.SnmpGet
HMIRuntime.Tags("upsBasicIdentName").Write sSnmp.Value
sSnmp.ReqID = 3
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.1.2.1.0" ' "The firmware revision of the UPS system's microprocessor."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvIdentFirmwareRevision").Write sSnmp.Value
sSnmp.ReqID = 4
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.1.2.2.0" ' "The date when the UPS was manufactured in mm/dd/yy (or yyyy) format."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvIdentDateOfManufacture").Write sSnmp.Value
sSnmp.ReqID = 5
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.1.2.3.0" ' "An 8-character string identifying the serial number of the UPS internal microprocessor. This number is set at the factory. NOTE: This number does Not correspond To the serial number On the rear of the UPS."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvIdentSerialNumber").Write sSnmp.Value
sSnmp.ReqID = 6
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.1.1.0" ' "The status of the UPS batteries. A batteryLow(3) value indicates the UPS will be unable to sustain the current load, And its services will be lost If power Is not restored. The amount of run time in reserve at the time of low battery can be configured by the upsAdvConfigLowBatteryRunTime."
sSnmp.SnmpGet
HMIRuntime.Tags("upsBasicBatteryStatus").Write sSnmp.Value
sSnmp.ReqID = 7
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.1.2.0" ' "The elapsed time since the UPS has switched to battery power."
sSnmp.SnmpGet
HMIRuntime.Tags("upsBasicBatteryTimeOnBattery").Write sSnmp.Value
sSnmp.ReqID = 8
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.1.3.0" ' "The date when the UPS system's batteries were last replaced in mm/dd/yy (or yyyy) format. For Smart-UPS models, this value is originally set in the factory. When the UPS batteries are replaced, this value should be reset by the administrator."
sSnmp.SnmpGet
HMIRuntime.Tags("upsBasicBatteryLastReplaceDate").Write sSnmp.Value
sSnmp.ReqID = 9
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.1.0" ' "The remaining battery capacity expressed in percent of full capacity."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryCapacity").Write sSnmp.Value
sSnmp.ReqID = 10
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.2.0" ' "The current internal UPS temperature expressed in Celsius."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryTemperature").Write sSnmp.Value
sSnmp.ReqID = 11
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.3.0" ' "The UPS battery run time remaining before battery exhaustion."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryRunTimeRemaining").Write sSnmp.Value
sSnmp.ReqID = 12
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.4.0" ' "Indicates whether the UPS batteries need replacing."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryReplaceIndicator").Write sSnmp.Value
'------
sSnmp.ReqID = 13
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.7.0" ' "The nominal battery voltage in Volts."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryNominalVoltage").Write sSnmp.Value
sSnmp.ReqID = 14
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.8.0" ' "The actual battery bus voltage in Volts."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryActualVoltage").Write sSnmp.Value
sSnmp.ReqID = 15
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.9.0" ' "The battery current in Amps."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryCurrent").Write sSnmp.Value
sSnmp.ReqID = 16
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.10.0" ' "The total DC current in Amps."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvTotalDCCurrent").Write sSnmp.Value
sSnmp.ReqID = 17
sSnmp.OID = ".1.3.6.1.4.1.318.1.1.1.2.2.11.0" ' "The full chargeable capacity of the battery which is expressed in percentage."
sSnmp.SnmpGet
HMIRuntime.Tags("upsAdvBatteryFullCapacity").Write sSnmp.Value