~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to drivers/apccmib.h

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Quette
  • Date: 2004-05-28 13:10:01 UTC
  • mto: (16.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040528131001-yj2m9qcez4ya2w14
Tags: upstream-1.4.2
ImportĀ upstreamĀ versionĀ 1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  apccmib.h - data to monitor APC SNMP devices (Powernet MIB) with NUT
 
2
 *
 
3
 *  Copyright (C) 2002-2003 
 
4
 *                      Dmitry Frolov <frolov@riss-telecom.ru>
 
5
 *                      Arnaud Quette <arnaud.quette@free.fr>
 
6
 *
 
7
 *  Sponsored by MGE UPS SYSTEMS <http://www.mgeups.com>
 
8
 *
 
9
 *  This program is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2 of the License, or
 
12
 *  (at your option) any later version.
 
13
 *
 
14
 *  This program is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *
 
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
 
23
 *
 
24
 */
 
25
 
 
26
#define APCC_MIB_VERSION        "1.1"
 
27
 
 
28
/* SNMP OIDs set */
 
29
#define APCC_OID_POWERNET_MIB   ".1.3.6.1.4.1.318"
 
30
/* info elements */
 
31
#define APCC_OID_MODEL_NAME             ".1.3.6.1.4.1.318.1.1.1.1.1.1"
 
32
#define APCC_OID_UPSIDEN                ".1.3.6.1.4.1.318.1.1.1.1.1.2"
 
33
#define APCC_OID_FIRMREV                ".1.3.6.1.4.1.318.1.1.1.1.2.1"
 
34
#define APCC_OID_MFRDATE                ".1.3.6.1.4.1.318.1.1.1.1.2.2"
 
35
#define APCC_OID_SERIAL                 ".1.3.6.1.4.1.318.1.1.1.1.2.3"
 
36
#define APCC_OID_BATT_STATUS    ".1.3.6.1.4.1.318.1.1.1.2.1.1"
 
37
/* Defines for APCC_OID_BATT_STATUS */
 
38
info_lkp_t apcc_batt_info[] = {
 
39
        { 1, "" },      /* unknown */
 
40
        { 2, "" },      /* batteryNormal */
 
41
        { 3, "LB" },    /* batteryLow */
 
42
        { 0, "NULL" }
 
43
} ;
 
44
 
 
45
#define APCC_OID_BATTDATE               ".1.3.6.1.4.1.318.1.1.1.2.1.3"
 
46
#define APCC_OID_BATT_CHARGE    ".1.3.6.1.4.1.318.1.1.1.2.2.1"
 
47
#define APCC_OID_UPSTEMP                ".1.3.6.1.4.1.318.1.1.1.2.2.2"
 
48
#define APCC_OID_BATT_RUNTIME   ".1.3.6.1.4.1.318.1.1.1.2.2.3"
 
49
#define APCC_OID_INVOLT                 ".1.3.6.1.4.1.318.1.1.1.3.2.1"
 
50
#define APCC_OID_INFREQ                 ".1.3.6.1.4.1.318.1.1.1.3.2.4"
 
51
#define APCC_OID_POWER_STATUS   ".1.3.6.1.4.1.318.1.1.1.4.1.1"
 
52
 
 
53
/* Defines for APCC_OID_POWER_STATUS */
 
54
info_lkp_t apcc_pwr_info[] = {
 
55
        { 1, "" },              /* other  */
 
56
        { 2, "OL" },            /* normal */
 
57
        { 3, "OB" },            /* battery */
 
58
        { 4, "BOOST" }, /* booster */
 
59
        { 5, "OFF" },           /* timedSleeping */
 
60
        { 6, "OFF" },           /* bypass  */
 
61
        { 7, "" },              /* none */
 
62
        { 8, "" },              /* rebooting */
 
63
        { 9, "" },              /* Pwr Hard Bypass */
 
64
        { 10, "" },             /* Pwr Fail Bypass */
 
65
        { 11, "OFF" },  /* sleepingUntilPowerReturn */
 
66
        { 12, "TRIM" }, /* reducer */
 
67
        { 0, "NULL" }
 
68
} ;
 
69
 
 
70
#define APCC_OID_OUTVOLT                ".1.3.6.1.4.1.318.1.1.1.4.2.1"
 
71
#define APCC_OID_LOADPCT                ".1.3.6.1.4.1.318.1.1.1.4.2.3"
 
72
#define APCC_OID_HIGHXFER               ".1.3.6.1.4.1.318.1.1.1.3.2.2"
 
73
#define APCC_OID_LOWXFER                ".1.3.6.1.4.1.318.1.1.1.3.2.3"
 
74
#define APCC_OID_SLFTSTRES              ".1.3.6.1.4.1.318.1.1.1.7.2.3"
 
75
/* XXX can't find appropriate OID for INFO_BATTVOLT. */
 
76
/*#define APCC_OID_BATT_VOLTAGE ".1.3.6.1.4.1.318.???"*/
 
77
/* commands */
 
78
#define APCC_OID_OFF                    ".1.3.6.1.4.1.318.1.1.1.6.2.1"
 
79
#define APCC_OFF_DO 2
 
80
#define APCC_OFF_GRACEFUL 3
 
81
#define APCC_OID_REBOOT                 ".1.3.6.1.4.1.318.1.1.1.6.2.2"
 
82
#define APCC_REBOOT_DO                  2
 
83
#define APCC_REBOOT_GRACEFUL    3
 
84
#if 0   /* not used. */
 
85
        #define APCC_OID_SLEEP          ".1.3.6.1.4.1.318.1.1.1.6.2.3"
 
86
        #define APCC_SLEEP_ON                   "2"
 
87
        #define APCC_SLEEP_GRACEFUL             "3"
 
88
#endif
 
89
#define APCC_OID_SIMPWF                 ".1.3.6.1.4.1.318.1.1.1.6.2.4"
 
90
#define APCC_SIMPWF_DO                  2
 
91
#define APCC_OID_FPTEST                 ".1.3.6.1.4.1.318.1.1.1.6.2.5"
 
92
#define APCC_FPTEST_DO                  2
 
93
#define APCC_OID_ON                             ".1.3.6.1.4.1.318.1.1.1.6.2.6"
 
94
#define APCC_ON_DO                              2
 
95
#define APCC_OID_BYPASS                 ".1.3.6.1.4.1.318.1.1.1.6.2.7"
 
96
#define APCC_BYPASS_ON                  2
 
97
#define APCC_BYPASS_OFF                 3
 
98
#define APCC_OID_SELFTEST               ".1.3.6.1.4.1.318.1.1.1.7.2.2"
 
99
#define APCC_SELFTEST_DO                2
 
100
#define APCC_OID_CAL                    ".1.3.6.1.4.1.318.1.1.1.7.2.5"
 
101
#define APCC_CAL_DO                             2
 
102
#define APCC_CAL_CANCEL                 3
 
103
#define APCC_OID_CAL_RESULTS    ".1.3.6.1.4.1.318.1.1.1.7.2.6"
 
104
#define APCC_CAL_OK                             1
 
105
#define APCC_CAL_INVALID                2
 
106
#define APCC_CAL_INPROGRESS             3
 
107
/*#define APCC_OID_OUTPUT_TAB   "XXX"*/
 
108
#define APCC_OID_OUTCURRENT             ".1.3.6.1.4.1.318.1.1.1.4.2.4"
 
109
#define APCC_OID_REQOUTVOLT             ".1.3.6.1.4.1.318.1.1.1.5.2.1"
 
110
#define APCC_OID_RETCAPACITY    ".1.3.6.1.4.1.318.1.1.1.5.2.6"
 
111
#define APCC_OID_CONSERVE               ".1.3.6.1.4.1.318.1.1.1.6.1.1"
 
112
#define APCC_CONSERVE_DO                2
 
113
#define APCC_OID_NEEDREPLBATT   ".1.3.6.1.4.1.318.1.1.1.2.2.4"
 
114
#define APCC_RB_NONEED                  1
 
115
#define APCC_RB_NEED                    2
 
116
#define APCC_OID_SENS                   ".1.3.6.1.4.1.318.1.1.1.5.2.7"
 
117
#define APCC_OID_GRACEDELAY             ".1.3.6.1.4.1.318.1.1.1.5.2.10"
 
118
#define APCC_OID_RETDELAY               ".1.3.6.1.4.1.318.1.1.1.5.2.9"
 
119
#define APCC_OID_LOBATTIME              ".1.3.6.1.4.1.318.1.1.1.5.2.8"
 
120
/* Environmental sensors (AP9612TH and others) */
 
121
#define APCC_OID_AMBTEMP                ".1.3.6.1.4.1.318.1.1.2.1.1"
 
122
#define APCC_OID_AMBHUMID               ".1.3.6.1.4.1.318.1.1.2.1.2"
 
123
 
 
124
/* IEM: integrated environment monitor probe */
 
125
 
 
126
#define APCC_OID_IEM_TEMP       ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4"
 
127
#define APCC_OID_IEM_TEMP_UNIT  ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.5"
 
128
#define TEMP_UNIT_FAHRENHEIT    2
 
129
#define APCC_OID_IEM_HUMID      ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.6"
 
130
 
 
131
snmp_info_t apcc_mib[] = {
 
132
 
 
133
        /* info elements. */
 
134
        { "ups.mfr", FLAG_STRING, SU_INFOSIZE, NULL, "APC",
 
135
                SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
 
136
        { "ups.model", FLAG_STRING, SU_INFOSIZE, APCC_OID_MODEL_NAME,
 
137
                "Generic Powernet SNMP device", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
 
138
        { "ups.serial", FLAG_STRING, SU_INFOSIZE, APCC_OID_SERIAL, "",
 
139
                SU_FLAG_STATIC | SU_FLAG_OK, NULL },
 
140
        { "ups.mfr.date", FLAG_STRING, SU_INFOSIZE, APCC_OID_BATTDATE, "",
 
141
                SU_FLAG_OK | SU_FLAG_STATIC, NULL },
 
142
        { "input.voltage", 0, 1, APCC_OID_INVOLT, "", SU_FLAG_OK, NULL },
 
143
        { "battery.charge", 0, 1, APCC_OID_BATT_CHARGE, "", SU_FLAG_OK, NULL },
 
144
        { "ups.status", FLAG_STRING, SU_INFOSIZE, APCC_OID_POWER_STATUS, "OFF",
 
145
                SU_FLAG_OK | SU_STATUS_PWR, &apcc_pwr_info[0] },
 
146
        { "ups.status", FLAG_STRING, SU_INFOSIZE, APCC_OID_BATT_STATUS, "",
 
147
                SU_FLAG_OK | SU_STATUS_BATT, &apcc_batt_info[0] },
 
148
        { "ups.status", FLAG_STRING, SU_INFOSIZE, APCC_OID_CAL_RESULTS, "",
 
149
                SU_FLAG_OK | SU_STATUS_CAL, NULL },
 
150
        { "ups.status", FLAG_STRING, SU_INFOSIZE, APCC_OID_NEEDREPLBATT, "",
 
151
                SU_FLAG_OK | SU_STATUS_RB, NULL },
 
152
        { "ups.temperature", 0, 1, APCC_OID_UPSTEMP, "", SU_FLAG_OK, NULL },
 
153
        { "input.frequency", 0, 1, APCC_OID_INFREQ, "", SU_FLAG_OK, NULL },
 
154
        { "ups.load", 0, 1, APCC_OID_LOADPCT, "", SU_FLAG_OK, NULL },
 
155
        { "ups.firmware", 0, 0, APCC_OID_FIRMREV, "",
 
156
                SU_FLAG_STATIC | SU_FLAG_OK, NULL },
 
157
        { "battery.runtime", 0, 1, APCC_OID_BATT_RUNTIME, "", SU_TYPE_TIME |  SU_FLAG_OK, NULL },
 
158
        /* can't find appropriate OID for "battery.voltage". */
 
159
        /*{ "battery.voltage", 0, 1, APCC_OID_BATT_VOLTAGE, "", SU_FLAG_OK, NULL },*/
 
160
        { "output.voltage", 0, 1, APCC_OID_OUTVOLT, "", SU_FLAG_OK, NULL },
 
161
        { "ups.id", FLAG_STRING | FLAG_RW, 8, APCC_OID_UPSIDEN, "",
 
162
                SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL },
 
163
        { "battery.date", FLAG_STRING | FLAG_RW, 8, APCC_OID_MFRDATE, "",
 
164
                SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL },
 
165
        { "ups.test.result", FLAG_STRING, SU_INFOSIZE, APCC_OID_SLFTSTRES, "",
 
166
                SU_FLAG_OK, NULL },
 
167
        { "input.transfer.low", FLAG_STRING | FLAG_RW, 3, APCC_OID_LOWXFER, "",
 
168
                SU_TYPE_INT | SU_FLAG_OK, NULL },
 
169
        { "input.transfer.high", FLAG_STRING | FLAG_RW, 3, APCC_OID_HIGHXFER, "",
 
170
                SU_TYPE_INT | SU_FLAG_OK, NULL },
 
171
        { "output.current", 0, 0, APCC_OID_OUTCURRENT, "", SU_FLAG_OK, NULL },
 
172
        { "output.voltage.target.battery", FLAG_STRING | FLAG_RW, 3, APCC_OID_REQOUTVOLT, "",
 
173
                SU_TYPE_INT | SU_FLAG_OK, NULL },
 
174
        { "battery.charge.restart", FLAG_STRING | FLAG_RW, 3, APCC_OID_RETCAPACITY, "",
 
175
                SU_TYPE_INT | SU_FLAG_OK, NULL },
 
176
        { "input.sensitivity", FLAG_STRING | FLAG_RW, 1, APCC_OID_SENS, "",
 
177
                SU_TYPE_INT | SU_FLAG_OK, NULL },
 
178
        { "ups.delay.shutdown", FLAG_STRING | FLAG_RW, 3, APCC_OID_GRACEDELAY, "",
 
179
                SU_TYPE_TIME | SU_FLAG_OK, NULL },
 
180
        { "ups.delay.start", FLAG_STRING | FLAG_RW, 3, APCC_OID_RETDELAY, "",
 
181
                SU_TYPE_TIME | SU_FLAG_OK, NULL },
 
182
        { "battery.charge.low", FLAG_STRING | FLAG_RW, 3, APCC_OID_LOBATTIME, "",
 
183
                SU_TYPE_TIME | SU_FLAG_OK, NULL },
 
184
 
 
185
        /* Measure-UPS ambient variables */
 
186
        { "ambient.temperature", 0, 1, APCC_OID_AMBTEMP, "", SU_FLAG_OK, NULL },
 
187
        { "ambient.humidity", 0, 1, APCC_OID_AMBHUMID, "", SU_FLAG_OK, NULL },
 
188
 
 
189
        /* IEM ambient variables */
 
190
        { "ambient.temperature", 0, 1, APCC_OID_IEM_TEMP, "", SU_FLAG_OK, NULL },
 
191
        { "ambient.humidity", 0, 1, APCC_OID_IEM_HUMID, "", SU_FLAG_OK, NULL },
 
192
 
 
193
        /* instant commands. */
 
194
        { "load.off", 0, APCC_OFF_DO, APCC_OID_OFF, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
195
        { "load.on", 0, APCC_ON_DO, APCC_OID_ON, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
196
        { "shutdown.stayoff", 0, APCC_OFF_GRACEFUL, APCC_OID_OFF, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
197
 
 
198
/*      { CMD_SDRET, 0, APCC_REBOOT_GRACEFUL, APCC_OID_REBOOT, "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, */
 
199
        
 
200
        { "shutdown.return", 0, APCC_CONSERVE_DO, APCC_OID_CONSERVE, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
201
        { "test.failure.start", 0, APCC_SIMPWF_DO, APCC_OID_SIMPWF, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
202
        { "test.panel.start", 0, APCC_FPTEST_DO, APCC_OID_FPTEST, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
203
        { "bypass.start", 0, APCC_BYPASS_ON, APCC_OID_BYPASS, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
204
        { "test.battery.start", 0, APCC_SELFTEST_DO, APCC_OID_SELFTEST, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
205
        { "calibrate.stop", 0, APCC_CAL_CANCEL, APCC_OID_CAL, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
206
        { "calibrate.start", 0, APCC_CAL_DO, APCC_OID_CAL, "", SU_TYPE_CMD | SU_FLAG_OK, NULL },
 
207
 
 
208
        /* end of structure. */
 
209
        { NULL, 0, 0, NULL, NULL, 0, NULL }
 
210
};