Add all the sensors

This commit is contained in:
Tony Murray
2016-10-15 00:58:19 -05:00
parent 09e888190a
commit 22dca6c103
10 changed files with 1653 additions and 1 deletions

View File

@@ -761,7 +761,6 @@ $config['modules_compat']['rfc1628']['poweralert'] = 1;
$config['modules_compat']['rfc1628']['multimatic'] = 1;
$config['modules_compat']['rfc1628']['webpower'] = 1;
$config['modules_compat']['rfc1628']['huaweiups'] = 1;
$config['modules_compat']['rfc1628']['sinetica'] = 1;
// Enable daily updates
$config['update'] = 1;

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,45 @@
<?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

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