@@ -52,6 +52,11 @@ def pduCntrlOid(self):
52
52
APC_RPDU_PORT_NAME_BASE_OID = "1.3.6.1.4.1.318.1.1.12.3.3.1.1.2"
53
53
APC_RPDU_PORT_STATUS_BASE_OID = "1.3.6.1.4.1.318.1.1.12.3.5.1.1.4"
54
54
APC_RPDU_PORT_CONTROL_BASE_OID = "1.3.6.1.4.1.318.1.1.12.3.3.1.1.4"
55
+ # MIB OID for 'Raritan PDU'
56
+ RARITAN_PORT_NAME_BASE_OID = "1.3.6.1.4.1.13742.6.3.5.3.1.3"
57
+ RARITAN_PORT_STATUS_BASE_OID = "1.3.6.1.4.1.13742.6.4.1.2.1.3"
58
+ RARITAN_PORT_CONTROL_BASE_OID = "1.3.6.1.4.1.13742.6.4.1.2.1.2"
59
+ RARITAN_PORT_POWER_BASE_OID = "1.3.6.1.4.1.13742.6.5.4.3.1.4"
55
60
self .STATUS_ON = "1"
56
61
self .STATUS_OFF = "0"
57
62
self .CONTROL_ON = "1"
@@ -95,6 +100,16 @@ def pduCntrlOid(self):
95
100
self .PORT_CONTROL_BASE_OID = APC_RPDU_PORT_CONTROL_BASE_OID
96
101
self .has_lanes = False
97
102
self .max_lanes = 1
103
+ elif self .pduType == "Raritan" :
104
+ self .PORT_NAME_BASE_OID = RARITAN_PORT_NAME_BASE_OID
105
+ self .PORT_STATUS_BASE_OID = RARITAN_PORT_STATUS_BASE_OID
106
+ self .PORT_CONTROL_BASE_OID = RARITAN_PORT_CONTROL_BASE_OID
107
+ self .PORT_POWER_BASE_OID = RARITAN_PORT_POWER_BASE_OID
108
+ self .STATUS_ON = "7"
109
+ self .STATUS_OFF = "8"
110
+ self .CONTROL_OFF = "0"
111
+ self .has_lanes = False
112
+ self .max_lanes = 1
98
113
else :
99
114
pass
100
115
@@ -221,7 +236,14 @@ def _get_one_outlet_power(self, cmdGen, snmp_auth, port_id, status):
221
236
if not self .PORT_POWER_BASE_OID :
222
237
return
223
238
239
+ # For PDU "Raritan", the SNMP MIB OID of power define as below:
240
+ # measurementsOutletSensorValue - .1.3.6.1.4.1.13742.6.5.4.3.1.4.a.b.c
241
+ # a = pduID (almost always "1" unless you are linking the PDUs)
242
+ # b = outletId (the number of the outlet on the PDU)
243
+ # c = sensorID (1=amps, 4=volts, 5=watts)
224
244
query_id = '.' + self .PORT_POWER_BASE_OID + port_id
245
+ if self .pduType == "Raritan" :
246
+ query_id = query_id + ".5" # 5 = watts for Raritan PDU
225
247
errorIndication , errorStatus , errorIndex , varBinds = cmdGen .getCmd (
226
248
snmp_auth ,
227
249
cmdgen .UdpTransportTarget ((self .controller , 161 )),
@@ -235,6 +257,8 @@ def _get_one_outlet_power(self, cmdGen, snmp_auth, port_id, status):
235
257
current_oid = str (oid )
236
258
current_val = str (val )
237
259
port_oid = current_oid .replace (self .PORT_POWER_BASE_OID , '' )
260
+ if self .pduType == "Raritan" :
261
+ port_oid = port_oid .rsplit ('.' , 1 )[0 ] # Remove the ".5" suffix
238
262
if port_oid == port_id :
239
263
if current_val != "" :
240
264
status ['output_watts' ] = current_val
0 commit comments