nut-debian/drivers/baytech-mib.c

99 lines
4.7 KiB
C
Raw Permalink Normal View History

2010-03-26 01:20:59 +02:00
/* baytech-mib.c - data to monitor BayTech PDUs
*
* Copyright (C) 2009
* Opengear <support@opengear.com>
2022-07-10 10:23:45 +03:00
* Arnaud Quette <arnaud.quette@free.fr>
2010-03-26 01:20:59 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "baytech-mib.h"
2022-07-10 10:23:45 +03:00
/* NOTE: last badly versioned release was "4032" but should be "X.Y[Z]"! */
#define BAYTECH_MIB_VERSION "0.4034"
2010-03-26 01:20:59 +02:00
/* Baytech MIB */
#define BAYTECH_OID_MIB ".1.3.6.1.4.1.4779"
#define BAYTECH_OID_MODEL_NAME ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1"
2022-07-10 10:23:45 +03:00
static info_lkp_t baytech_outlet_status_info[] = {
{ -1, "error", NULL, NULL },
{ 0, "off", NULL, NULL },
{ 1, "on", NULL, NULL },
{ 2, "cycling", NULL, NULL }, /* transitional status */
{ 0, NULL, NULL, NULL }
2010-03-26 01:20:59 +02:00
};
/* Snmp2NUT lookup table for BayTech MIBs */
static snmp_info_t baytech_mib[] = {
2022-07-10 10:23:45 +03:00
/* standard MIB items */
{ "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL },
{ "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL },
{ "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
/* Device page */
{ "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "BayTech",
2022-07-10 10:23:45 +03:00
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
{ "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1",
2022-07-10 10:23:45 +03:00
"Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
{ "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.2.0", "",
2022-07-10 10:23:45 +03:00
SU_FLAG_STATIC | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
{ "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
2022-07-10 10:23:45 +03:00
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
2016-07-18 03:11:41 +03:00
{ "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2",
2022-07-10 10:23:45 +03:00
"", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
/* UPS page */
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Baytech",
2022-07-10 10:23:45 +03:00
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1",
2022-07-10 10:23:45 +03:00
"Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
{ "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.3.0",
2022-07-10 10:23:45 +03:00
"unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
{ "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.2.0", "",
2022-07-10 10:23:45 +03:00
SU_FLAG_STATIC | SU_FLAG_OK, NULL },
2010-03-26 01:20:59 +02:00
{ "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.1.0", "",
SU_FLAG_STATIC | SU_FLAG_OK, NULL },
{ "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
2022-07-10 10:23:45 +03:00
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
{ "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.10.2.1", NULL, 0, NULL },
2010-03-26 01:20:59 +02:00
/* Outlet page */
{ "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
{ "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets",
SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
{ "outlet.count", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.2.1.15.1", "0", 0, NULL },
2022-07-10 10:23:45 +03:00
{ "outlet.current", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.6.2.1", NULL, 0, NULL },
{ "outlet.voltage", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.8.2.1", NULL, 0, NULL },
2010-03-26 01:20:59 +02:00
/* outlet template definition */
2022-07-10 10:23:45 +03:00
{ "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", NULL, SU_OUTLET, &baytech_outlet_status_info[0] },
{ "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.3.1.4.1.%i", NULL, SU_OUTLET, NULL },
{ "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.6.1.3.2.1.%i", "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_OUTLET | SU_FLAG_OK, NULL },
{ "outlet.%i.switchable", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, NULL },
2010-03-26 01:20:59 +02:00
/* instant commands. */
2022-07-10 10:23:45 +03:00
{ "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", "0", SU_TYPE_CMD | SU_OUTLET, NULL },
{ "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", "1", SU_TYPE_CMD | SU_OUTLET, NULL },
2010-03-26 01:20:59 +02:00
/* end of structure. */
2022-07-10 10:23:45 +03:00
{ NULL, 0, 0, NULL, NULL, 0, NULL }
2010-03-26 01:20:59 +02:00
};
2022-07-10 10:23:45 +03:00
mib2nut_info_t baytech = { "baytech", BAYTECH_MIB_VERSION, NULL, BAYTECH_OID_MODEL_NAME, baytech_mib, BAYTECH_OID_MIB, NULL };