1
/* xppc-mib.c - subdriver to monitor XPPC SNMP devices with NUT
4
* 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
5
* 2014 Charles Lepple <clepple+nut@gmail.com>
7
* Note: this subdriver was initially generated as a "stub" by the
8
* scripts/subdriver/gen-snmp-subdriver.sh script.
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
#define XPPC_MIB_VERSION "0.2"
29
#define XPPC_SYSOID ".1.3.6.1.4.1.935"
31
/* To create a value lookup structure (as needed on the 2nd line of the example
32
* below), use the following kind of declaration, outside of the present snmp_info_t[]:
33
* static info_lkp_t onbatt_info[] = {
40
/* upsBaseBatteryStatus */
41
static info_lkp_t xpcc_onbatt_info[] = {
42
{ 1, "" }, /* unknown */
43
{ 2, "" }, /* batteryNormal */
44
{ 3, "LB" } /* batteryLow */
48
upsBaseOutputStatus OBJECT-TYPE
60
static info_lkp_t xpcc_power_info[] = {
61
{ 1, "" }, /* unknown */
62
{ 2, "OL" }, /* onLine */
63
{ 3, "OB" }, /* onBattery */
64
{ 4, "OL BOOST" }, /* onBoost */
65
{ 5, "OFF" }, /* sleeping */
66
{ 6, "BYPASS"}, /* onBypass */
67
{ 7, "" }, /* rebooting */
68
{ 8, "OFF" }, /* standBy */
69
{ 9, "OL TRIM"} /* onBuck */
72
/* XPPC Snmp2NUT lookup table */
73
static snmp_info_t xppc_mib[] = {
76
* { info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar },
78
* info_type: NUT INFO_ or CMD_ element name
79
* info_flags: flags to set in addinfo
80
* info_len: length of strings if STR
81
* cmd value if CMD, multiplier otherwise
82
* OID: SNMP OID or NULL
84
* flags: snmp-ups internal flags (FIXME: ...)
85
* oid2info: lookup table between OID and NUT values
86
* setvar: variable to set for SU_FLAG_SETINT
89
* { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL },
90
* { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, onbatt_info },
92
* To create a value lookup structure (as needed on the 2nd line), use the
93
* following kind of declaration, outside of the present snmp_info_t[]:
94
* static info_lkp_t onbatt_info[] = {
100
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Tripp Lite / Phoenixtec",
101
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
103
/* upsBaseIdentModel.0 = STRING: "Intelligent" */
104
{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.935.1.1.1.1.1.1.0", "Generic Phoenixtec SNMP device", SU_FLAG_OK, NULL },
105
/* upsBaseBatteryStatus.0 = INTEGER: batteryNormal(2) */
106
{ "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.935.1.1.1.2.1.1.0", "", SU_STATUS_BATT | SU_TYPE_INT | SU_FLAG_OK, xpcc_onbatt_info },
107
/* upsSmartBatteryCapacity.0 = INTEGER: 100 */
108
{ "battery.charge", 0, 1, ".1.3.6.1.4.1.935.1.1.1.2.2.1.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL },
109
/* upsSmartBatteryTemperature.0 = INTEGER: 260 */
110
{ "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.2.2.3.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL },
111
/* upsSmartInputLineVoltage.0 = INTEGER: 1998 */
112
{ "input.voltage", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.3.2.1.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL },
113
/* upsBaseOutputStatus.0 = INTEGER: onLine(2) */
114
{ "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.935.1.1.1.4.1.1.0", "", SU_TYPE_INT | SU_STATUS_PWR, xpcc_power_info },
115
/* upsSmartOutputVoltage.0 = INTEGER: 2309 */
116
{ "output.voltage", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.4.2.1.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL },
117
/* upsSmartOutputFrequency.0 = INTEGER: 500 */
118
{ "output.frequency", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.4.2.2.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL },
119
/* upsSmartOutputLoad.0 = INTEGER: 7 */
120
{ "ups.load", 0, 1, ".1.3.6.1.4.1.935.1.1.1.4.2.3.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL },
122
/* end of structure. */
123
{ NULL, 0, 0, NULL, NULL, 0, NULL }
126
mib2nut_info_t xppc = { "xppc", XPPC_MIB_VERSION, NULL, NULL, xppc_mib, XPPC_SYSOID };