Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mempools, cpu and storage to some arbor devices #12444

Merged
merged 3 commits into from Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions includes/definitions/arbos.yaml
Expand Up @@ -3,6 +3,8 @@ text: ArbOS
type: network
icon: arbor
group: arbor
ifXmcbc: true
ifname: true
over:
- { graph: device_bits, text: 'Device Traffic' }
- { graph: device_processor, text: 'CPU Usage' }
Expand All @@ -11,4 +13,9 @@ discovery:
-
sysObjectID:
- .1.3.6.1.4.1.9694.1
-
sysObjectID:
- .1.3.6.1.4.1.8072.3.2.10
sysDescr:
- arbux
mib_dir: arbornet
42 changes: 42 additions & 0 deletions includes/definitions/discovery/arbos.yaml
@@ -0,0 +1,42 @@
mib: PEAKFLOW-SP-MIB:PEAKFLOW-TMS-MIB
modules:
mempools:
data:
-
percent_used: PEAKFLOW-TMS-MIB::devicePhysicalMemoryUsage
class: system
descr: 'Physical Memory'
index: 0
-
percent_used: PEAKFLOW-TMS-MIB::deviceSwapSpaceUsage
class: swap
descr: 'Swap'
index: 1
-
total: PEAKFLOW-SP-MIB::devicePhysicalMemory
used: PEAKFLOW-SP-MIB::devicePhysicalMemoryInUse
percent_used: PEAKFLOW-SP-MIB::devicePhysicalMemoryUsage
precision: 1024
class: system
descr: 'Physical'
index: 0
-
total: PEAKFLOW-SP-MIB::deviceSwapSpace
used: PEAKFLOW-SP-MIB::deviceSwapSpaceInUse
percent_used: PEAKFLOW-SP-MIB::deviceSwapSpaceUsage
precision: 1024
class: swap
descr: 'Swap'
index: 1
processors:
data:
-
oid: PEAKFLOW-TMS-MIB:deviceCpuLoadAvg5min
num_oid: '.1.3.6.1.4.1.9694.1.5.2.7.{{ $index }}'
descr: 'Load Average'
index: 0
-
oid: PEAKFLOW-SP-MIB:deviceCpuLoadAvg5min
num_oid: '.1.3.6.1.4.1.9694.1.4.2.1.2.{{ $index }}'
descr: 'Load Average'
index: 0
28 changes: 28 additions & 0 deletions includes/discovery/storage/arbos.inc.php
@@ -0,0 +1,28 @@
<?php
/**
* arbos.inc.php
*
* LibreNMS storage module for ArbOS
*
* 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 2020 Adam Bishop
* @author Adam Bishop <adam@omega.org.uk>
*/

if ($device['os'] === 'arbos' && Str::contains($device['sysDescr'], 'TMS')) {
discover_storage($valid_storage, $device, 0, 'arbos', 'arbos', 'Internal Storage', '100', '1');
}
29 changes: 29 additions & 0 deletions includes/polling/storage/arbos.inc.php
@@ -0,0 +1,29 @@
<?php
/**
* arbos.inc.php
*
* LibreNMS storage module for ArbOS
*
* 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 2020 Adam Bishop
* @author Adam Bishop <adam@omega.org.uk>
*/

