refactor: F5 discovery cleanup

This commit is contained in:
Tony Murray
2016-09-19 08:46:19 -05:00
parent b8d085202d
commit aceb572065
3 changed files with 12 additions and 13 deletions

View File

@@ -158,18 +158,14 @@ You need to add your desired MIBs to `/opt/librenms/mibs` folder. Afterwards you
```
<?php
if (!$os || $os === 'linux') {
$f5_sys_parent = '1.3.6.1.4.1.3375.2.1';
if (strpos($sysObjectId, $f5_sys_parent)) {
$os = 'f5';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.3375.2.1')) {
$os = 'f5';
}
### MIB definition as an array
$f5_mibs = array(
"ltmVirtualServStatEntry" => "F5-BIGIP-LOCAL-MIB",
);
'ltmVirtualServStatEntry' => 'F5-BIGIP-LOCAL-MIB',
);
### Actual registering of the MIB
register_mibs($device, $f5_mibs, "includes/discovery/os/f5.inc.php");

View File

@@ -1,7 +1,5 @@
<?php
if (!$os || $os === 'linux') {
$f5_sys_parent = '1.3.6.1.4.1.3375.2.1';
if (strpos($sysObjectId, $f5_sys_parent)) {
$os = 'f5';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.3375.2.1')) {
$os = 'f5';
}

View File

@@ -126,6 +126,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('endian', 'Linux endian');
}
public function testF5()
{
$this->checkOS('f5', 'Linux', '.1.3.6.1.4.1.3375.2.1.3.4.1000');
}
public function testLinux()
{
$this->checkOS('linux', 'Linux');