mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Improve DCN Device Support (#8878)
DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [X] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926` fix #8755 I have not added test data as it would require filterting quite some LLDP/IP's etc information.
This commit is contained in:
parent
064ab1c297
commit
9ebe70e446
@ -2,6 +2,8 @@ os: dcn-software
|
||||
text: 'Digital China Networks'
|
||||
type: network
|
||||
icon: dcn
|
||||
mib_dir:
|
||||
- dcn
|
||||
over:
|
||||
- { graph: device_bits, text: 'Device Traffic' }
|
||||
- { graph: device_processor, text: 'Processor Usage' }
|
||||
|
8
includes/definitions/discovery/dcn-software.yaml
Normal file
8
includes/definitions/discovery/dcn-software.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
mib: DCN-MIB
|
||||
modules:
|
||||
processors:
|
||||
data:
|
||||
-
|
||||
oid: switchCpuUsage
|
||||
num_oid: '.1.3.6.1.4.1.6339.100.1.11.10.{{ $index }}'
|
||||
descr: CPU Usage
|
18
includes/discovery/mempools/dcn-software.inc.php
Normal file
18
includes/discovery/mempools/dcn-software.inc.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2018 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'dcn-software') {
|
||||
$usage = snmp_get($device, 'switchMemoryUsage.0', '-OvQ', 'DCN-MIB');
|
||||
if (is_numeric($usage)) {
|
||||
discover_mempool($valid_mempool, $device, 0, 'dcn-software', 'Memory Usage', '1', null, null);
|
||||
}
|
||||
}
|
17
includes/polling/mempools/dcn-software.inc.php
Normal file
17
includes/polling/mempools/dcn-software.inc.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2018 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$temp_data = snmp_get_multi_oid($device, 'switchMemorySize.0 switchMemoryBusy.0', '-OUQs', 'DCN-MIB');
|
||||
$mempool['total'] = $temp_data['switchMemorySize.0'];
|
||||
$mempool['used'] = $temp_data['switchMemoryBusy.0'];
|
||||
$mempool['free'] = $mempool['total'] - $mempool['used'];
|
||||
unset($temp_data);
|
@ -26,3 +26,10 @@
|
||||
$hardware = trim(snmp_get($device, '.1.3.6.1.4.1.6339.100.25.1.1.1.0', '-OQv'), '"');
|
||||
$version = trim(snmp_get($device, '.1.3.6.1.4.1.6339.100.25.1.1.2.0', '-OQv'), '"');
|
||||
$serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-OQv'), '"');
|
||||
|
||||
if (empty($hardware) && empty($version)) {
|
||||
$temp_data = snmp_get_multi_oid($device, 'sysHardwareVersion.0 sysSoftwareVersion.0', '-OUQs', 'DCN-MIB');
|
||||
$hardware = $temp_data['sysHardwareVersion.0'];
|
||||
$version = $temp_data['sysSoftwareVersion.0'];
|
||||
unset($temp_data);
|
||||
}
|
||||
|
22702
mibs/dcn/DCN-MIB
Normal file
22702
mibs/dcn/DCN-MIB
Normal file
File diff suppressed because it is too large
Load Diff
112
tests/data/dcn-software_s5750e.json
Normal file
112
tests/data/dcn-software_s5750e.json
Normal file
@ -0,0 +1,112 @@
|
||||
{
|
||||
"os": {
|
||||
"discovery": {
|
||||
"devices": [
|
||||
{
|
||||
"sysName": "<private>",
|
||||
"sysObjectID": ".1.3.6.1.4.1.6339.1.1.1.293",
|
||||
"sysDescr": "S5750E-16X-SI Device, Compiled Feb 01 15:18:54 2018",
|
||||
"sysContact": null,
|
||||
"version": null,
|
||||
"hardware": "",
|
||||
"features": null,
|
||||
"location": null,
|
||||
"os": "dcn-software",
|
||||
"type": "network",
|
||||
"serial": null,
|
||||
"icon": "dcn.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": {
|
||||
"devices": [
|
||||
{
|
||||
"sysName": "<private>",
|
||||
"sysObjectID": ".1.3.6.1.4.1.6339.1.1.1.293",
|
||||
"sysDescr": "S5750E-16X-SI Device, Compiled Feb 01 15:18:54 2018",
|
||||
"sysContact": "<private>",
|
||||
"version": "7.5.3.0(R0016.0036)",
|
||||
"hardware": "1.0.1",
|
||||
"features": null,
|
||||
"location": "<private>",
|
||||
"os": "dcn-software",
|
||||
"type": "network",
|
||||
"serial": "SW053110GB09000067",
|
||||
"icon": "dcn.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"processors": {
|
||||
"discovery": {
|
||||
"processors": [
|
||||
{
|
||||
"entPhysicalIndex": "0",
|
||||
"hrDeviceIndex": "0",
|
||||
"processor_oid": ".1.3.6.1.4.1.6339.100.1.11.10.0",
|
||||
"processor_index": "0",
|
||||
"processor_type": "dcn-software",
|
||||
"processor_usage": "5",
|
||||
"processor_descr": "CPU Usage",
|
||||
"processor_precision": "1",
|
||||
"processor_perc_warn": "75"
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": "matches discovery"
|
||||
},
|
||||
"mempools": {
|
||||
"discovery": {
|
||||
"mempools": [
|
||||
{
|
||||
"mempool_index": "0",
|
||||
"entPhysicalIndex": null,
|
||||
"hrDeviceIndex": null,
|
||||
"mempool_type": "dcn-software",
|
||||
"mempool_precision": "1",
|
||||
"mempool_descr": "Memory Usage",
|
||||
"mempool_perc": "0",
|
||||
"mempool_used": "0",
|
||||
"mempool_free": "0",
|
||||
"mempool_total": "0",
|
||||
"mempool_largestfree": null,
|
||||
"mempool_lowestfree": null,
|
||||
"mempool_deleted": "0",
|
||||
"mempool_perc_warn": "75"
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": {
|
||||
"mempools": [
|
||||
{
|
||||
"mempool_index": "0",
|
||||
"entPhysicalIndex": null,
|
||||
"hrDeviceIndex": null,
|
||||
"mempool_type": "dcn-software",
|
||||
"mempool_precision": "1",
|
||||
"mempool_descr": "Memory Usage",
|
||||
"mempool_perc": "81",
|
||||
"mempool_used": "218152960",
|
||||
"mempool_free": "50282496",
|
||||
"mempool_total": "268435456",
|
||||
"mempool_largestfree": null,
|
||||
"mempool_lowestfree": null,
|
||||
"mempool_deleted": "0",
|
||||
"mempool_perc_warn": "75"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"bgp-peers": {
|
||||
"discovery": {
|
||||
"devices": [
|
||||
{
|
||||
"bgpLocalAs": null
|
||||
}
|
||||
],
|
||||
"bgpPeers": [],
|
||||
"bgpPeers_cbgp": []
|
||||
},
|
||||
"poller": "matches discovery"
|
||||
}
|
||||
}
|
13
tests/snmpsim/dcn-software_s5750e.snmprec
Normal file
13
tests/snmpsim/dcn-software_s5750e.snmprec
Normal file
@ -0,0 +1,13 @@
|
||||
1.3.6.1.2.1.1.1.0|4|S5750E-16X-SI Device, Compiled Feb 01 15:18:54 2018
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.6339.1.1.1.293
|
||||
1.3.6.1.2.1.1.3.0|67|242285500
|
||||
1.3.6.1.2.1.1.4.0|4|<private>
|
||||
1.3.6.1.2.1.1.5.0|4|<private>
|
||||
1.3.6.1.2.1.1.6.0|4|<private>
|
||||
1.3.6.1.2.1.47.1.1.1.1.11.1|4|SW053110GB09000067
|
||||
1.3.6.1.4.1.6339.100.1.2.0|4|1.0.1
|
||||
1.3.6.1.4.1.6339.100.1.3.0|4|7.5.3.0(R0016.0036)
|
||||
1.3.6.1.4.1.6339.100.1.11.6.0|2|268435456
|
||||
1.3.6.1.4.1.6339.100.1.11.7.0|2|218152960
|
||||
1.3.6.1.4.1.6339.100.1.11.10.0|2|5
|
||||
1.3.6.1.4.1.6339.100.1.11.11.0|2|81
|
Loading…
Reference in New Issue
Block a user