newdevice: Added support for Tycon Systems TPDIN units (#6506)

This commit is contained in:
Neil Lathwood 2017-04-28 04:16:41 +01:00 committed by Tony Murray
parent e6fa8dbd13
commit 4c42c91ba8
11 changed files with 419 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,13 @@
os: tpdin
text: 'Tycon Systems TPDIN'
type: appliance
icon: tyconsystems
over:
- { graph: sensor_voltage, text: 'Device Voltage' }
- { graph: sensor_current, text: 'Device Current' }
- { graph: sensor_temperature, text: 'Device Temperature' }
mib_dir:
- tycon
discovery:
- sysObjectId:
- .1.3.6.1.4.1.45621.2

View File

@ -0,0 +1,59 @@
<?php
/**
* tpdin.inc.php
*
* LibreNMS current discovery module for Tycon Systems TPDIN
*
* 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 2017 Neil Lathwood
* @author Neil Lathwood <gh+n@laf.io>
*/
$tpdin_oids = array(
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.9.0',
'index' => 'current1',
'descr' => 'Current 1',
'current' => $pre_cache['tpdin_monitor'][0]['current1'],
),
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.10.0',
'index' => 'current2',
'descr' => 'Current 2',
'current' => $pre_cache['tpdin_monitor'][0]['current2'],
),
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.11.0',
'index' => 'current3',
'descr' => 'Current 3',
'current' => $pre_cache['tpdin_monitor'][0]['current3'],
),
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.12.0',
'index' => 'current4',
'descr' => 'Current 4',
'current' => $pre_cache['tpdin_monitor'][0]['current4'],
),
);
foreach ($tpdin_oids as $data) {
if ($data['current'] > 0) {
discover_sensor($valid['sensor'], 'current', $device, $data['oid'], $data['index'], $device['os'], $data['descr'], 10, '1', null, null, null, null, $data['current']);
}
}
unset($tpdin_oids);

View File

@ -0,0 +1,27 @@
<?php
/**
* tpdin.inc.php
*
* LibreNMS pre-cache discovery module for Tycon Systems TPDIN
*
* 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 2017 Neil Lathwood
* @author Neil Lathwood <gh+n@laf.io>
*/
echo 'TPDIN2-MIB::monitor ';
$pre_cache['tpdin_monitor'] = snmpwalk_cache_oid($device, 'monitor', array(), 'TPDIN2-MIB');

View File

@ -0,0 +1,47 @@
<?php
/**
* tpdin.inc.php
*
* LibreNMS temperature discovery module for Tycon Systems TPDIN
*
* 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 2017 Neil Lathwood
* @author Neil Lathwood <gh+n@laf.io>
*/
$tpdin_oids = array(
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.13.0',
'index' => 'temperature1',
'descr' => 'External Temp',
'current' => $pre_cache['tpdin_monitor'][0]['temperature1'],
),
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.14.0',
'index' => 'temperature2',
'descr' => 'Internal Temp',
'current' => $pre_cache['tpdin_monitor'][0]['temperature2'],
),
);
foreach ($tpdin_oids as $data) {
if ($data['current'] > 0) {
discover_sensor($valid['sensor'], 'temperature', $device, $data['oid'], $data['index'], $device['os'], $data['descr'], 10, '1', null, null, null, null, $data['current']);
}
}
unset($tpdin_oids);

View File

@ -0,0 +1,59 @@
<?php
/**
* tpdin.inc.php
*
* LibreNMS voltage discovery module for Tycon Systems TPDIN
*
* 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 2017 Neil Lathwood
* @author Neil Lathwood <gh+n@laf.io>
*/
$tpdin_oids = array(
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.5.0',
'index' => 'voltage1',
'descr' => 'Voltage 1',
'current' => $pre_cache['tpdin_monitor'][0]['voltage1'],
),
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.6.0',
'index' => 'voltage2',
'descr' => 'Voltage 2',
'current' => $pre_cache['tpdin_monitor'][0]['voltage2'],
),
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.7.0',
'index' => 'voltage3',
'descr' => 'Voltage 3',
'current' => $pre_cache['tpdin_monitor'][0]['voltage3'],
),
array(
'oid' => '.1.3.6.1.4.1.45621.2.2.8.0',
'index' => 'voltage4',
'descr' => 'Voltage 4',
'current' => $pre_cache['tpdin_monitor'][0]['voltage4'],
),
);
foreach ($tpdin_oids as $data) {
if ($data['current'] > 0) {
discover_sensor($valid['sensor'], 'voltage', $device, $data['oid'], $data['index'], $device['os'], $data['descr'], 10, '1', null, null, null, null, $data['current']);
}
}
unset($tpdin_oids);

View File

@ -0,0 +1,31 @@
<?php
/**
* tpdin.inc.php
*
* LibreNMS OS poller module for Tycon Systems TPDIN
*
* 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 2017 Neil Lathwood
* @author Neil Lathwood <gh+n@laf.io>
*/
$tycon_data = snmp_get_multi_oid($device, 'name.0 version.0', '-OUQs', 'TPDIN2-MIB');
$hardware = $tycon_data['name.0'];
$version = $tycon_data['version.0'];
unset($tycon_data);

176
mibs/tycon/TPDIN2-MIB Normal file
View File

@ -0,0 +1,176 @@
TPDIN2-MIB DEFINITIONS ::= BEGIN
IMPORTS
OBJECT-TYPE, MODULE-IDENTITY, enterprises,
Integer32
FROM SNMPv2-SMI
DisplayString
FROM SNMPv2-TC;
tpdin2 MODULE-IDENTITY
LAST-UPDATED "201703031251Z"
ORGANIZATION
"Tycon Systems"
CONTACT-INFO
"http://www.tyconsystems.com/"
DESCRIPTION
"TPDIN Monitor Web V2 custom MIB"
::= { tycon 2 }
-- TPDIN Monitor Web V2
tycon OBJECT IDENTIFIER ::= { enterprises 45621 }
product OBJECT IDENTIFIER ::= { tpdin2 1 }
monitor OBJECT IDENTIFIER ::= { tpdin2 2 }
-- product properties
Tenths ::= TEXTUAL-CONVENTION
DISPLAY-HINT "d-1"
STATUS current
DESCRIPTION
"tenths"
SYNTAX INTEGER (0..10000)
name OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Product name."
::= { product 1 }
version OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Product version."
::= { product 2 }
builddate OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Build date."
::= { product 3 }
-- relay properties
relay1 OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"Relay 1"
::= { monitor 1 }
relay2 OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"Relay 2"
::= { monitor 2 }
relay3 OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"Relay 3"
::= { monitor 3 }
relay4 OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"Relay 4"
::= { monitor 4 }
-- monitor properties
voltage1 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Voltage 1"
::= { monitor 5 }
voltage2 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Voltage 2"
::= { monitor 6 }
voltage3 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Voltage 3"
::= { monitor 7 }
voltage4 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Voltage 4"
::= { monitor 8 }
current1 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current 1"
::= { monitor 9 }
current2 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current 2"
::= { monitor 10 }
current3 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current 3"
::= { monitor 11 }
current4 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Current 4"
::= { monitor 12 }
temperature1 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"External Temp"
::= { monitor 13 }
temperature2 OBJECT-TYPE
SYNTAX Tenths
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Internal Temp"
::= { monitor 14 }
END

View File

@ -1763,6 +1763,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('tpconductor');
}
public function testTpdin()
{
$this->checkOS('tpdin');
}
public function testTplink()
{
$this->checkOS('tplink');

View File

@ -0,0 +1,2 @@
1.3.6.1.2.1.1.1.0|4|TPDIN2
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.45621.2