$storage['size'] = 100;
$storage['used'] = snmp_get($device, 'deviceDiskUsage.0', '-OvQ', 'PEAKFLOW-TMS-MIB');
$storage['free'] = $storage['size'] - $storage['used'];
$storage['units'] = 1;
114 changes: 33 additions & 81 deletions tests/data/arbos.json
Expand Up @@ -3,104 +3,44 @@
"discovery": {
"mempools": [
{
"mempool_index": "1",
"mempool_index": "0",
"entPhysicalIndex": null,
"mempool_type": "hrstorage",
"mempool_type": "arbos",
"mempool_class": "system",
"mempool_precision": 1024,
"mempool_descr": "Physical memory",
"mempool_perc": 38,
"mempool_perc_oid": null,
"mempool_used": 12916117504,
"mempool_used_oid": ".1.3.6.1.2.1.25.2.3.1.6.1",
"mempool_free": 20723318784,
"mempool_free_oid": null,
"mempool_total": 33639436288,
"mempool_total_oid": null,
"mempool_largestfree": null,
"mempool_lowestfree": null,
"mempool_deleted": 0,
"mempool_perc_warn": 99
},
{
"mempool_index": "3",
"entPhysicalIndex": null,
"mempool_type": "hrstorage",
"mempool_class": "virtual",
"mempool_precision": 1024,
"mempool_descr": "Virtual memory",
"mempool_perc": 29,
"mempool_perc_oid": null,
"mempool_used": 19751157760,
"mempool_used_oid": ".1.3.6.1.2.1.25.2.3.1.6.3",
"mempool_free": 47541272576,
"mempool_free_oid": null,
"mempool_total": 67292430336,
"mempool_total_oid": null,
"mempool_largestfree": null,
"mempool_lowestfree": null,
"mempool_deleted": 0,
"mempool_perc_warn": 95
},
{
"mempool_index": "6",
"entPhysicalIndex": null,
"mempool_type": "hrstorage",
"mempool_class": "buffers",
"mempool_precision": 1024,
"mempool_descr": "Memory buffers",
"mempool_perc": 4,
"mempool_perc_oid": null,
"mempool_used": 1263587328,
"mempool_used_oid": ".1.3.6.1.2.1.25.2.3.1.6.6",
"mempool_free": 32375848960,
"mempool_free_oid": null,
"mempool_total": 33639436288,
"mempool_total_oid": null,
"mempool_largestfree": null,
"mempool_lowestfree": null,
"mempool_deleted": 0,
"mempool_perc_warn": 0
},
{
"mempool_index": "7",
"entPhysicalIndex": null,
"mempool_type": "hrstorage",
"mempool_class": "cached",
"mempool_precision": 1024,
"mempool_descr": "Cached memory",
"mempool_perc": 17,
"mempool_perc_oid": null,
"mempool_used": 5571452928,
"mempool_used_oid": ".1.3.6.1.2.1.25.2.3.1.6.7",
"mempool_free": 28067983360,
"mempool_descr": "Physical",
"mempool_perc": 48,
"mempool_perc_oid": ".1.3.6.1.4.1.9694.1.4.2.1.7.0",
"mempool_used": 16308727808,
"mempool_used_oid": ".1.3.6.1.4.1.9694.1.4.2.1.6.0",
"mempool_free": 17424039936,
"mempool_free_oid": null,
"mempool_total": 33639436288,
"mempool_total": 33732767744,
"mempool_total_oid": null,
"mempool_largestfree": null,
"mempool_lowestfree": null,
"mempool_deleted": 0,
"mempool_perc_warn": 0
"mempool_perc_warn": 90
},
{
"mempool_index": "10",
"mempool_index": "1",
"entPhysicalIndex": null,
"mempool_type": "hrstorage",
"mempool_type": "arbos",
"mempool_class": "swap",
"mempool_precision": 1024,
"mempool_descr": "Swap space",
"mempool_perc": 0,
"mempool_perc_oid": null,
"mempool_used": 0,
"mempool_used_oid": ".1.3.6.1.2.1.25.2.3.1.6.10",
"mempool_free": 33652994048,
"mempool_descr": "Swap",
"mempool_perc": 1,
"mempool_perc_oid": ".1.3.6.1.4.1.9694.1.4.2.1.10.0",
"mempool_used": 159662080,
"mempool_used_oid": ".1.3.6.1.4.1.9694.1.4.2.1.9.0",
"mempool_free": 26683879424,
"mempool_free_oid": null,
"mempool_total": 33652994048,
"mempool_total": 26843541504,
"mempool_total_oid": null,
"mempool_largestfree": null,
"mempool_lowestfree": null,
"mempool_deleted": 0,
"mempool_perc_warn": 10
"mempool_perc_warn": 90
}
]
},
Expand Down Expand Up @@ -2938,7 +2878,19 @@
},
"processors": {
"discovery": {
"processors": []
"processors": [
{
"entPhysicalIndex": 0,
"hrDeviceIndex": 0,
"processor_oid": ".1.3.6.1.4.1.9694.1.4.2.1.2.0",
"processor_index": "0",
"processor_type": "arbos",
"processor_usage": 531,
"processor_descr": "Load Average",
"processor_precision": 1,
"processor_perc_warn": 75
}
]
},
"poller": "matches discovery"
},
Expand Down