mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added detection for ZTE zxdsl devices (#10344)
* add yaml files * Added include/definition/zxdsl.yaml (ZTE ZXDSL Support) Added include/polling/os/zxdsl.inc.php (Set Hardware) * Changed includes/definitions/zxdsl.yaml type from "dslam" to "network" Changed includes/polling/os/zxdsl.inc.php removed unnecessary code Added Testfiles * Fixed coding guideline errors (missing spaces) * Removed unnecessary "use" * Improved model number discovery Removed unavailable top graphs Added System temperature * Changed Temperature limits according to ZTE datasheet * Updated Tests
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
os: zxdsl
|
||||
text: 'ZXDSL'
|
||||
type: network
|
||||
icon: zte
|
||||
group: zte
|
||||
over:
|
||||
- { graph: device_bits, text: 'Device Traffic' }
|
||||
- { graph: device_temperature, text: 'Temperature' }
|
||||
discovery:
|
||||
- sysObjectID: [ .1.3.6.1.4.1.3902.1004., .1.3.6.1.4.1.3902.1015. ]
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
echo("ZTE ZXDSL:");
|
||||
|
||||
// System temperature
|
||||
$high_limit = 70;
|
||||
$high_warn_limit = 60;
|
||||
$low_warn_limit = -20;
|
||||
$low_limit = -30;
|
||||
|
||||
$descr = "System Temperature";
|
||||
$valueoid = ".1.3.6.1.4.1.3902.1004.3.1.2.1.0";
|
||||
$value = snmp_get($device, $valueoid, '-Oqv');
|
||||
$value = str_replace('"', '', $value);
|
||||
|
||||
if (is_numeric($value)) {
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'temperature',
|
||||
$device,
|
||||
$valueoid,
|
||||
0,
|
||||
'zxdsl',
|
||||
$descr,
|
||||
'1',
|
||||
'1',
|
||||
$low_limit,
|
||||
$low_warn_limit,
|
||||
$high_warn_limit,
|
||||
$high_limit,
|
||||
$value
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
if (strstr($device['sysObjectID'], '.1.3.6.1.4.1.3902.')) {
|
||||
$sysObjectId = str_replace('.1.3.6.1.4.1.3902.', '', $device['sysObjectID']);
|
||||
preg_match(
|
||||
'/.1.3.6.1.4.1.3902.(1004|1015).(.*).1.1.1/',
|
||||
$device['sysObjectID'],
|
||||
$matches,
|
||||
PREG_OFFSET_CAPTURE
|
||||
);
|
||||
|
||||
$sysObjectId = $matches[2][0];
|
||||
$sysObjectIdSplit = explode('.', $sysObjectId);
|
||||
|
||||
if (count($sysObjectIdSplit) >= 1) {
|
||||
$hardware = "ZXDSL ".$sysObjectIdSplit[0];
|
||||
if (count($sysObjectIdSplit) >= 2) {
|
||||
for ($i = 1; $i < count($sysObjectIdSplit); $i++) {
|
||||
$hardware .= chr(64+$sysObjectIdSplit[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($matches);
|
||||
unset($sysObjectId);
|
||||
unset($sysObjectIdSplit);
|
||||
}
|
||||
+54262
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user