mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: devices detected as ibmtl or generic (#7618)
* fix: devices detected as ibmtl Guess at the sysObjectID, please report if you have devices that should be ibmtl and are no longer detected. Add output of os in discovery. * Always load all os for discovery. Should be cached most of the time.
This commit is contained in:
@@ -218,6 +218,6 @@ if ($options['f'] === 'peeringdb') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($options['f'] === 'refresh_os_cache') {
|
if ($options['f'] === 'refresh_os_cache') {
|
||||||
echo 'Refreshing OS cache' . PHP_EOL;
|
echo 'Clearing OS cache' . PHP_EOL;
|
||||||
update_os_cache(true);
|
unlink(Config::get('install_dir') . '/cache/os_defs.cache');
|
||||||
}
|
}
|
||||||
|
@@ -114,8 +114,6 @@ if (!$where) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_os_cache(); // will only update if needed
|
|
||||||
|
|
||||||
$discovered_devices = 0;
|
$discovered_devices = 0;
|
||||||
|
|
||||||
if (!empty($config['distributed_poller_group'])) {
|
if (!empty($config['distributed_poller_group'])) {
|
||||||
|
@@ -1656,6 +1656,7 @@ function load_all_os($existing = false, $cached = true)
|
|||||||
/**
|
/**
|
||||||
* * Update the OS cache file cache/os_defs.cache
|
* * Update the OS cache file cache/os_defs.cache
|
||||||
* @param bool $force
|
* @param bool $force
|
||||||
|
* @return bool true if the cache was updated
|
||||||
*/
|
*/
|
||||||
function update_os_cache($force = false)
|
function update_os_cache($force = false)
|
||||||
{
|
{
|
||||||
@@ -1676,7 +1677,10 @@ function update_os_cache($force = false)
|
|||||||
|
|
||||||
file_put_contents($cache_file, serialize(Config::get('os')));
|
file_put_contents($cache_file, serialize(Config::get('os')));
|
||||||
d_echo("Done\n");
|
d_echo("Done\n");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -5,6 +5,8 @@ icon: generic
|
|||||||
over:
|
over:
|
||||||
- { graph: device_bits, text: Traffic }
|
- { graph: device_bits, text: Traffic }
|
||||||
discovery:
|
discovery:
|
||||||
- snmpget:
|
-
|
||||||
|
sysObjectId: .1.3.6.1.4.1.14851
|
||||||
|
snmpget:
|
||||||
oid: SML-MIB::product-Name.0
|
oid: SML-MIB::product-Name.0
|
||||||
value: IBM System Storage TS3500 Tape Library
|
value: IBM System Storage TS3500 Tape Library
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
|
|
||||||
$os = getHostOS($device);
|
$os = getHostOS($device);
|
||||||
|
|
||||||
if ($os != $device['os']) {
|
if ($os != $device['os']) {
|
||||||
log_event('Device OS changed ' . $device['os'] . " => $os", $device, 'system', 3);
|
log_event('Device OS changed ' . $device['os'] . " => $os", $device, 'system', 3);
|
||||||
$device['os'] = $os;
|
$device['os'] = $os;
|
||||||
@@ -12,7 +13,9 @@ if ($os != $device['os']) {
|
|||||||
load_os($device);
|
load_os($device);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Changed OS! : $os\n";
|
echo "Changed ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "OS: " . Config::getOsSetting($os, 'text') . " ($os)\n";
|
||||||
|
|
||||||
update_device_logo($device);
|
update_device_logo($device);
|
||||||
|
@@ -93,8 +93,6 @@ function logfile($string)
|
|||||||
*/
|
*/
|
||||||
function getHostOS($device)
|
function getHostOS($device)
|
||||||
{
|
{
|
||||||
global $config;
|
|
||||||
|
|
||||||
$res = snmp_get_multi_oid($device, array('SNMPv2-MIB::sysDescr.0', 'SNMPv2-MIB::sysObjectID.0'));
|
$res = snmp_get_multi_oid($device, array('SNMPv2-MIB::sysDescr.0', 'SNMPv2-MIB::sysObjectID.0'));
|
||||||
$sysDescr = isset($res['.1.3.6.1.2.1.1.1.0']) ? $res['.1.3.6.1.2.1.1.1.0'] : '';
|
$sysDescr = isset($res['.1.3.6.1.2.1.1.1.0']) ? $res['.1.3.6.1.2.1.1.1.0'] : '';
|
||||||
$sysObjectId = isset($res['.1.3.6.1.2.1.1.2.0']) ? $res['.1.3.6.1.2.1.1.2.0'] : '';
|
$sysObjectId = isset($res['.1.3.6.1.2.1.1.2.0']) ? $res['.1.3.6.1.2.1.1.2.0'] : '';
|
||||||
@@ -104,13 +102,12 @@ function getHostOS($device)
|
|||||||
$deferred_os = array(
|
$deferred_os = array(
|
||||||
'freebsd',
|
'freebsd',
|
||||||
'linux',
|
'linux',
|
||||||
'ibmtl' //only has snmpget check
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// check yaml files
|
// check yaml files
|
||||||
$os_defs = Config::get('os');
|
$os_defs = Config::get('os');
|
||||||
foreach ($os_defs as $os => $def) {
|
foreach ($os_defs as $os => $def) {
|
||||||
if (isset($def['discovery']) && !in_array($os, $deferred_os)) {
|
if (isset($def['discovery']) && !in_array($os, $deferred_os)) {
|
||||||
foreach ($def['discovery'] as $item) {
|
foreach ($def['discovery'] as $item) {
|
||||||
if (checkDiscovery($device, $item, $sysObjectId, $sysDescr)) {
|
if (checkDiscovery($device, $item, $sysObjectId, $sysDescr)) {
|
||||||
return $os;
|
return $os;
|
||||||
@@ -121,7 +118,7 @@ function getHostOS($device)
|
|||||||
|
|
||||||
// check include files
|
// check include files
|
||||||
$os = null;
|
$os = null;
|
||||||
$pattern = $config['install_dir'] . '/includes/discovery/os/*.inc.php';
|
$pattern = Config::get('install_dir') . '/includes/discovery/os/*.inc.php';
|
||||||
foreach (glob($pattern) as $file) {
|
foreach (glob($pattern) as $file) {
|
||||||
include $file;
|
include $file;
|
||||||
if (isset($os)) {
|
if (isset($os)) {
|
||||||
|
@@ -155,17 +155,19 @@ if (file_exists($install_dir . '/html/includes/authentication/'.$config['auth_me
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (module_selected('discovery', $init_modules) && !update_os_cache()) {
|
||||||
|
// load_all_os() is called by update_os_cache() if updated, no need to call twice
|
||||||
|
load_all_os();
|
||||||
|
} elseif (module_selected('web', $init_modules)) {
|
||||||
|
load_all_os(!module_selected('nodb', $init_modules));
|
||||||
|
}
|
||||||
|
|
||||||
if (module_selected('web', $init_modules)) {
|
if (module_selected('web', $init_modules)) {
|
||||||
umask(0002);
|
umask(0002);
|
||||||
if (!isset($config['title_image'])) {
|
if (!isset($config['title_image'])) {
|
||||||
$config['title_image'] = 'images/librenms_logo_'.$config['site_style'].'.svg';
|
$config['title_image'] = 'images/librenms_logo_'.$config['site_style'].'.svg';
|
||||||
}
|
}
|
||||||
require $install_dir . '/html/includes/vars.inc.php';
|
require $install_dir . '/html/includes/vars.inc.php';
|
||||||
if (module_selected('nodb', $init_modules)) {
|
|
||||||
load_all_os(false);
|
|
||||||
} else {
|
|
||||||
load_all_os(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$console_color = new Console_Color2();
|
$console_color = new Console_Color2();
|
||||||
|
@@ -1 +1,2 @@
|
|||||||
|
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.14851
|
||||||
1.3.6.1.4.1.2.6.182.3.3.1.0|4|IBM System Storage TS3500 Tape Library
|
1.3.6.1.4.1.2.6.182.3.3.1.0|4|IBM System Storage TS3500 Tape Library
|
||||||
|
Reference in New Issue
Block a user