Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for East iStars UPS (os: istars) #10041

Merged
merged 11 commits into from May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added html/images/os/istars.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions includes/definitions/istars.yaml
@@ -0,0 +1,13 @@
os: istars
text: 'East'
icon: istars
type: power
rfc1628_compat: true
over:
- { graph: device_current, text: Current }
- { graph: device_voltage, text: Voltage }
- { graph: device_load, text: Load }
- { graph: device_power, text: Power }
discovery:
- sysObjectID:
- .1.3.6.1.4.1.40614
9 changes: 9 additions & 0 deletions includes/discovery/sensors/current/rfc1628.inc.php
Expand Up @@ -34,6 +34,9 @@
if (count($output_current) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsOutputCurrent'][0])) {
$data['upsOutputCurrent'] = $data['upsOutputCurrent'][0];
}

discover_sensor(
$valid['sensor'],
Expand Down Expand Up @@ -61,6 +64,9 @@
if (count($input_current) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsInputCurrent'][0])) {
$data['upsInputCurrent'] = $data['upsInputCurrent'][0];
}

discover_sensor(
$valid['sensor'],
Expand Down Expand Up @@ -88,6 +94,9 @@
if (count($bypass_current) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsBypassCurrent'][0])) {
$data['upsBypassCurrent'] = $data['upsBypassCurrent'][0];
}

discover_sensor(
$valid['sensor'],
Expand Down
3 changes: 3 additions & 0 deletions includes/discovery/sensors/frequency/rfc1628.inc.php
Expand Up @@ -10,6 +10,9 @@
if (count($input_freq) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsInputFrequency'][0])) {
$data['upsInputFrequency'] = $data['upsInputFrequency'][0];
}

discover_sensor(
$valid['sensor'],
Expand Down
2 changes: 1 addition & 1 deletion includes/discovery/sensors/load/rfc1628.inc.php
Expand Up @@ -7,7 +7,7 @@
foreach ($load_data as $index => $data) {
$load_oid = ".1.3.6.1.2.1.33.1.4.4.1.5.$index";

if (is_array($data['upsOutputPercentLoad'])) {
if (isset($data['upsOutputPercentLoad'][0])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this was changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, @murrant suggested it was a better way to check, so I updated all references to the upsDataFoo from is_array to isset.

$load_oid .= ".0";
$value = $data['upsOutputPercentLoad'][0];
} else {
Expand Down
9 changes: 9 additions & 0 deletions includes/discovery/sensors/power/rfc1628.inc.php
Expand Up @@ -8,6 +8,9 @@
if (count($output_power) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsOutputPower'][0])) {
$data['upsOutputPower'] = $data['upsOutputPower'][0];
}

discover_sensor(
$valid['sensor'],
Expand All @@ -34,6 +37,9 @@
if (count($input_power) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsInputTruePower'][0])) {
$data['upsInputTruePower'] = $data['upsInputTruePower'][0];
}

discover_sensor(
$valid['sensor'],
Expand All @@ -59,6 +65,9 @@
if (count($bypass_power) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsBypassPower'][0])) {
$data['upsBypassPower'] = $data['upsBypassPower'][0];
}

discover_sensor(
$valid['sensor'],
Expand Down
7 changes: 5 additions & 2 deletions includes/discovery/sensors/voltage/rfc1628.inc.php
Expand Up @@ -37,7 +37,7 @@

$upsOutputVoltage_value = $data['upsOutputVoltage'];

if (is_array($data['upsOutputVoltage'])) {
if (isset($data['upsOutputVoltage'][0])) {
$upsOutputVoltage_value = $data['upsOutputVoltage'][0];
$volt_oid .= ".0";
}
Expand Down Expand Up @@ -71,7 +71,7 @@

$upsInputVoltage_value = $data['upsInputVoltage'];

if (is_array($data['upsInputVoltage'])) {
if (isset($data['upsInputVoltage'][0])) {
$upsInputVoltage_value = $data['upsInputVoltage'][0];
$volt_oid .= ".0";
}
Expand Down Expand Up @@ -102,6 +102,9 @@
if (count($bypass_volts) > 1) {
$descr .= " Phase $index";
}
if (isset($data['upsBypassVoltage'][0])) {
$data['upsBypassVoltage'] = $data['upsBypassVoltage'][0];
}

discover_sensor(
$valid['sensor'],
Expand Down
31 changes: 31 additions & 0 deletions includes/polling/os/istars.inc.php
@@ -0,0 +1,31 @@
<?php
/**
* istars.inc.php
*
* LibreNMS os poller module for East iStars UPS
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Spencer Butler
* @author Spencer Butler <github@crooked.app>
*/

$temp_data = snmp_getnext_multi($device, 'upsIdentManufacturer upsIdentModel upsIdentUPSSoftwareVersion upsIdentAgentSoftwareVersion upsIdentAttachedDevices', '-OQUs', 'UPS-MIB');

$hardware = $temp_data['upsIdentManufacturer'] . $temp_data['upsIdentModel'];
$version = $temp_data['upsIdentAgentSoftwareVersion'] . $temp_data['upsIdentUPSSoftwareVersion'];
$features = $temp_data['upsIdentAttachedDevices'];
unset($temp_data);