2008-03-12 17:12:17 +00:00
|
|
|
<?php
|
|
|
|
|
2017-09-11 15:26:41 -05:00
|
|
|
use LibreNMS\Config;
|
|
|
|
|
|
|
|
if (Config::get('enable_inventory')) {
|
2016-10-06 10:40:37 +10:00
|
|
|
// Legacy entPhysical - junos/timos/cisco
|
|
|
|
include 'includes/discovery/entity-physical/entity-physical.inc.php';
|
2008-03-12 17:12:17 +00:00
|
|
|
|
2018-04-25 02:08:06 +01:00
|
|
|
if (file_exists(Config::get('install_dir') . "/includes/discovery/entity-physical/{$device['os']}.inc.php")) {
|
|
|
|
include Config::get('install_dir') . "/includes/discovery/entity-physical/{$device['os']}.inc.php";
|
2009-05-06 16:50:51 +00:00
|
|
|
}
|
2008-03-12 17:12:17 +00:00
|
|
|
|
2019-01-20 19:24:11 +01:00
|
|
|
// Delete any entries that have not been accounted for.
|
2016-10-06 10:40:37 +10:00
|
|
|
$sql = 'SELECT * FROM `entPhysical` WHERE `device_id` = ?';
|
|
|
|
foreach (dbFetchRows($sql, [$device['device_id']]) as $test) {
|
|
|
|
$id = $test['entPhysicalIndex'];
|
|
|
|
if (! $valid[$id]) {
|
|
|
|
echo '-';
|
|
|
|
dbDelete('entPhysical', 'entPhysical_id = ?', [$test['entPhysical_id']]);
|
2015-04-17 14:59:47 -04:00
|
|
|
}
|
2016-10-06 10:40:37 +10:00
|
|
|
}
|
2017-02-08 04:54:30 +00:00
|
|
|
unset(
|
|
|
|
$sql,
|
|
|
|
$test,
|
|
|
|
$valid
|
|
|
|
);
|
2016-08-28 12:32:58 -05:00
|
|
|
} else {
|
2015-04-17 14:59:47 -04:00
|
|
|
echo 'Disabled!';
|
2015-07-13 20:10:26 +02:00
|
|
|
}//end if
|