Skip to content

Commit

Permalink
newdevice: Added CPU and Memory pool for BDCom Switchs (#6523)
Browse files Browse the repository at this point in the history
* Added feature CPU and Memory monitoring on BDCom switchs

* Added feature CPU and Memory monitoring on BDCom switchs, plus pre-commit check

* Added mib files, and modification given by laf

* Replaced png logo with a svg version. Modification in the validation of processor discovery.

* Replaced png logo with a svg version. Modification in the validation of processor discovery + added files.
  • Loading branch information
kakopedreros authored and laf committed May 2, 2017
1 parent 2f5a174 commit 233f8e8
Show file tree
Hide file tree
Showing 120 changed files with 40,255 additions and 4 deletions.
Binary file removed html/images/os/bdcom.png
Binary file not shown.
114 changes: 114 additions & 0 deletions html/images/os/bdcom.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion includes/definitions/bdcom.yaml
@@ -1,5 +1,5 @@
os: bdcom
text: 'Calix E7'
text: 'BDCOM(tm) Software'
type: network
icon: bdcom
over:
Expand Down
30 changes: 30 additions & 0 deletions includes/discovery/mempools/bdcom.inc.php
@@ -0,0 +1,30 @@
<?php
/*
*
* LibreNMS mempools discovery module for BDCom switches
*
* 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.
* @package LibreNMS
* @subpackage discovery
* @link http://librenms.org
* @copyright 2017 Carlos A. Pedreros Lizama
* @author Carlos A. Pedreros Lizama <carlos.pedreros@gmail.com>
*/

if ($device['os'] == 'bdcom') {
echo 'BDCOM, NMS-MEMORY-POOL-MIB: ';

$memory_pool = snmp_get_multi_oid($device, 'nmsMemoryPoolTotalMemorySize.0 nmsMemoryPoolUtilization.0', '-OQUs', 'NMS-MEMORY-POOL-MIB');

$total = $memory_pool['nmsMemoryPoolTotalMemorySize.0'];
$perc = $memory_pool['nmsMemoryPoolUtilization.0'];

if (is_numeric($total) && is_numeric($perc)) {
discover_mempool($valid_mempool, $device, 0, 'bdcom', 'Memory', '1', null, null);
}
}
29 changes: 29 additions & 0 deletions includes/discovery/processors/bdcom.inc.php
@@ -0,0 +1,29 @@
<?php
/*
*
* LibreNMS processors discovery module for BDCom switches
*
* 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.
* @package LibreNMS
* @subpackage discovery
* @link http://librenms.org
* @copyright 2017 Carlos A. Pedreros Lizama
* @author Carlos A. Pedreros Lizama <carlos.pedreros@gmail.com>
*/

if ($device['os'] == 'bdcom') {
echo 'BDCOM, NMS-PROCESS-MIB: ';

$usage = snmp_get($device, 'nmspmCPUTotal5min.1', '-Ovq', 'NMS-PROCESS-MIB');

if (is_numeric($usage['nmspmCPUTotal5min.1'])) {
discover_processor($valid['processor'], $device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min.1', '0', 'bdcom', 'CPU', '1', $usage, null, null);
}
}

unset($processors_array);
26 changes: 26 additions & 0 deletions includes/polling/mempools/bdcom.inc.php
@@ -0,0 +1,26 @@
<?php
/*
*
* LibreNMS mempools polling module for BDCom switches
*
* 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.
* @package LibreNMS
* @subpackage polling
* @link http://librenms.org
* @copyright 2017 Carlos A. Pedreros Lizama
* @author Carlos A. Pedreros Lizama <carlos.pedreros@gmail.com>
*/

echo 'BDCOM Memory Pool';

$memory_pool = snmp_get_multi_oid($device, 'nmsMemoryPoolTotalMemorySize.0 nmsMemoryPoolUtilization.0', '-OQUs', 'NMS-MEMORY-POOL-MIB');

$mempool['total'] = $memory_pool['nmsMemoryPoolTotalMemorySize.0'];
$mempool['perc'] = $memory_pool['nmsMemoryPoolUtilization.0'];
$mempool['used'] = ($mempool['total'] / 100 * $mempool['perc']);
$mempool['free'] = ($mempool['total'] - $mempool['used']);
6 changes: 3 additions & 3 deletions includes/polling/os/bdcom.inc.php
@@ -1,13 +1,13 @@
<?php

/**
/*
BDCOM(tm) S2524C Software, Version 2.1.0A Build 5721
Compiled: 2011-11-1 15:57:26 by SYS
ROM: System Bootstrap,Version 0.3.2,Serial num:27072980
**/
*/

preg_match('/BDCOM\(tm\) ([A-Z0-9]+) Software, Version (.*)\nCompiled: (.*)\n(.*),Serial num:([0-9]+)/', $poll_device['sysDescr'], $matches);
$hardware = $matches['1'];

$hardware = $matches['1'];
$version = $matches['2'];
$serial = $matches['5'];

0 comments on commit 233f8e8

Please sign in to comment.