-
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1319 from jimklimov/42ity-upstream-MIBs
Upstream Eaton/Powerware/MGE data mappings from 42ity/nut
- Loading branch information
Showing
16 changed files
with
1,399 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef APC_IEM_MIB_H | ||
#define APC_IEM_MIB_H | ||
|
||
/* | ||
* FIXME: The below is needed because the main driver body uses this to determine | ||
* whether a conversion from Fahrenheit to Celsius is needed (which really should | ||
* be solved in subdriver specific formatting functions, like we do in usbhid-ups | ||
* This is used in both snmp-ups.c and apc.c logics. | ||
*/ | ||
|
||
/* IEM ambient variables */ | ||
/* IEM: integrated environment monitor probe */ | ||
|
||
#define APCC_OID_IEM_TEMP ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1" | ||
#define APCC_OID_IEM_TEMP_UNIT ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.1" | ||
#define APCC_IEM_FAHRENHEIT 2 | ||
#define APCC_OID_IEM_HUMID ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.1" | ||
|
||
#endif /* APC_IEM_MIB_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* eaton-pdu-marlin-helpers.c - helper routines for eaton-pdu-marlin-mib.c | ||
* to monitor Eaton ePDUs branded as: | ||
* G2 Marlin SW / MI / MO / MA | ||
* G3 Shark SW / MI / MO / MA | ||
* | ||
* Copyright (C) 2017-2019 | ||
* Arnaud Quette <[email protected]> | ||
* Copyright (C) 2017 | ||
* Jim Klimov <[email protected]> | ||
* | ||
* Supported by Eaton <http://www.eaton.com> | ||
* and previously MGE Office Protection Systems <http://www.mgeops.com> | ||
* | ||
* 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 "config.h" /* must be the first header */ | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
|
||
#include "eaton-pdu-marlin-helpers.h" | ||
#include "dstate.h" | ||
#include "common.h" | ||
/* Allow access to temperature_unit */ | ||
#include "snmp-ups.h" | ||
|
||
/* Take string "unitsPresent" (ex: "0,3,4,5"), and count the amount | ||
* of "," separators+1 using an inline function */ | ||
long marlin_device_count_fun(const char *daisy_dev_list) | ||
{ | ||
long count = 0, i; | ||
|
||
for (i = 0; daisy_dev_list[i] != '\0'; i++) { | ||
if (daisy_dev_list[i] == ',') { | ||
/* Each comma means a new device in the list */ | ||
count ++; | ||
} | ||
} | ||
if (i > 0 && (daisy_dev_list[i - 1] != ',') ) { | ||
/* Non-empty string => at least one device, and no trailing commas */ | ||
count ++; | ||
} | ||
|
||
upsdebugx(3, "%s: counted devices in '%s', got %ld", | ||
__func__, daisy_dev_list, count); | ||
return count; | ||
} | ||
|
||
/* Temperature unit consideration: | ||
* only store the device unit, for converting to Celsius. | ||
* Don't publish the device unit, since NUT will publish | ||
* as Celsius in all cases */ | ||
const char *eaton_sensor_temperature_unit_fun(void *raw_snmp_value) | ||
{ | ||
long snmp_value = *((long*)raw_snmp_value); | ||
switch (snmp_value) { | ||
case 0: | ||
/* store the value, for temperature processing */ | ||
temperature_unit = TEMPERATURE_KELVIN; | ||
break; | ||
case 1: | ||
/* store the value, for temperature processing */ | ||
temperature_unit = TEMPERATURE_CELSIUS; | ||
break; | ||
case 2: | ||
/* store the value, for temperature processing */ | ||
temperature_unit = TEMPERATURE_FAHRENHEIT; | ||
break; | ||
default: | ||
/* store the value, for temperature processing */ | ||
temperature_unit = TEMPERATURE_UNKNOWN; | ||
break; | ||
} | ||
return "celsius"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eaton-pdu-marlin-helpers.h - helper for subdriver to monitor certain | ||
* Eaton ePDU SNMP devices with NUT | ||
* | ||
* Copyright (C) | ||
* 2017-2019 Arnaud Quette <[email protected]> | ||
* 2017 Jim Klimov <[email protected]> | ||
* | ||
* 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 | ||
*/ | ||
|
||
#ifndef EATON_EPDU_MARLIN_HELPERS_H | ||
#define EATON_EPDU_MARLIN_HELPERS_H | ||
|
||
long marlin_device_count_fun(const char *daisy_dev_list); | ||
const char *eaton_sensor_temperature_unit_fun(void *raw_snmp_value); | ||
|
||
#endif /* EATON_EPDU_MARLIN_HELPERS_H */ |
Oops, something went wrong.