1 /*  hpe-pdu-mib.c - subdriver to monitor HPE ePDU SNMP devices with NUT
2  *
3  *  Copyright (C)
4  *  2011 - 2016	Arnaud Quette <arnaud.quette@free.fr>
5  *  2019        Arnaud Quette <ArnaudQuette@eaton.com>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  */
23 
24 #include "hpe-pdu-mib.h"
25 #include "dstate.h"
26 
27 #define HPE_EPDU_MIB_VERSION      "0.31"
28 #define HPE_EPDU_MIB_SYSOID       ".1.3.6.1.4.1.232.165.7"
29 #define HPE_EPDU_OID_MODEL_NAME	".1.3.6.1.4.1.232.165.7.1.2.1.3.0"
30 
31 static info_lkp_t hpe_pdu_outlet_status_info[] = {
32 	{ 1, "off", NULL, NULL },
33 	{ 2, "on", NULL, NULL },
34 	{ 3, "pendingOff", NULL, NULL }, /* transitional status */
35 	{ 4, "pendingOn", NULL, NULL },  /* transitional status */
36 	{ 0, NULL, NULL, NULL }
37 };
38 
39 static info_lkp_t hpe_pdu_outletgroups_status_info[] = {
40 	{ 1, "N/A", NULL, NULL }, /* notApplicable, if group.type == outlet-section */
41 	{ 2, "on", NULL, NULL },  /* breakerOn */
42 	{ 3, "off", NULL, NULL }, /* breakerOff */
43 	{ 0, NULL, NULL, NULL }
44 };
45 
46 static info_lkp_t hpe_pdu_outlet_switchability_info[] = {
47 	{ 1, "yes", NULL, NULL },
48 	{ 2, "no", NULL, NULL },
49 	{ 0, NULL, NULL, NULL }
50 };
51 
52 /* The physical type of outlet */
53 static info_lkp_t hpe_pdu_outlet_type_info[] = {
54 	{ 0, "unknown", NULL, NULL },
55 	{ 1, "iecC13", NULL, NULL },
56 	{ 2, "iecC19", NULL, NULL },
57 	{ 10, "uk", NULL, NULL },
58 	{ 11, "french", NULL, NULL },
59 	{ 12, "schuko", NULL, NULL },
60 	{ 20, "nema515", NULL, NULL },
61 	{ 21, "nema51520", NULL, NULL },
62 	{ 22, "nema520", NULL, NULL },
63 	{ 23, "nemaL520", NULL, NULL },
64 	{ 24, "nemaL530", NULL, NULL },
65 	{ 25, "nema615", NULL, NULL },
66 	{ 26, "nema620", NULL, NULL },
67 	{ 27, "nemaL620", NULL, NULL },
68 	{ 28, "nemaL630", NULL, NULL },
69 	{ 29, "nemaL715", NULL, NULL },
70 	{ 30, "rf203p277", NULL, NULL },
71 	{ 0, NULL, NULL, NULL }
72 };
73 
74 static info_lkp_t hpe_pdu_ambient_presence_info[] = {
75 	{ -1, "unknown", NULL, NULL },
76 	{ 1, "no", NULL, NULL },  /* disconnected */
77 	{ 2, "yes", NULL, NULL }, /* connected */
78 	{ 0, NULL, NULL, NULL }
79 };
80 
81 static info_lkp_t hpe_pdu_threshold_status_info[] = {
82 	{ 1, "good", NULL, NULL },          /* No threshold triggered */
83 	{ 2, "warning-low", NULL, NULL },   /* Warning low threshold triggered */
84 	{ 3, "critical-low", NULL, NULL },  /* Critical low threshold triggered */
85 	{ 4, "warning-high", NULL, NULL },  /* Warning high threshold triggered */
86 	{ 5, "critical-high", NULL, NULL }, /* Critical high threshold triggered */
87 	{ 0, NULL, NULL, NULL }
88 };
89 
90 static info_lkp_t hpe_pdu_threshold_frequency_status_info[] = {
91 	{ 1, "good", NULL, NULL },          /* No threshold triggered */
92 	{ 2, "out-of-range", NULL, NULL },  /* Frequency out of range triggered */
93 	{ 0, NULL, NULL, NULL }
94 };
95 
96 static info_lkp_t hpe_pdu_ambient_drycontacts_info[] = {
97 	{ -1, "unknown", NULL, NULL },
98 	{ 0, "unknown", NULL, NULL },
99 	{ 1, "open", NULL, NULL },
100 	{ 2, "closed", NULL, NULL },
101 	{ 3, "bad", NULL, NULL }, /* FIXME: what to do with that? */
102 	{ 0, NULL, NULL, NULL }
103 };
104 
105 static info_lkp_t hpe_pdu_threshold_voltage_alarms_info[] = {
106 	{ 1, "", NULL, NULL },                       /* No threshold triggered */
107 	{ 2, "low voltage warning!", NULL, NULL },   /* Warning low threshold triggered */
108 	{ 3, "low voltage critical!", NULL, NULL },  /* Critical low threshold triggered */
109 	{ 4, "high voltage warning!", NULL, NULL },  /* Warning high threshold triggered */
110 	{ 5, "high voltage critical!", NULL, NULL }, /* Critical high threshold triggered */
111 	{ 0, NULL, NULL, NULL }
112 };
113 
114 static info_lkp_t hpe_pdu_threshold_current_alarms_info[] = {
115 	{ 1, "", NULL, NULL },                       /* No threshold triggered */
116 	{ 2, "low current warning!", NULL, NULL },   /* Warning low threshold triggered */
117 	{ 3, "low current critical!", NULL, NULL },  /* Critical low threshold triggered */
118 	{ 4, "high current warning!", NULL, NULL },  /* Warning high threshold triggered */
119 	{ 5, "high current critical!", NULL, NULL }, /* Critical high threshold triggered */
120 	{ 0, NULL, NULL, NULL }
121 };
122 
123 static info_lkp_t hpe_pdu_threshold_frequency_alarm_info[] = {
124 	{ 1, "", NULL, NULL },                         /* No threshold triggered */
125 	{ 2, "frequency out of range!", NULL, NULL },  /* Frequency out of range triggered */
126 	{ 0, NULL, NULL, NULL }
127 };
128 
129 static info_lkp_t hpe_pdu_threshold_temperature_alarms_info[] = {
130 	{ 1, "", NULL, NULL },                           /* No threshold triggered */
131 	{ 2, "low temperature warning!", NULL, NULL },   /* Warning low threshold triggered */
132 	{ 3, "low temperature critical!", NULL, NULL },  /* Critical low threshold triggered */
133 	{ 4, "high temperature warning!", NULL, NULL },  /* Warning high threshold triggered */
134 	{ 5, "high temperature critical!", NULL, NULL }, /* Critical high threshold triggered */
135 	{ 0, NULL, NULL, NULL }
136 };
137 
138 static info_lkp_t hpe_pdu_threshold_humidity_alarms_info[] = {
139 	{ 1, "", NULL, NULL },                        /* No threshold triggered */
140 	{ 2, "low humidity warning!", NULL, NULL },   /* Warning low threshold triggered */
141 	{ 3, "low humidity critical!", NULL, NULL },  /* Critical low threshold triggered */
142 	{ 4, "high humidity warning!", NULL, NULL },  /* Warning high threshold triggered */
143 	{ 5, "high humidity critical!", NULL, NULL }, /* Critical high threshold triggered */
144 	{ 0, NULL, NULL, NULL }
145 };
146 
147 static info_lkp_t hpe_pdu_outlet_group_type_info[] = {
148 	{ 0, "unknown", NULL, NULL },
149 	{ 1, "unknown", NULL, NULL },
150 	{ 2, "breaker1pole", NULL, NULL },
151 	{ 3, "breaker2pole", NULL, NULL },
152 	{ 4, "breaker3pole", NULL, NULL },
153 	{ 5, "outlet-section", NULL, NULL },
154 	{ 0, NULL, NULL, NULL }
155 };
156 
157 static info_lkp_t hpe_pdu_input_type_info[] = {
158 	{ 1, "1", NULL, NULL }, /* singlePhase     */
159 	{ 2, "2", NULL, NULL }, /* splitPhase      */
160 	{ 3, "3", NULL, NULL }, /* threePhaseDelta */
161 	{ 4, "3", NULL, NULL }, /* threePhaseWye   */
162 	{ 0, NULL, NULL, NULL }
163 };
164 
165 static info_lkp_t hpe_pdu_outlet_group_phase_info[] = {
166 	{ 1, "L1", NULL, NULL }, /* singlePhase */
167 	{ 2, "L1", NULL, NULL }, /* phase1toN   */
168 	{ 3, "L2", NULL, NULL }, /* phase2toN   */
169 	{ 4, "L3", NULL, NULL }, /* phase3toN   */
170 	{ 5, "L1", NULL, NULL }, /* phase1to2   */
171 	{ 6, "L2", NULL, NULL }, /* phase2to3   */
172 	{ 7, "L3", NULL, NULL }, /* phase3to1   */
173 	{ 0, NULL, NULL, NULL }
174 };
175 
176 /* Snmp2NUT lookup table for HPE PDU MIB */
177 static snmp_info_t hpe_pdu_mib[] = {
178 
179 	/* Device collection */
180 	{ "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "HPE",
181 		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
182 	/* pdu2Model.0 = STRING: "HP 8.6kVA 208V 30A 3Ph NA/JP maPDU" */
183 	{ "device.model", ST_FLAG_STRING, SU_INFOSIZE,
184 		".1.3.6.1.4.1.232.165.7.1.2.1.3.%i",
185 		"HPE ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
186 	/* pdu2SerialNumber.0 = STRING: "CN94230105" */
187 	{ "device.serial", ST_FLAG_STRING, SU_INFOSIZE,
188 		".1.3.6.1.4.1.232.165.7.1.2.1.7.%i",
189 		"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
190 	{ "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
191 		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
192 	/* pdu2PartNumber.0 = STRING: "H8B52A" */
193 	{ "device.part", ST_FLAG_STRING, SU_INFOSIZE,
194 		".1.3.6.1.4.1.232.165.7.1.2.1.6.%i",
195 		"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
196 	/* For daisychain, there is only 1 physical interface! */
197 	{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2",
198 		"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
199 	/* Daisychained devices support
200 	 * Notes: this definition is used to:
201 	 * - estimate the number of devices, based on the below OID iteration capabilities
202 	 * - determine the base index of the SNMP OID (ie 0 or 1) */
203 	/* pdu2NumberPDU.0 = INTEGER: 1 */
204 	{ "device.count", 0, 1,
205 		".1.3.6.1.4.1.232.165.7.1.1.0",
206 		"1", SU_FLAG_STATIC, NULL },
207 
208 	/* UPS collection */
209 	{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "HPE",
210 		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
211 	{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE,
212 		".1.3.6.1.4.1.232.165.7.1.2.1.3.%i",
213 		"HPE ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
214 
215 	/*	FIXME: use unitName.0	(ePDU)?
216 	 * { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_DEVICE_NAME,
217 		"unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, */
218 	{ "ups.serial", ST_FLAG_STRING, SU_INFOSIZE,
219 		".1.3.6.1.4.1.232.165.7.1.2.1.7.%i",
220 		"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
221 	/* FIXME: this entry should be SU_FLAG_SEMI_STATIC */
222 	/* pdu2FirmwareVersion.0 = STRING: "02.00.0043" */
223 	{ "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE,
224 		".1.3.6.1.4.1.232.165.7.1.2.1.5.%i",
225 		"", SU_FLAG_OK, NULL },
226 	{ "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
227 		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
228 
229 	 /* FIXME: needs a date reformating callback
230 	 *   2011-8-29,16:27:25.0,+1:0
231 	 *   Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00
232 	 * { "ups.date", ST_FLAG_STRING, SU_INFOSIZE,
233 		".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0",
234 		"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
235 	 * { "ups.time", ST_FLAG_STRING, SU_INFOSIZE,
236 		".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0",
237 		"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
238 	 */
239 
240 	/* Input collection */
241 	/* Note: for daisychain mode, we must handle phase(s) per device, not as a whole */
242 	/* pdu2InputType.0 = INTEGER: threePhaseWye(4) */
243 	{ "input.phases", 0, 1, ".1.3.6.1.4.1.232.165.7.2.1.1.1.%i",
244 		NULL, SU_FLAG_STATIC, &hpe_pdu_input_type_info[0] },
245 
246 	/* Frequency is measured globally */
247 	/* pdu2InputFrequency.0 = INTEGER: 500 */
248 	{ "input.frequency", 0, 0.1, ".1.3.6.1.4.1.232.165.7.2.1.1.2.%i",
249 		NULL, 0, NULL },
250 	/* pdu2InputFrequencyStatus.0 = INTEGER: good(1) */
251 	{ "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE,
252 		".1.3.6.1.4.1.232.165.7.2.1.1.3.%i",
253 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_frequency_status_info[0] },
254 	{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE,
255 		".1.3.6.1.4.1.232.165.7.2.1.1.3.%i",
256 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_frequency_alarm_info[0] },
257 	/* inputCurrentPercentLoad (measured globally)
258 	 * Current percent load, based on the rated current capacity */
259 	/* FIXME: input.load is mapped on input.L1.load for both single and 3phase !!! */
260 	{ "input.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1",
261 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
262 	/* pdu2InputPhaseCurrentPercentLoad.0.1 = INTEGER: 0 */
263 	{ "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.232.165.7.2.2.1.18.%i.1",
264 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
265 	/* pdu2InputPhaseCurrentPercentLoad.0.2 = INTEGER: 0 */
266 	{ "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.232.165.7.2.2.1.18.%i.2",
267 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
268 	/* pdu2InputPhaseCurrentPercentLoad.0.3 = INTEGER: 0 */
269 	{ "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.232.165.7.2.2.1.18.%i.3",
270 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
271 
272 	/* FIXME:
273 	 * - Voltage is only measured per phase, as mV!
274 	 *   so input.voltage == input.L1.voltage for both single and 3phase
275 	 * - As per NUT namespace (http://www.networkupstools.org/docs/developer-guide.chunked/apas01.html#_valid_contexts)
276 	 *   Voltage has to be expressed either phase-phase or phase-neutral
277 	 *   This is depending on OID inputVoltageMeasType
278 	 *   INTEGER {singlePhase (1),phase1toN (2),phase2toN (3),phase3toN (4),phase1to2 (5),phase2to3 (6),phase3to1 (7)
279 	 * 		=> RFC input.Lx.voltage.context */
280 	/* pdu2InputPhaseVoltage.0.1 = INTEGER: 216790 */
281 	{ "input.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.1",
282 		NULL, 0, NULL },
283 	/* pdu2InputPhaseVoltageThStatus.0.1 = INTEGER: good(1) */
284 	{ "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE,
285 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1",
286 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
287 	{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE,
288 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1",
289 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] },
290 	/* pdu2InputPhaseVoltageThLowerWarning.0.1 = INTEGER: 190000 */
291 	{ "input.voltage.low.warning", ST_FLAG_RW, 0.001,
292 		".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.1",
293 		NULL, SU_FLAG_NEGINVALID, NULL },
294 	/* pdu2InputPhaseVoltageThLowerCritical.0.1 = INTEGER: 180000 */
295 	{ "input.voltage.low.critical", ST_FLAG_RW, 0.001,
296 		".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.1",
297 		NULL, SU_FLAG_NEGINVALID, NULL },
298 	/* pdu2InputPhaseVoltageThUpperWarning.0.1 = INTEGER: 255000 */
299 	{ "input.voltage.high.warning", ST_FLAG_RW, 0.001,
300 		".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.1",
301 		NULL, SU_FLAG_NEGINVALID, NULL },
302 	/* pdu2InputPhaseVoltageThUpperCritical.0.1 = INTEGER: 265000 */
303 	{ "input.voltage.high.critical", ST_FLAG_RW, 0.001,
304 		".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.1",
305 		NULL, SU_FLAG_NEGINVALID, NULL },
306 	/* pdu2InputPhaseVoltage.0.1 = INTEGER: 216790 */
307 	{ "input.L1.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.1",
308 		NULL, 0, NULL },
309 	/* pdu2InputPhaseVoltageThStatus.0.1 = INTEGER: good(1) */
310 	{ "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE,
311 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1",
312 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
313 	{ "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE,
314 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1",
315 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] },
316 	/* pdu2InputPhaseVoltageThLowerWarning.0.1 = INTEGER: 190000 */
317 	{ "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001,
318 		".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.1",
319 		NULL, SU_FLAG_NEGINVALID, NULL },
320 	/* pdu2InputPhaseVoltageThLowerCritical.0.1 = INTEGER: 180000 */
321 	{ "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001,
322 		".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.1",
323 		NULL, SU_FLAG_NEGINVALID, NULL },
324 	/* pdu2InputPhaseVoltageThUpperWarning.0.1 = INTEGER: 255000 */
325 	{ "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001,
326 		".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.1",
327 		NULL, SU_FLAG_NEGINVALID, NULL },
328 	/* pdu2InputPhaseVoltageThUpperCritical.0.1 = INTEGER: 265000 */
329 	{ "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001,
330 		".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.1",
331 		NULL, SU_FLAG_NEGINVALID, NULL },
332 	/* pdu2InputPhaseVoltage.0.2 = INTEGER: 216790 */
333 	{ "input.L2.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.2",
334 		NULL, 0, NULL },
335 	/* pdu2InputPhaseVoltageThStatus.0.2 = INTEGER: good(1) */
336 	{ "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE,
337 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.2",
338 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
339 	{ "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE,
340 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.2",
341 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] },
342 	/* pdu2InputPhaseVoltageThLowerWarning.0.2 = INTEGER: 190000 */
343 	{ "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001,
344 		".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.2",
345 		NULL, SU_FLAG_NEGINVALID, NULL },
346 	/* pdu2InputPhaseVoltageThLowerCritical.0.2 = INTEGER: 180000 */
347 	{ "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001,
348 		".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.2",
349 		NULL, SU_FLAG_NEGINVALID, NULL },
350 	/* pdu2InputPhaseVoltageThUpperWarning.0.2 = INTEGER: 255000 */
351 	{ "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001,
352 		".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.2",
353 		NULL, SU_FLAG_NEGINVALID, NULL },
354 	/* pdu2InputPhaseVoltageThUpperCritical.0.2 = INTEGER: 265000 */
355 	{ "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001,
356 		".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.2",
357 		NULL, SU_FLAG_NEGINVALID, NULL },
358 	/* pdu2InputPhaseVoltage.0.3 = INTEGER: 216790 */
359 	{ "input.L3.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.3",
360 		NULL, 0, NULL },
361 	/* pdu2InputPhaseVoltageThStatus.0.3 = INTEGER: good(1) */
362 	{ "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE,
363 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.3",
364 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
365 	{ "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE,
366 		".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.3",
367 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] },
368 	/* pdu2InputPhaseVoltageThLowerWarning.0.3 = INTEGER: 190000 */
369 	{ "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001,
370 		".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.3",
371 		NULL, SU_FLAG_NEGINVALID, NULL },
372 	/* pdu2InputPhaseVoltageThLowerCritical.0.3 = INTEGER: 180000 */
373 	{ "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001,
374 		".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.3",
375 		NULL, SU_FLAG_NEGINVALID, NULL },
376 	/* pdu2InputPhaseVoltageThUpperWarning.0.3 = INTEGER: 255000 */
377 	{ "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001,
378 		".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.3",
379 		NULL, SU_FLAG_NEGINVALID, NULL },
380 	/* pdu2InputPhaseVoltageThUpperCritical.0.3 = INTEGER: 265000 */
381 	{ "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001,
382 		".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.3",
383 		NULL, SU_FLAG_NEGINVALID, NULL },
384 	/* FIXME:
385 	 * - input.current is mapped on input.L1.current for both single and 3phase !!! */
386 	/* pdu2InputPhaseCurrent.0.1 = INTEGER: 185 */
387 	{ "input.current", 0, 0.001,
388 		".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.1",
389 		NULL, 0, NULL },
390 	/* pdu2InputPhaseCurrentRating.0.1 = INTEGER: 24000 */
391 	{ "input.current.nominal", 0, 0.001,
392 		".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.1",
393 		NULL, SU_FLAG_NEGINVALID, NULL },
394 	/* pdu2InputPhaseCurrentThStatus.0.1 = INTEGER: good(1) */
395 	{ "input.current.status", ST_FLAG_STRING, SU_INFOSIZE,
396 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1",
397 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
398 	{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE,
399 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1",
400 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] },
401 	/* pdu2InputPhaseCurrentThLowerWarning.0.1 = INTEGER: 0 */
402 	{ "input.current.low.warning", ST_FLAG_RW, 0.001,
403 		".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.1",
404 		NULL, SU_FLAG_NEGINVALID, NULL },
405 	/* pdu2InputPhaseCurrentThLowerCritical.0.1 = INTEGER: -1 */
406 	{ "input.current.low.critical", ST_FLAG_RW, 0.001,
407 		".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.1",
408 		NULL, SU_FLAG_NEGINVALID, NULL },
409 	/* pdu2InputPhaseCurrentThUpperWarning.0.1 = INTEGER: 19200 */
410 	{ "input.current.high.warning", ST_FLAG_RW, 0.001,
411 		".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.1",
412 		NULL, SU_FLAG_NEGINVALID, NULL },
413 	/* pdu2InputPhaseCurrentThUpperCritical.0.1 = INTEGER: 24000 */
414 	{ "input.current.high.critical", ST_FLAG_RW, 0.001,
415 		".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.1",
416 		NULL, SU_FLAG_NEGINVALID, NULL },
417 	/* pdu2InputPhaseCurrent.0.1 = INTEGER: 185 */
418 	{ "input.L1.current", 0, 0.001,
419 		".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.1",
420 		NULL, 0, NULL },
421 	/* pdu2InputPhaseCurrentRating.0.1 = INTEGER: 24000 */
422 	{ "input.L1.current.nominal", 0, 0.001,
423 		".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.1",
424 		NULL, SU_FLAG_NEGINVALID, NULL },
425 	/* pdu2InputPhaseCurrentThStatus.0.1 = INTEGER: good(1) */
426 	{ "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE,
427 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1",
428 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
429 	{ "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE,
430 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1",
431 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] },
432 	/* pdu2InputPhaseCurrentThLowerWarning.0.1 = INTEGER: 0 */
433 	{ "input.L1.current.low.warning", ST_FLAG_RW, 0.001,
434 		".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.1",
435 		NULL, SU_FLAG_NEGINVALID, NULL },
436 	/* pdu2InputPhaseCurrentThLowerCritical.0.1 = INTEGER: -1 */
437 	{ "input.L1.current.low.critical", ST_FLAG_RW, 0.001,
438 		".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.1",
439 		NULL, SU_FLAG_NEGINVALID, NULL },
440 	/* pdu2InputPhaseCurrentThUpperWarning.0.1 = INTEGER: 19200 */
441 	{ "input.L1.current.high.warning", ST_FLAG_RW, 0.001,
442 		".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.1",
443 		NULL, SU_FLAG_NEGINVALID, NULL },
444 	/* pdu2InputPhaseCurrentThUpperCritical.0.1 = INTEGER: 24000 */
445 	{ "input.L1.current.high.critical", ST_FLAG_RW, 0.001,
446 		".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.1",
447 		NULL, SU_FLAG_NEGINVALID, NULL },
448 	/* pdu2InputPhaseCurrent.0.2 = INTEGER: 185 */
449 	{ "input.L2.current", 0, 0.001,
450 		".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.2",
451 		NULL, 0, NULL },
452 	/* pdu2InputPhaseCurrentRating.0.2 = INTEGER: 24000 */
453 	{ "input.L2.current.nominal", 0, 0.001,
454 		".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.2",
455 		NULL, SU_FLAG_NEGINVALID, NULL },
456 	/* pdu2InputPhaseCurrentThStatus.0.2 = INTEGER: good(1) */
457 	{ "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE,
458 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.2",
459 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
460 	{ "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE,
461 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.2",
462 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] },
463 	/* pdu2InputPhaseCurrentThLowerWarning.0.2 = INTEGER: 0 */
464 	{ "input.L2.current.low.warning", ST_FLAG_RW, 0.001,
465 		".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.2",
466 		NULL, SU_FLAG_NEGINVALID, NULL },
467 	/* pdu2InputPhaseCurrentThLowerCritical.0.2 = INTEGER: -1 */
468 	{ "input.L2.current.low.critical", ST_FLAG_RW, 0.001,
469 		".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.2",
470 		NULL, SU_FLAG_NEGINVALID, NULL },
471 	/* pdu2InputPhaseCurrentThUpperWarning.0.2 = INTEGER: 19200 */
472 	{ "input.L2.current.high.warning", ST_FLAG_RW, 0.001,
473 		".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.2",
474 		NULL, SU_FLAG_NEGINVALID, NULL },
475 	/* pdu2InputPhaseCurrentThUpperCritical.0.2 = INTEGER: 24000 */
476 	{ "input.L2.current.high.critical", ST_FLAG_RW, 0.001,
477 		".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.2",
478 		NULL, SU_FLAG_NEGINVALID, NULL },
479 	/* pdu2InputPhaseCurrent.0.3 = INTEGER: 185 */
480 	{ "input.L3.current", 0, 0.001,
481 		".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.3",
482 		NULL, 0, NULL },
483 	/* pdu2InputPhaseCurrentRating.0.3 = INTEGER: 24000 */
484 	{ "input.L3.current.nominal", 0, 0.001,
485 		".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.3",
486 		NULL, SU_FLAG_NEGINVALID, NULL },
487 	/* pdu2InputPhaseCurrentThStatus.0.3 = INTEGER: good(1) */
488 	{ "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE,
489 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.3",
490 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
491 	{ "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE,
492 		".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.2",
493 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] },
494 	/* pdu2InputPhaseCurrentThLowerWarning.0.3 = INTEGER: 0 */
495 	{ "input.L3.current.low.warning", ST_FLAG_RW, 0.001,
496 		".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.3",
497 		NULL, SU_FLAG_NEGINVALID, NULL },
498 	/* pdu2InputPhaseCurrentThLowerCritical.0.3 = INTEGER: -1 */
499 	{ "input.L3.current.low.critical", ST_FLAG_RW, 0.001,
500 		".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.3",
501 		NULL, SU_FLAG_NEGINVALID, NULL },
502 	/* pdu2InputPhaseCurrentThUpperWarning.0.3 = INTEGER: 19200 */
503 	{ "input.L3.current.high.warning", ST_FLAG_RW, 0.001,
504 		".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.3",
505 		NULL, SU_FLAG_NEGINVALID, NULL },
506 	/* pdu2InputPhaseCurrentThUpperCritical.0.3 = INTEGER: 24000 */
507 	{ "input.L3.current.high.critical", ST_FLAG_RW, 0.001,
508 		".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.3",
509 		NULL, SU_FLAG_NEGINVALID, NULL },
510 	/* pdu2InputPowerWatts.0 = INTEGER: 19 */
511 	{ "input.realpower", 0, 1.0,
512 		".1.3.6.1.4.1.232.165.7.2.1.1.5.%i",
513 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL },
514 	/* pdu2InputPhasePowerWatts.0.1 = INTEGER: 19 */
515 	{ "input.L1.realpower", 0, 1.0,
516 		".1.3.6.1.4.1.232.165.7.2.2.1.21.%i.1",
517 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
518 	/* pdu2InputPhasePowerWatts.0.2 = INTEGER: 0 */
519 	{ "input.L2.realpower", 0, 1.0,
520 		".1.3.6.1.4.1.232.165.7.2.2.1.21.%i.2",
521 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
522 	/* pdu2InputPhasePowerWatts.0.3 = INTEGER: 0 */
523 	{ "input.L3.realpower", 0, 1.0,
524 		".1.3.6.1.4.1.232.165.7.2.2.1.21.%i.3",
525 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
526 	/* Sum of all phases apparent power, valid for Shark 1ph/3ph only */
527 	/* pdu2InputPowerVA.0 = INTEGER: 39 */
528 	{ "input.power", 0, 1.0,
529 		".1.3.6.1.4.1.232.165.7.2.1.1.4.%i",
530 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL },
531 	/* pdu2InputPhasePowerVA.0.1 = INTEGER: 40 */
532 	{ "input.L1.power", 0, 1.0,
533 		".1.3.6.1.4.1.232.165.7.2.2.1.20.%i.1",
534 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
535 	/* pdu2InputPhasePowerVA.0.2 = INTEGER: 0 */
536 	{ "input.L2.power", 0, 1.0,
537 		".1.3.6.1.4.1.232.165.7.2.2.1.20.%i.2",
538 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
539 	/* pdu2InputPhasePowerVA.0.3 = INTEGER: 0 */
540 	{ "input.L3.power", 0, 1.0,
541 		".1.3.6.1.4.1.232.165.7.2.2.1.20.%i.3",
542 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
543 
544 	/* TODO: handle statistics */
545 	/* pdu2InputPowerWattHour.0 = INTEGER: 91819
546 	{ "unmapped.pdu2InputPowerWattHour", 0, 1, ".1.3.6.1.4.1.232.165.7.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, */
547 	/* pdu2InputPowerWattHourTimer.0 = STRING: "16/10/2017,17:58:53"
548 	{ "unmapped.pdu2InputPowerWattHourTimer", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.7.2.1.1.7.0", NULL, SU_FLAG_OK, NULL }, */
549 	/* pdu2InputPowerFactor.0 = INTEGER: 483 */
550 	{ "input.powerfactor", 0, 0.001,
551 		".1.3.6.1.4.1.232.165.7.2.1.1.8.%i",
552 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
553 
554 	/* Ambient collection */
555 	/* pdu2TemperatureProbeStatus.0.1 = INTEGER: disconnected(1) */
556 	{ "ambient.present", ST_FLAG_STRING, SU_INFOSIZE,
557 		".1.3.6.1.4.1.232.165.7.4.2.1.3.%i.1",
558 		NULL, SU_FLAG_OK, &hpe_pdu_ambient_presence_info[0] },
559 	/* pdu2TemperatureThStatus.0.1 = INTEGER: good(1) */
560 	{ "ambient.temperature.status", ST_FLAG_STRING, SU_INFOSIZE,
561 		".1.3.6.1.4.1.232.165.7.4.2.1.5.%i.1",
562 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
563 	{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE,
564 		".1.3.6.1.4.1.232.165.7.4.2.1.5.%i.1",
565 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_temperature_alarms_info[0] },
566 	/* pdu2TemperatureValue.0.1 = INTEGER: 0 */
567 	{ "ambient.temperature", 0, 0.1,
568 		".1.3.6.1.4.1.232.165.7.4.2.1.4.%i.1",
569 		NULL, SU_FLAG_OK, NULL },
570 	/* Low and high threshold use the respective critical levels */
571 	/* pdu2TemperatureThLowerCritical.0.1 = INTEGER: 50 */
572 	{ "ambient.temperature.low", ST_FLAG_RW, 0.1,
573 		".1.3.6.1.4.1.232.165.7.4.2.1.7.%i.1",
574 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
575 	{ "ambient.temperature.low.critical", ST_FLAG_RW, 0.1,
576 		".1.3.6.1.4.1.232.165.7.4.2.1.7.%i.1",
577 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
578 	/* pdu2TemperatureThLowerWarning.0.1 = INTEGER: 100 */
579 	{ "ambient.temperature.low.warning", ST_FLAG_RW, 0.1,
580 		".1.3.6.1.4.1.232.165.7.4.2.1.6.%i.1",
581 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
582 	/* pdu2TemperatureThUpperCritical.0.1 = INTEGER: 650 */
583 	{ "ambient.temperature.high", ST_FLAG_RW, 0.1,
584 		".1.3.6.1.4.1.232.165.7.4.2.1.9.%i.1",
585 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
586 	{ "ambient.temperature.high.critical", ST_FLAG_RW, 0.1,
587 		".1.3.6.1.4.1.232.165.7.4.2.1.9.%i.1",
588 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
589 	/* pdu2TemperatureThUpperWarning.0.1 = INTEGER: 200 */
590 	{ "ambient.temperature.high.warning", ST_FLAG_RW, 0.1,
591 		".1.3.6.1.4.1.232.165.7.4.2.1.8.%i.1",
592 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
593 	/* pdu2HumidityThStatus.0.1 = INTEGER: good(1) */
594 	{ "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE,
595 		".1.3.6.1.4.1.232.165.7.4.3.1.5.%i.1",
596 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] },
597 	{ "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE,
598 		".1.3.6.1.4.1.232.165.7.4.3.1.5.%i.1",
599 		NULL, SU_FLAG_OK, &hpe_pdu_threshold_humidity_alarms_info[0] },
600 	/* pdu2HumidityValue.0.1 = INTEGER: 0 */
601 	{ "ambient.humidity", 0, 0.1,
602 		".1.3.6.1.4.1.232.165.7.4.3.1.4.%i.1",
603 		NULL, SU_FLAG_OK, NULL },
604 	/* Low and high threshold use the respective critical levels */
605 	/* pdu2HumidityThLowerCritical.0.1 = INTEGER: 100 */
606 	{ "ambient.humidity.low", ST_FLAG_RW, 0.1,
607 		".1.3.6.1.4.1.232.165.7.4.3.1.7.%i.1",
608 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
609 	{ "ambient.humidity.low.critical", ST_FLAG_RW, 0.1,
610 		".1.3.6.1.4.1.232.165.7.4.3.1.7.%i.1",
611 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
612 	/* pdu2HumidityThLowerWarning.0.1 = INTEGER: 200 */
613 	{ "ambient.humidity.low.warning", ST_FLAG_RW, 0.1,
614 		".1.3.6.1.4.1.232.165.7.4.3.1.6.%i.1",
615 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
616 	/* pdu2HumidityThUpperWarning.0.1 = INTEGER: 250 */
617 	{ "ambient.humidity.high.warning", ST_FLAG_RW, 0.1,
618 		".1.3.6.1.4.1.232.165.7.4.3.1.8.%i.1",
619 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
620 	/* pdu2HumidityThUpperCritical.0.1 = INTEGER: 900 */
621 	{ "ambient.humidity.high", ST_FLAG_RW, 0.1,
622 		".1.3.6.1.4.1.232.165.7.4.3.1.9.%i.1",
623 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
624 	{ "ambient.humidity.high.critical", ST_FLAG_RW, 0.1,
625 		".1.3.6.1.4.1.232.165.7.4.3.1.9.%i.1",
626 		NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL },
627 	/* Dry contacts on TH module */
628 	/* pdu2ContactState.0.1 = INTEGER: contactBad(3) */
629 	{ "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE,
630 		".1.3.6.1.4.1.232.165.7.4.4.1.4.%i.1",
631 		NULL, SU_FLAG_OK, &hpe_pdu_ambient_drycontacts_info[0] },
632 	/* pdu2ContactState.0.2 = INTEGER: contactBad(3) */
633 	{ "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE,
634 		".1.3.6.1.4.1.232.165.7.4.4.1.4.%i.2",
635 		NULL, SU_FLAG_OK, &hpe_pdu_ambient_drycontacts_info[0] },
636 
637 	/* Outlet collection */
638 	{ "outlet.id", 0, 1, NULL,
639 		"0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
640 	{ "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets",
641 		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
642 	/* pdu2OutletCount.0 = INTEGER: 24 */
643 	{ "outlet.count", 0, 1,
644 		".1.3.6.1.4.1.232.165.7.1.2.1.12.%i",
645 		"0", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
646 	/* outlet template definition
647 	 * Indexes start from 1, ie outlet.1 => <OID>.1 */
648 	/* Note: the first definition is used to determine the base index (ie 0 or 1) */
649 	/* pdu2OutletName.0.%i = STRING: "Outlet L1-%i" */
650 	{ "outlet.%i.desc", ST_FLAG_STRING, SU_INFOSIZE,
651 		".1.3.6.1.4.1.232.165.7.5.1.1.2.%i.%i",
652 		NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
653 	/* pdu2OutletControlStatus.0.%i = INTEGER: on(2) */
654 	{ "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE,
655 		".1.3.6.1.4.1.232.165.7.5.2.1.1.%i.%i",
656 		NULL, SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, &hpe_pdu_outlet_status_info[0] },
657 	/* Numeric identifier of the outlet, tied to the whole unit */
658 	{ "outlet.%i.id", 0, 1, NULL, "%i",
659 		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
660 
661 
662 #if 0
663 	/* FIXME: the last part of the OID gives the group number (i.e. %i.1 means "group 1")
664 	 * Need to address that, without multiple declaration (%i.%i, SU_OUTLET | SU_OUTLET_GROUP)? */
665 	{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE,
666 		".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.1",
667 		NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
668 	{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE,
669 		".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.2",
670 		NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
671 	{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE,
672 		 ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.3",
673 		NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
674 	{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE,
675 		".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.4",
676 		NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
677 	{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE,
678 		".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.5",
679 		NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
680 	{ "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE,
681 		".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.6",
682 		NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
683 #endif
684 
685 	/* pdu2OutletCurrent.0.%i = INTEGER: 0 */
686 	{ "outlet.%i.current", 0, 0.001,
687 		".1.3.6.1.4.1.232.165.7.5.1.1.5.%i.%i",
688 		NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL },
689 	/* pdu2OutletCurrentThStatus.0.%i = INTEGER: good(1) */
690 	{ "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE,
691 		".1.3.6.1.4.1.232.165.7.5.1.1.6.%i.%i",
692 		NULL, SU_OUTLET | SU_TYPE_DAISY_1, &hpe_pdu_threshold_status_info[0] },
693 	{ "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE,
694 		".1.3.6.1.4.1.232.165.7.5.1.1.6.%i.%i",
695 		NULL, SU_OUTLET | SU_TYPE_DAISY_1, &hpe_pdu_threshold_current_alarms_info[0] },
696 	/* pdu2OutletCurrentThLowerWarning.0.%i = INTEGER: 0 */
697 	{ "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001,
698 		".1.3.6.1.4.1.232.165.7.5.1.1.7.%i.%i",
699 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
700 	/* pdu2OutletCurrentThLowerCritical.0.%i = INTEGER: -1 */
701 	{ "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001,
702 		".1.3.6.1.4.1.232.165.7.5.1.1.8.%i.%i",
703 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
704 	/* pdu2OutletCurrentThUpperWarning.0.1 = INTEGER: 8000 */
705 	{ "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001,
706 		".1.3.6.1.4.1.232.165.7.5.1.1.9.%i.%i",
707 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
708 	/* pdu2OutletCurrentThUpperCritical.0.1 = INTEGER: 10000 */
709 	{ "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001,
710 		".1.3.6.1.4.1.232.165.7.5.1.1.10.%i.%i",
711 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
712 	/* pdu2OutletWatts.0.1 = INTEGER: 0 */
713 	{ "outlet.%i.realpower", 0, 1.0,
714 		".1.3.6.1.4.1.232.165.7.5.1.1.14.%i.%i",
715 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
716 	/* pdu2OutletVA.0.%i = INTEGER: 0 */
717 	{ "outlet.%i.power", 0, 1.0,
718 		".1.3.6.1.4.1.232.165.7.5.1.1.13.%i.%i",
719 		NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL },
720 	/* pdu2OutletControlSwitchable.0.%i = INTEGER: switchable(1) */
721 	{ "outlet.%i.switchable", ST_FLAG_RW, SU_INFOSIZE,
722 		".1.3.6.1.4.1.232.165.7.5.2.1.8.%i.%i",
723 		"no", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK | SU_TYPE_DAISY_1,
724 		&hpe_pdu_outlet_switchability_info[0] },
725 	/* pdu2OutletType.0.%i = INTEGER: iecC13(1) */
726 	{ "outlet.%i.type", ST_FLAG_STRING, SU_INFOSIZE,
727 		".1.3.6.1.4.1.232.165.7.5.1.1.3.%i.%i",
728 		"unknown", SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1,
729 		&hpe_pdu_outlet_type_info[0] },
730 	/* pdu2OutletPowerFactor.0.%i = INTEGER: 1000 */
731 	{ "outlet.%i.powerfactor", 0, 0.001,
732 		".1.3.6.1.4.1.232.165.7.5.1.1.17.%i.%i",
733 		NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL },
734 	/* TODO: handle statistics */
735 	/* pdu2OutletWh.0.1 = INTEGER: 1167
736 	 * Note: setting this to zero resets the counter and timestamp => instcmd ???counter???.reset
737 	{ "unmapped.pdu2OutletWh", 0, 1, ".1.3.6.1.4.1.232.165.7.5.1.1.15.%i.%i", NULL, SU_FLAG_OK, NULL }, */
738 	/* pdu2OutletWhTimer.0.1 = STRING: "25/03/2016,09:03:26"
739 	{ "unmapped.pdu2OutletWhTimer", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.7.5.1.1.16.%i.%i", NULL, SU_FLAG_OK, NULL }, */
740 
741 	/* Outlet groups collection */
742 	/* pdu2GroupCount.0 = INTEGER: 3 */
743 	{ "outlet.group.count", 0, 1,
744 		".1.3.6.1.4.1.232.165.7.1.2.1.11.%i",
745 		"0", SU_FLAG_STATIC | SU_TYPE_DAISY_1, NULL },
746 	/* outlet groups template definition
747 	 * Indexes start from 1, ie outlet.group.1 => <OID>.1 */
748 	/* Note: the first definition is used to determine the base index (ie 0 or 1) */
749 	/* pdu2GroupIndex.0.%i = INTEGER: %i */
750 	{ "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE,
751 		".1.3.6.1.4.1.232.165.7.3.1.1.1.%i.%i",
752 		NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
753 	/* pdu2GroupName.0.%i = STRING: "Section L1" */
754 	{ "outlet.group.%i.name", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE,
755 		".1.3.6.1.4.1.232.165.7.3.1.1.2.%i.%i",
756 		NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
757 	/* pdu2GroupType.0.%i = INTEGER: breaker2pole(3) */
758 	{ "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE,
759 		".1.3.6.1.4.1.232.165.7.3.1.1.3.%i.%i",
760 		NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &hpe_pdu_outlet_group_type_info[0] },
761 	/* pdu2GroupVoltageMeasType.0.1 = INTEGER: phase1to2(5) */
762 	{ "outlet.group.%i.phase", 0, SU_INFOSIZE,
763 		".1.3.6.1.4.1.232.165.7.3.1.1.4.%i.%i",
764 		NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1,
765 		&hpe_pdu_outlet_group_phase_info[0] },
766 	/* pdu2groupBreakerStatus.0.%i = INTEGER: breakerOn(2) */
767 	{ "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE,
768 		".1.3.6.1.4.1.232.165.7.3.1.1.27.%i.%i",
769 		NULL, SU_FLAG_OK | SU_FLAG_NAINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1,
770 		&hpe_pdu_outletgroups_status_info[0] },
771 	/* pdu2GroupOutletCount.0.%i = INTEGER: 8 */
772 	{ "outlet.group.%i.count", 0, 1,
773 		".1.3.6.1.4.1.232.165.7.3.1.1.26.%i.%i",
774 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
775 	/* pdu2GroupVoltage.0.%i = INTEGER: 216760 */
776 	{ "outlet.group.%i.voltage", 0, 0.001,
777 		".1.3.6.1.4.1.232.165.7.3.1.1.5.%i.%i",
778 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
779 	/* pdu2GroupVoltageThStatus.0.%i = INTEGER: good(1) */
780 	{ "outlet.group.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE,
781 		".1.3.6.1.4.1.232.165.7.3.1.1.6.%i.%i",
782 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1,
783 		&hpe_pdu_threshold_status_info[0] },
784 	{ "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE,
785 		".1.3.6.1.4.1.232.165.7.3.1.1.6.%i.%i",
786 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1,
787 		&hpe_pdu_threshold_voltage_alarms_info[0] },
788 	/* pdu2GroupVoltageThLowerWarning.0.%i = INTEGER: 190000 */
789 	{ "outlet.group.%i.voltage.low.warning", ST_FLAG_RW, 0.001,
790 		".1.3.6.1.4.1.232.165.7.3.1.1.7.%i.%i",
791 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
792 	/* pdu2GroupVoltageThLowerCritical.0.%i = INTEGER: 180000 */
793 	{ "outlet.group.%i.voltage.low.critical", ST_FLAG_RW, 0.001,
794 		".1.3.6.1.4.1.232.165.7.3.1.1.8.%i.%i",
795 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
796 	/* pdu2GroupVoltageThUpperWarning.0.%i = INTEGER: 255000 */
797 	{ "outlet.group.%i.voltage.high.warning", ST_FLAG_RW, 0.001,
798 		".1.3.6.1.4.1.232.165.7.3.1.1.9.%i.%i",
799 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
800 	/* pdu2GroupVoltageThUpperCritical.0.%i = INTEGER: 265000 */
801 	{ "outlet.group.%i.voltage.high.critical", ST_FLAG_RW, 0.001,
802 		".1.3.6.1.4.1.232.165.7.3.1.1.10.%i.%i",
803 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
804 	/* pdu2GroupCurrent.0.%i = INTEGER: 0 */
805 	{ "outlet.group.%i.current", 0, 0.001,
806 		".1.3.6.1.4.1.232.165.7.3.1.1.12.%i.%i",
807 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
808 	/* pdu2groupCurrentRating.0.%i = INTEGER: 16000 */
809 	{ "outlet.group.%i.current.nominal", 0, 0.001,
810 		".1.3.6.1.4.1.232.165.7.3.1.1.11.%i.%i",
811 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
812 	/* pdu2GroupCurrentThStatus.0.%i = INTEGER: good(1) */
813 	{ "outlet.group.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE,
814 		".1.3.6.1.4.1.232.165.7.3.1.1.13.%i.%i",
815 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1,
816 		&hpe_pdu_threshold_status_info[0] },
817 	{ "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE,
818 		".1.3.6.1.4.1.232.165.7.3.1.1.13.%i.%i",
819 		NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1,
820 		&hpe_pdu_threshold_current_alarms_info[0] },
821 	/* pdu2GroupCurrentThLowerWarning.0.%i = INTEGER: 0 */
822 	{ "outlet.group.%i.current.low.warning", ST_FLAG_RW, 0.001,
823 		".1.3.6.1.4.1.232.165.7.3.1.1.14.%i.%i",
824 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
825 	/* pdu2GroupCurrentThLowerCritical.0.%i = INTEGER: -1 */
826 	{ "outlet.group.%i.current.low.critical", ST_FLAG_RW, 0.001,
827 		".1.3.6.1.4.1.232.165.7.3.1.1.15.%i.%i",
828 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
829 	/* pdu2GroupCurrentThUpperWarning.0.%i = INTEGER: 12800 */
830 	{ "outlet.group.%i.current.high.warning", ST_FLAG_RW, 0.001,
831 		".1.3.6.1.4.1.232.165.7.3.1.1.16.%i.%i",
832 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
833 	/* pdu2GroupCurrentThUpperCritical.0.%i = INTEGER: 16000 */
834 	{ "outlet.group.%i.current.high.critical", ST_FLAG_RW, 0.001,
835 		".1.3.6.1.4.1.232.165.7.3.1.1.17.%i.%i",
836 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
837 	/* pdu2GroupCurrentPercentLoad.0.%i = INTEGER: 0 */
838 	{ "outlet.group.%i.load", 0, 1.0,
839 		".1.3.6.1.4.1.232.165.7.3.1.1.19.%i.%i",
840 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
841 	/* pdu2GroupPowerWatts.0.%i = INTEGER: 0 */
842 	{ "outlet.group.%i.realpower", 0, 1.0,
843 		".1.3.6.1.4.1.232.165.7.3.1.1.21.%i.%i",
844 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
845 	/* pdu2GroupPowerVA.0.%i = INTEGER: 0 */
846 	{ "outlet.group.%i.power", 0, 1.0,
847 		".1.3.6.1.4.1.232.165.7.3.1.1.20.%i.%i",
848 		NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL },
849 	/* pdu2GroupPowerFactor.0.%i = INTEGER: 1000 */
850 	{ "outlet.group.%i.powerfactor", 0, 0.001,
851 		".1.3.6.1.4.1.232.165.7.3.1.1.24.%i.%i",
852 		NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL },
853 
854 	/* TODO: handle statistics */
855 	/* pdu2GroupPowerWattHour.0.%i = INTEGER: 1373
856 	 * Note: setting this to zero resets the counter and timestamp => instcmd .reset
857 	{ "unmapped.pdu2GroupPowerWattHour", 0, 1, ".1.3.6.1.4.1.232.165.7.3.1.1.22.%i.%i", NULL, SU_FLAG_OK, NULL }, */
858 	/* pdu2GroupPowerWattHourTimer.0.%i = STRING: "25/03/2016,09:01:16"
859 	{ "unmapped.pdu2GroupPowerWattHourTimer", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.7.3.1.1.23.%i.%i", NULL, SU_FLAG_OK, NULL }, */
860 
861 	/* instant commands. */
862 	/* TODO: handle delays (outlet.%i.{on,off}.delay) */
863 	/* pdu2OutletControlOffCmd.0.%i = INTEGER: -1 */
864 	{ "outlet.%i.load.off", 0, 1,
865 		".1.3.6.1.4.1.232.165.7.5.2.1.2.%i.%i",
866 		"0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
867 	/* pdu2OutletControlOnCmd.0.%i = INTEGER: -1 */
868 	{ "outlet.%i.load.on", 0, 1,
869 		".1.3.6.1.4.1.232.165.7.5.2.1.3.%i.%i",
870 		"0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
871 	/* pdu2OutletControlRebootCmd.0.%i = INTEGER: -1 */
872 	{ "outlet.%i.load.cycle", 0, 1,
873 		".1.3.6.1.4.1.232.165.7.5.2.1.4.%i.%i",
874 		"0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
875 	/* Delayed version, parameter is mandatory (so dfl is NULL)! */
876 	/* pdu2OutletControlOffCmd.0.%i = INTEGER: -1 */
877 	{ "outlet.%i.load.off.delay", 0, 1,
878 		".1.3.6.1.4.1.232.165.7.5.2.1.2.%i.%i",
879 		NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
880 	/* pdu2OutletControlOnCmd.0.%i = INTEGER: -1 */
881 	{ "outlet.%i.load.on.delay", 0, 1,
882 		".1.3.6.1.4.1.232.165.7.5.2.1.3.%i.%i",
883 		NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
884 	/* pdu2OutletControlRebootCmd.0.%i = INTEGER: -1 */
885 	{ "outlet.%i.load.cycle.delay", 0, 1,
886 		".1.3.6.1.4.1.232.165.7.5.2.1.4.%i.%i",
887 		NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL },
888 
889 	/* end of structure. */
890 	{ NULL, 0, 0, NULL, NULL, 0, NULL }
891 };
892 
893 
894 mib2nut_info_t	hpe_pdu = { "hpe_epdu", HPE_EPDU_MIB_VERSION, NULL, HPE_EPDU_OID_MODEL_NAME, hpe_pdu_mib, HPE_EPDU_MIB_SYSOID, NULL };
895