device: Added proc and mem support TPLink JetStream devices #5462 (#5817)

This commit is contained in:
Neil Lathwood
2017-02-09 08:46:59 +00:00
committed by GitHub
parent 585a4a6736
commit f7d65d0ee2
6 changed files with 350 additions and 0 deletions

View File

@@ -2,6 +2,8 @@ os: jetstream
text: 'TP-Link JetStream'
type: network
icon: tplink
mib_dir:
- tplink
discovery:
- sysObjectId:
- .1.3.6.1.4.1.11863.5.34

View File

@@ -0,0 +1,41 @@
<?php
/**
* jetstream.inc.php
*
* LibreNMS mempool discovery module for jetstream
*
* 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 <neil@lathwood.co.uk>
*/
if ($device['os'] === 'jetstream') {
$data = snmpwalk_cache_oid($device, 'tpSysMonitorMemoryTable', array(), 'TPLINK-SYSMONITOR-MIB', 'hp');
foreach ($data as $index => $item) {
if (is_numeric($item['tpSysMonitorMemoryUtilization'])) {
$descr = "Memory #$index";
discover_mempool($valid_mempool, $device, $index, 'jetstream', $descr, '1');
}
}
}
unset(
$data,
$descr,
$index,
$item
);

View File

@@ -0,0 +1,45 @@
<?php
/**
* jetstream.inc.php
*
* LibreNMS processor discovery module for jetstream
*
* 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 <neil@lathwood.co.uk>
*/
if ($device['os'] === 'jetstream') {
$data = snmpwalk_cache_oid($device, 'tpSysMonitorCpuTable', array(), 'TPLINK-SYSMONITOR-MIB', 'hp');
foreach ($data as $index => $item) {
if (is_numeric($item['tpSysMonitorCpu5Seconds'])) {
$descr = "Proc #$index";
$oid = '.1.3.6.1.4.1.11863.6.4.1.1.1.1.2.' . $index;
$usage = $item['tpSysMonitorCpu5Seconds'];
discover_processor($valid['processor'], $device, $oid, $index, 'jetstream', $descr, 1, $usage);
}
}
}
unset(
$data,
$descr,
$index,
$oid,
$item,
$usage
);

View File

@@ -0,0 +1,37 @@
<?php
/**
* jetstream.inc.php
*
* LibreNMS mempool poller module for jetstream
*
* 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 <neil@lathwood.co.uk>
*/
if ($device['os'] === 'jetstream') {
$oid = '.1.3.6.1.4.1.11863.6.4.1.2.1.1.2.' . $mempool['mempool_index'];
$used = snmp_get($device, $oid, '-OvQ');
$mempool['total'] = 100;
$mempool['free'] = ($mempool['total'] - $used);
$mempool['used'] = $used;
}
unset(
$oid,
$used
);

40
mibs/tplink/TPLINK-MIB Normal file
View File

@@ -0,0 +1,40 @@
TPLINK-MIB DEFINITIONS ::= BEGIN
--iso OBJECT IDENTIFIER ::= { 1 }
--org OBJECT IDENTIFIER ::= { iso 3 }
--dod OBJECT IDENTIFIER ::= { org 6 }
--internet OBJECT IDENTIFIER ::= { dod 1 }
--private OBJECT IDENTIFIER ::= { internet 4 }
--enterprises OBJECT IDENTIFIER ::= { private 1 }
IMPORTS
enterprises
FROM RFC1155-SMI
OBJECT-IDENTITY
FROM SNMPv2-SMI;
tplink OBJECT IDENTIFIER ::= { enterprises 11863 }
switch OBJECT IDENTIFIER ::= { tplink 1 }
router OBJECT IDENTIFIER ::= { tplink 2 }
wireless OBJECT IDENTIFIER ::= { tplink 3 }
adsl OBJECT IDENTIFIER ::= { tplink 4 }
tplinkProducts OBJECT-IDENTITY
STATUS current
DESCRIPTION
"tplinkProducts is the root OBJECT IDENTIFIER from
which sysObjectID values are assigned. Actual
values are defined in TPLINK-PRODUCTS-MIB."
::= { tplink 5 }
tplinkMgmt OBJECT-IDENTITY
STATUS current
DESCRIPTION
"tplinkMgmt is the main subtree for new mib development."
::= { tplink 6 }
END

View File

