newdevice: Added support for Sinetica UPS ¢4613

This commit is contained in:
Neil Lathwood
2016-10-17 16:55:40 +01:00
committed by GitHub
14 changed files with 1725 additions and 0 deletions

View File

@@ -1451,6 +1451,13 @@ $config['os'][$os]['icon'] = 'mge';
$config['os'][$os]['over'][0]['graph'] = 'device_current';
$config['os'][$os]['over'][0]['text'] = 'Current';
$os = 'sinetica';
$config['os'][$os]['text'] = 'Sinetica UPS';
$config['os'][$os]['group'] = 'ups';
$config['os'][$os]['type'] = 'power';
$config['os'][$os]['over'][0]['graph'] = 'device_current';
$config['os'][$os]['over'][0]['text'] = 'Current';
$os = 'mgepdu';
$config['os'][$os]['text'] = 'MGE PDU';
$config['os'][$os]['type'] = 'power';

View File

@@ -0,0 +1,28 @@
<?php
/**
* sinetica.inc.php
*
* LibreNMS os discovery module for Sinetica
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if (starts_with($sysDescr, 'Sinetica UPSController.')) {
$os = 'sinetica';
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* sinecta.php
*
* -Description-
*
* 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 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if ($device['os'] == 'sinetica') {
$charge_oid = '.1.3.6.1.4.1.13891.101.2.4.0';
$charge = snmp_get($device, $charge_oid, '-Osqnv');
if (!empty($charge)) {
$type = 'sinetica';
$index = 0;
$limit = 100;
$lowlimit = 0;
$lowwarnlimit = 10;
$descr = 'Battery Charge';
discover_sensor(
$valid['sensor'],
'charge',
$device,
$charge_oid,
$index,
$type,
$descr,
1,
1,
$lowlimit,
$lowwarnlimit,
null,
$limit,
$charge
);
}
}

View File

@@ -0,0 +1,76 @@
<?php
/**
* sinetica.inc.php
*
* -Description-
*
* 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 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if ($device['os'] == 'sinetica') {
$battery_oid = '.1.3.6.1.4.1.13891.101.2.6.0';
$battery_current = snmp_get($device, $battery_oid, '-Oqv');
if (!empty($battery_current) || $battery_current == 0) {
$divisor = 10;
$current = $battery_current / $divisor;
$descr = 'Battery';
$type = 'sinetica';
$index = '2.6.0';
discover_sensor($valid['sensor'], 'current', $device, $battery_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.3', array());
foreach ($oids as $oid => $data) {
$current_id = substr($oid, strrpos($oid, '.') + 1);
$current_oid = ".$oid";
$descr = 'Output';
if (count($oids) > 1) {
$descr .= " Phase $current_id";
}
$divisor = 100;
$current = current($data) / $divisor;
$type = 'sinetica';
$index = '4.4.1.3.'.$current_id;
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.4', array());
foreach ($oids as $oid => $data) {
$current_id = substr($oid, strrpos($oid, '.') + 1);
$current_oid = ".$oid";
$descr = 'Input';
if (count($oids) > 1) {
$descr .= " Phase $current_id";
}
$divisor = 10;
$current = current($data) / $divisor;
$type = 'sinetica';
$index = '3.3.1.3.'.$current_id;
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
}//end if

View File

@@ -0,0 +1,71 @@
<?php
/**
* sinetica.inc.php
*
* -Description-
*
* 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 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if ($device['os'] == 'sinetica') {
$output_oid = '.1.3.6.1.4.1.13891.101.4.2.0';
$output_current = snmp_get($device, $output_oid, '-Oqv');
if (!empty($output_current) || $output_current == 0) {
$divisor = 10;
$current = $output_current / $divisor;
$descr = 'Output';
$type = 'sinetica';
$index = '4.2.0';
discover_sensor($valid['sensor'], 'frequency', $device, $output_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
$bypass_oid = '.1.3.6.1.4.1.13891.101.5.1.0';
$bypass_current = snmp_get($device, $bypass_oid, '-Oqv');
if (!empty($bypass_current) || $bypass_current == 0) {
$divisor = 10;
$current = $bypass_current / $divisor;
$descr = 'Bypass';
$type = 'sinetica';
$index = '5.1.0';
discover_sensor($valid['sensor'], 'frequency', $device, $bypass_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.2', array());
foreach ($oids as $oid => $data) {
$current_id = substr($oid, strrpos($oid, '.') + 1);
$current_oid = ".$oid";
$descr = 'Input';
if (count($oids) > 1) {
$descr .= " Phase $current_id";
}
$divisor = 10;
$current = current($data) / $divisor;
$type = 'sinetica';
$index = '3.3.1.2.'.$current_id;
discover_sensor($valid['sensor'], 'frequency', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
}//end if

View File

@@ -0,0 +1,44 @@
<?php
/**
* sinetica.inc.php
*
* -Description-
*
* 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 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if ($device['os'] == 'sinetica') {
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.5', array());
foreach ($oids as $oid => $data) {
$current_id = substr($oid, strrpos($oid, '.') + 1);
$current_oid = ".$oid";
$descr = 'Output';
if (count($oids) > 1) {
$descr .= " $current_id";
}
$current = current($data);
$type = 'sinetica';
$index = '4.4.1.5.' . $current_id;
discover_sensor($valid['sensor'], 'load', $device, $current_oid, $index, $type, $descr, 1, 1, null, null, null, null, $current);
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* sinetica.inc.php
*
* -Description-
*
* 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 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if ($device['os'] == 'sinetica') {
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.4', array());
foreach ($oids as $oid => $data) {
$current_id = substr($oid, strrpos($oid, '.') + 1);
$current_oid = ".$oid";
$descr = 'Output';
if (count($oids) > 1) {
$descr .= " Phase $current_id";
}
$divisor = 10;
$current = current($data) / $divisor;
$type = 'sinetica';
$index = '4.4.1.4.' . $current_id;
discover_sensor($valid['sensor'], 'power', $device, $current_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $current);
}
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* sinetica.inc.php
*
* -Description-
*
* 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 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if ($device['os'] == 'sinetica') {
$runtime_oid = '.1.3.6.1.4.1.13891.101.2.3.0';
$runtime = snmp_get($device, $runtime_oid, '-Osqvt');
if (!empty($runtime)) {
$type = 'sinetcia';
$index = '2.3.0';
$descr = 'Runtime';
$low_limit = 5;
$low_limit_warn = 10;
discover_sensor($valid['sensor'], 'runtime', $device, $runtime_oid, $index, $type, $descr, 1, 1, $low_limit, $low_limit_warn, null, null, $runtime);
}
}//end if

View File

@@ -0,0 +1,73 @@
<?php
/**
* sinetica.inc.php
*
* -Description-
*
* 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 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
if ($device['os'] == 'sinetica') {
$battery_oid = '.1.3.6.1.4.1.13891.101.2.5.0';
$battery_current = snmp_get($device, $battery_oid, '-Oqv');
if (!empty($battery_current) || $battery_current == 0) {
$divisor = 10;
$current = $battery_current / $divisor;
$descr = 'Battery';
$type = 'sinetica';
$index = '2.5.0';
discover_sensor($valid['sensor'], 'voltage', $device, $battery_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.3', array());
foreach ($oids as $oid => $data) {
$current_id = substr($oid, strrpos($oid, '.') + 1);
$current_oid = ".$oid";
$descr = 'Output';
if (count($oids) > 1) {
$descr .= " Phase $current_id";
}
$current = current($data);
$type = 'sinetica';
$index = '3.3.1.3.'.$current_id;
discover_sensor($valid['sensor'], 'voltage', $device, $current_oid, $index, $type, $descr, 1, 1, null, null, null, null, $current);
}
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.2', array());
foreach ($oids as $oid => $data) {
$current_id = substr($oid, strrpos($oid, '.') + 1);
$current_oid = ".$oid";
$descr = 'Input';
if (count($oids) > 1) {
$descr .= " Phase $current_id";
}
$current = current($data);
$type = 'sinetica';
$index = '4.4.1.2.'.$current_id;
discover_sensor($valid['sensor'], 'voltage', $device, $current_oid, $index, $type, $descr, 1, '1', null, null, null, null, $current);
}
}//end if

View File

@@ -0,0 +1,31 @@
<?php
/**
* sinetica.inc.php
*
* LibreNMS os polling module for Sinetica
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
// Sinetica UPSController. Versions: App. 6.04.03, OS 6.3, Btldr 1.06.09, H/w ZBBNC2 Rev 1.01.06
list($os_temp, $os_ver, $btldr, $hardware_temp) = explode(', ', $poll_device['sysDescr']);
list($ignore, $version) = explode('App. ', $os_temp);
$hardware = preg_replace('/H\/w /', '', $hardware_temp);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
NET-SNMP-MIB DEFINITIONS ::= BEGIN
--
-- Top-level infrastructure of the Net-SNMP project enterprise MIB tree
--
IMPORTS
MODULE-IDENTITY, enterprises FROM SNMPv2-SMI;
netSnmp MODULE-IDENTITY
LAST-UPDATED "200201300000Z"
ORGANIZATION "www.net-snmp.org"
CONTACT-INFO
"postal: Wes Hardaker
P.O. Box 382
Davis CA 95617
email: net-snmp-coders@lists.sourceforge.net"
DESCRIPTION
"Top-level infrastructure of the Net-SNMP project enterprise MIB tree"
REVISION "200201300000Z"
DESCRIPTION
"First draft"
::= { enterprises 8072}
--
-- Net-SNMP enterprise-specific management objects
--
netSnmpObjects OBJECT IDENTIFIER ::= {netSnmp 1}
-- netSnmpExamples OBJECT IDENTIFIER ::= {netSnmp 2}
netSnmpEnumerations OBJECT IDENTIFIER ::= {netSnmp 3}
netSnmpModuleIDs OBJECT IDENTIFIER ::= {netSnmpEnumerations 1}
netSnmpAgentOIDs OBJECT IDENTIFIER ::= {netSnmpEnumerations 2}
netSnmpDomains OBJECT IDENTIFIER ::= {netSnmpEnumerations 3}
netSnmpExperimental OBJECT IDENTIFIER ::= {netSnmp 9999}
--
-- A subtree specifically designed for private testing purposes.
-- No "public" management objects should ever be defined within this tree.
--
-- It is provided for private experimentation, prior to transferring a MIB
-- structure to another part of the overall OID tree
--
netSnmpPlaypen OBJECT IDENTIFIER ::= {netSnmpExperimental 9999}
--
-- Notifications
--
netSnmpNotificationPrefix OBJECT IDENTIFIER ::= {netSnmp 4}
netSnmpNotifications OBJECT IDENTIFIER ::= {netSnmpNotificationPrefix 0}
netSnmpNotificationObjects OBJECT IDENTIFIER ::= {netSnmpNotificationPrefix 1}
--
-- Conformance
-- (No laughing at the back!)
--
netSnmpConformance OBJECT IDENTIFIER ::= {netSnmp 5}
netSnmpCompliances OBJECT IDENTIFIER ::= {netSnmpConformance 1}
netSnmpGroups OBJECT IDENTIFIER ::= {netSnmpConformance 2}
END

View File

@@ -1190,6 +1190,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('siklu');
}
public function testSinetica()
{
$this->checkOS('sinetica');
}
public function testSmartax()
{
$this->checkOS('smartax');

View File

@@ -0,0 +1,2 @@
1.3.6.1.2.1.1.1.0|4|Sinetica UPSController. Versions: App. 6.04.03, OS 6.3, Btldr 1.06.09, H/w ZBBNC2 Rev 1.01.06
1.3.6.1.2.1.1.2.0|6|.1.3.6.1.4.1.13891.101