~iheino+ub/+junk/nut-upsconf-docfix

« back to all changes in this revision

Viewing changes to drivers/baytech-mib.c

  • Committer: Tuomas Heino
  • Author(s): Laurent Bigonville
  • Date: 2014-04-22 20:46:12 UTC
  • Revision ID: iheino+ub@cc.hut.fi-20140422204612-1x2gh3nkezfsdao4
Tags: upstream-2.7.2
ImportĀ upstreamĀ versionĀ 2.7.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  baytech-mib.c - data to monitor BayTech PDUs
 
2
 *
 
3
 *  Copyright (C) 2009
 
4
 *                      Opengear <support@opengear.com>
 
5
 *                              Arnaud Quette <arnaud.quette@free.fr>
 
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 "baytech-mib.h"
 
25
 
 
26
#define BAYTECH_MIB_VERSION     "4031"
 
27
 
 
28
/* Baytech MIB */
 
29
#define BAYTECH_OID_MIB                 ".1.3.6.1.4.1.4779"
 
30
#define BAYTECH_OID_MODEL_NAME  ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1"
 
31
 
 
32
static info_lkp_t outlet_status_info[] = {
 
33
        { -1, "error" },
 
34
        { 0, "off" },
 
35
        { 1, "on" },
 
36
        { 2, "cycling" }, /* transitional status */
 
37
        { 0, NULL }
 
38
};
 
39
 
 
40
/* Snmp2NUT lookup table for BayTech MIBs */
 
41
static snmp_info_t baytech_mib[] = {
 
42
        /* Device page */
 
43
        { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "BayTech",
 
44
                SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
 
45
        { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1",
 
46
                "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
 
47
        { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.2.0", "",
 
48
                SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
 
49
        { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
 
50
                SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
 
51
 
 
52
        /* UPS page */
 
53
        { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Baytech",
 
54
                SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
 
55
        { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1",
 
56
                "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
 
57
        { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.3.0",
 
58
                "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
 
59
        { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.2.0", "",
 
60
                SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
 
61
        { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.1.0", "",
 
62
                SU_FLAG_STATIC | SU_FLAG_OK, NULL },
 
63
        { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu",
 
64
                SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
 
65
        { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2",
 
66
                "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL },
 
67
        { "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.10.2.1", NULL, 0, NULL, NULL },
 
68
 
 
69
        /* Outlet page */
 
70
        { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
 
71
        { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets",
 
72
                SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
 
73
        { "outlet.count", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.2.1.15.1", "0", 0, NULL },
 
74
        { "outlet.current", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.6.2.1", NULL, 0, NULL, NULL },
 
75
        { "outlet.voltage", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.8.2.1", NULL, 0, NULL, NULL },
 
76
 
 
77
        /* outlet template definition */
 
78
        { "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, &outlet_status_info[0], NULL },
 
79
        { "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, NULL },
 
80
        { "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, NULL },
 
81
        { "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, NULL },
 
82
 
 
83
        /* instant commands. */
 
84
        { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL },
 
85
        { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL },
 
86
 
 
87
        /* end of structure. */
 
88
        { NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
 
89
};
 
90
 
 
91
mib2nut_info_t  baytech = { "baytech", BAYTECH_MIB_VERSION, "", BAYTECH_OID_MODEL_NAME, baytech_mib };