@@ -0,0 +1,185 @@
-- ============================================================================
-- Copyright(c) 2008-2012 Shenzhen TP-LINK Technologies Co.,Ltd.
--
-- FileName : tplink-sysMonitor.mib
-- Description :
-- Reference :
-- Version : 1.0
-- History :
-- V1.0 11Dec12 Created by dengjianjun
-- Original version.
-- ============================================================================
TPLINK-SYSMONITOR-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY
FROM SNMPv2-SMI
OBJECT-TYPE
FROM SNMPv2-SMI
NOTIFICATION-TYPE
FROM SNMPv2-SMI
tplinkMgmt
FROM TPLINK-MIB;
tplinkSysMonitorMIB MODULE-IDENTITY
LAST-UPDATED
"201212110930Z"
ORGANIZATION
"TPLINK"
CONTACT-INFO
"www.tplink.com.cn"
DESCRIPTION
"Private MIB for System Monitor."
::= { tplinkMgmt 4 }
tplinkSysMonitorMIBObjects OBJECT IDENTIFIER ::= { tplinkSysMonitorMIB 1 }
tpSysMonitorCpu OBJECT IDENTIFIER ::= { tplinkSysMonitorMIBObjects 1 }
tpSysMonitorCpuTable OBJECT-TYPE
SYNTAX SEQUENCE OF TPSYSMONITORCPUENTRY
MAX-ACCESS
not-accessible
STATUS
current
DESCRIPTION
"Displays the CPU utilization of all UNITs."
::= { tpSysMonitorCpu 1 }
tpSysMonitorCpuEntry OBJECT-TYPE
SYNTAX TPSYSMONITORCPUENTRY
MAX-ACCESS
not-accessible
STATUS
current
DESCRIPTION
"An entry contains of the information of CPU utilization."
INDEX
{ tpSysMonitorCpuUnitNumber }
::= { tpSysMonitorCpuTable 1 }
TPSYSMONITORCPUENTRY ::=
SEQUENCE
{
tpSysMonitorCpuUnitNumber
INTEGER,
tpSysMonitorCpu5Seconds
INTEGER,
tpSysMonitorCpu1Minute
INTEGER,
tpSysMonitorCpu5Minutes
INTEGER
}
tpSysMonitorCpuUnitNumber OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS
read-only
STATUS
current
DESCRIPTION
"Displays the UNIT number."
::= { tpSysMonitorCpuEntry 1 }
tpSysMonitorCpu5Seconds OBJECT-TYPE
SYNTAX INTEGER
(0..100)
MAX-ACCESS
read-only
STATUS
current
DESCRIPTION
"Displays the CPU utilization in 5 seconds."
::= { tpSysMonitorCpuEntry 2 }
tpSysMonitorCpu1Minute OBJECT-TYPE
SYNTAX INTEGER
(0..100)
MAX-ACCESS
read-only
STATUS
current
DESCRIPTION
"Displays the CPU utilization in 1 minute."
::= { tpSysMonitorCpuEntry 3 }
tpSysMonitorCpu5Minutes OBJECT-TYPE
SYNTAX INTEGER
(0..100)
MAX-ACCESS
read-only
STATUS
current
DESCRIPTION
"Displays the CPU utilization in 5 minutes."
::= { tpSysMonitorCpuEntry 4 }
tpSysMonitorMemory OBJECT IDENTIFIER ::= { tplinkSysMonitorMIBObjects 2 }
tpSysMonitorMemoryTable OBJECT-TYPE
SYNTAX SEQUENCE OF TPSYSMONITORMEMORYENTRY
MAX-ACCESS
not-accessible
STATUS
current
DESCRIPTION
"Displays the memory utilization of all UNITs."
::= { tpSysMonitorMemory 1 }
tpSysMonitorMemoryEntry OBJECT-TYPE
SYNTAX TPSYSMONITORMEMORYENTRY
MAX-ACCESS
not-accessible
STATUS
current
DESCRIPTION
"An entry contains of the information of memory utilization."
INDEX
{ tpSysMonitorMemoryUnitNumber }
::= { tpSysMonitorMemoryTable 1 }
TPSYSMONITORMEMORYENTRY ::=
SEQUENCE
{
tpSysMonitorMemoryUnitNumber
INTEGER,
tpSysMonitorMemoryUtilization
INTEGER
}
tpSysMonitorMemoryUnitNumber OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS
read-only
STATUS
current
DESCRIPTION
"Displays the UNIT number."
::= { tpSysMonitorMemoryEntry 1 }
tpSysMonitorMemoryUtilization OBJECT-TYPE
SYNTAX INTEGER
(0..100)
MAX-ACCESS
read-only
STATUS
current
DESCRIPTION
"Displays the memory utilization."
::= { tpSysMonitorMemoryEntry 2 }
tplinkSysMonitorNotifications OBJECT IDENTIFIER ::= { tplinkSysMonitorMIB 2 }
tpSysMonitorCpuOverLoading NOTIFICATION-TYPE
STATUS current
DESCRIPTION
"CPU utilization reached the threshold."
::= { tplinkSysMonitorNotifications 1 }
tpSysMonitorMemoryOverLoading NOTIFICATION-TYPE
STATUS current
DESCRIPTION
"Memory utilization reached the threshold."
::= { tplinkSysMonitorNotifications 2 }
END