mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
hopefully doesn't break anything Mostly issues with snmp oids and options containing spaces. Try to remove all of those. 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` After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
50 lines
2.1 KiB
PHP
50 lines
2.1 KiB
PHP
<?php
|
|
|
|
$device['sysDescr'] = str_replace('IOS (tm)', 'IOS (tm),', $device['sysDescr']);
|
|
$device['sysDescr'] = str_replace(') RELEASE', '), RELEASE', $device['sysDescr']);
|
|
|
|
echo "\n".$device['sysDescr']."\n";
|
|
|
|
list(,$features,$version) = explode(',', $device['sysDescr']);
|
|
|
|
$version = str_replace(' Version ', '', $version);
|
|
list(,$features) = explode('(', $features);
|
|
list(,$features) = explode('-', $features);
|
|
|
|
$oids = ['entPhysicalModelName.1', 'entPhysicalContainedIn.1', 'entPhysicalName.1', 'entPhysicalSoftwareRev.1', 'entPhysicalModelName.1001', 'entPhysicalContainedIn.1001', 'cardDescr.1', 'cardSlotNumber.1'];
|
|
|
|
$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
|
|
|
|
if ($data[1]['entPhysicalContainedIn'] == '0') {
|
|
if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != '') {
|
|
$version = $data[1]['entPhysicalSoftwareRev'];
|
|
}
|
|
|
|
if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != '') {
|
|
$hardware = $data[1]['entPhysicalName'];
|
|
}
|
|
|
|
if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') {
|
|
$hardware = $data[1]['entPhysicalModelName'];
|
|
}
|
|
}
|
|
|
|
list($version) = explode(',', $version);
|
|
|
|
// if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
|
|
// if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
|
|
// if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
|
|
// $ciscomodel = str_replace("\"","",$ciscomodel);
|
|
// if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
|
|
if ($hardware == '') {
|
|
$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB:ALTEON-ROOT-MIB');
|
|
}
|
|
|
|
if (strpos($device['sysDescr'], 'IOS XR')) {
|
|
list(,$version) = explode(',', $device['sysDescr']);
|
|
$version = trim($version);
|
|
list(,$version) = explode(' ', $version);
|
|
list($version) = explode("\n", $version);
|
|
trim($version);
|
|
}
|