Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Observers;
|
|
|
|
|
2022-01-29 21:09:05 -06:00
|
|
|
use App;
|
|
|
|
use App\ApiClients\Oxidized;
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
use App\Models\Device;
|
2022-11-09 09:47:19 +01:00
|
|
|
use App\Models\Eventlog;
|
2022-02-02 14:40:45 +01:00
|
|
|
use File;
|
2023-10-06 01:53:38 +01:00
|
|
|
use LibreNMS\Config;
|
2023-08-05 12:12:36 -05:00
|
|
|
use LibreNMS\Enum\Severity;
|
2021-10-01 20:04:42 +01:00
|
|
|
use Log;
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
|
|
|
|
class DeviceObserver
|
|
|
|
{
|
2021-10-01 20:04:42 +01:00
|
|
|
/**
|
|
|
|
* Handle the device "created" event.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Device $device
|
|
|
|
* @return void
|
|
|
|
*/
|
2022-01-29 21:09:05 -06:00
|
|
|
public function created(Device $device): void
|
2021-10-01 20:04:42 +01:00
|
|
|
{
|
2023-08-05 12:12:36 -05:00
|
|
|
Eventlog::log("Device $device->hostname has been created", $device, 'system', Severity::Notice);
|
2022-01-29 21:09:05 -06:00
|
|
|
(new Oxidized)->reloadNodes();
|
2021-10-01 20:04:42 +01:00
|
|
|
}
|
|
|
|
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
/**
|
|
|
|
* Handle the device "updated" event.
|
|
|
|
*
|
2021-09-08 23:35:56 +02:00
|
|
|
* @param \App\Models\Device $device
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
* @return void
|
|
|
|
*/
|
2022-01-29 21:09:05 -06:00
|
|
|
public function updated(Device $device): void
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
{
|
|
|
|
// handle device dependency updates
|
|
|
|
if ($device->isDirty('max_depth')) {
|
|
|
|
$device->children->each->updateMaxDepth();
|
|
|
|
}
|
|
|
|
|
2021-10-03 22:45:10 -05:00
|
|
|
// log up/down status changes
|
|
|
|
if ($device->isDirty(['status', 'status_reason'])) {
|
|
|
|
$type = $device->status ? 'up' : 'down';
|
|
|
|
$reason = $device->status ? $device->getOriginal('status_reason') : $device->status_reason;
|
2023-10-06 01:53:38 +01:00
|
|
|
$polled_by = Config::get('distributed_poller') ? (' by ' . \config('librenms.node_id')) : '';
|
|
|
|
|
|
|
|
Eventlog::log(sprintf('Device status changed to %s from %s check%s.', ucfirst($type), $reason, $polled_by), $device, $type);
|
2021-10-03 22:45:10 -05:00
|
|
|
}
|
|
|
|
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
// key attribute changes
|
2021-11-17 19:23:55 -06:00
|
|
|
foreach (['os', 'sysName', 'version', 'hardware', 'features', 'serial', 'icon', 'type', 'ip'] as $attribute) {
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
if ($device->isDirty($attribute)) {
|
2023-08-05 12:12:36 -05:00
|
|
|
Eventlog::log(self::attributeChangedMessage($attribute, $device->$attribute, $device->getOriginal($attribute)), $device, 'system', Severity::Notice);
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($device->isDirty('location_id')) {
|
2023-08-05 12:12:36 -05:00
|
|
|
Eventlog::log(self::attributeChangedMessage('location', (string) $device->location, null), $device, 'system', Severity::Notice);
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-29 21:09:05 -06:00
|
|
|
/**
|
|
|
|
* Handle the device "deleted" event.
|
|
|
|
*/
|
|
|
|
public function deleted(Device $device): void
|
|
|
|
{
|
|
|
|
// delete rrd files
|
2022-02-02 14:40:45 +01:00
|
|
|
$host_dir = \Rrd::dirFromHost($device->hostname);
|
|
|
|
try {
|
|
|
|
$result = File::deleteDirectory($host_dir);
|
|
|
|
|
|
|
|
if (! $result) {
|
|
|
|
Log::debug("Could not delete RRD files for: $device->hostname");
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
Log::error("Could not delete RRD files for: $device->hostname", [$e]);
|
2022-01-29 21:09:05 -06:00
|
|
|
}
|
|
|
|
|
2023-08-05 12:12:36 -05:00
|
|
|
Eventlog::log("Device $device->hostname has been removed", 0, 'system', Severity::Notice);
|
2022-01-29 21:09:05 -06:00
|
|
|
|
|
|
|
(new Oxidized)->reloadNodes();
|
|
|
|
}
|
|
|
|
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
/**
|
|
|
|
* Handle the device "deleting" event.
|
|
|
|
*
|
2021-09-08 23:35:56 +02:00
|
|
|
* @param \App\Models\Device $device
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
* @return void
|
|
|
|
*/
|
2022-01-29 21:09:05 -06:00
|
|
|
public function deleting(Device $device): void
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
{
|
2022-01-29 21:09:05 -06:00
|
|
|
// prevent abort from the webserver
|
|
|
|
if (App::runningInConsole() === false) {
|
|
|
|
ignore_user_abort(true);
|
|
|
|
set_time_limit(0);
|
|
|
|
}
|
|
|
|
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
// delete related data
|
2022-01-29 21:09:05 -06:00
|
|
|
$device->accessPoints()->delete();
|
|
|
|
$device->alerts()->delete();
|
|
|
|
\DB::table('alert_device_map')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->alertLogs()->delete();
|
2023-09-06 16:34:39 -05:00
|
|
|
$device->applications()->forceDelete();
|
2022-01-29 21:09:05 -06:00
|
|
|
$device->attribs()->delete();
|
|
|
|
$device->availability()->delete();
|
|
|
|
$device->bgppeers()->delete();
|
|
|
|
\DB::table('bgpPeers_cbgp')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->cefSwitching()->delete();
|
|
|
|
\DB::table('ciscoASA')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->components()->delete();
|
|
|
|
\DB::table('customoids')->where('device_id', $device->device_id)->delete();
|
|
|
|
\DB::table('devices_perms')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->graphs()->delete();
|
|
|
|
\DB::table('device_group_device')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->diskIo()->delete();
|
|
|
|
$device->entityState()->delete();
|
|
|
|
$device->entityPhysical()->delete();
|
|
|
|
\DB::table('entPhysical_state')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->eventlogs()->delete();
|
|
|
|
$device->hostResources()->delete();
|
|
|
|
$device->hostResourceValues()->delete();
|
|
|
|
$device->ipsecTunnels()->delete();
|
|
|
|
$device->ipv4()->delete();
|
|
|
|
$device->ipv6()->delete();
|
|
|
|
$device->isisAdjacencies()->delete();
|
|
|
|
$device->isisAdjacencies()->delete();
|
|
|
|
$device->macs()->delete();
|
|
|
|
$device->mefInfo()->delete();
|
|
|
|
$device->mempools()->delete();
|
|
|
|
$device->mplsLsps()->delete();
|
|
|
|
$device->mplsLspPaths()->delete();
|
|
|
|
$device->mplsSaps()->delete();
|
|
|
|
$device->mplsSdps()->delete();
|
|
|
|
$device->mplsSdpBinds()->delete();
|
|
|
|
$device->mplsServices()->delete();
|
|
|
|
$device->mplsTunnelArHops()->delete();
|
|
|
|
$device->mplsTunnelCHops()->delete();
|
|
|
|
$device->muninPlugins()->delete();
|
|
|
|
\DB::table('netscaler_vservers')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->ospfAreas()->delete();
|
|
|
|
$device->ospfInstances()->delete();
|
|
|
|
$device->ospfNbrs()->delete();
|
|
|
|
$device->ospfPorts()->delete();
|
|
|
|
$device->outages()->delete();
|
|
|
|
$device->packages()->delete();
|
|
|
|
$device->portsFdb()->delete();
|
|
|
|
$device->portsNac()->delete();
|
|
|
|
\DB::table('ports_stack')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->portsStp()->delete();
|
|
|
|
$device->portsVlan()->delete();
|
|
|
|
$device->printerSupplies()->delete();
|
|
|
|
$device->processes()->delete();
|
|
|
|
$device->processors()->delete();
|
|
|
|
$device->pseudowires()->delete();
|
|
|
|
$device->routes()->delete();
|
|
|
|
$device->rServers()->delete();
|
|
|
|
$device->sensors()->delete(); // delete sensor state indexes first?
|
|
|
|
$device->services()->delete();
|
|
|
|
\DB::table('service_templates_device')->where('device_id', $device->device_id)->delete();
|
|
|
|
$device->storage()->delete();
|
|
|
|
$device->stpInstances()->delete();
|
|
|
|
$device->syslogs()->delete();
|
|
|
|
$device->tnmsNeInfo()->delete();
|
|
|
|
$device->vlans()->delete();
|
|
|
|
$device->vminfo()->delete();
|
|
|
|
$device->vrfs()->delete();
|
|
|
|
$device->vrfLites()->delete();
|
|
|
|
$device->vServers()->delete();
|
|
|
|
$device->wirelessSensors()->delete();
|
|
|
|
|
|
|
|
$device->ports()
|
|
|
|
->select(['port_id', 'device_id', 'ifIndex', 'ifName', 'ifAlias', 'ifDescr'])
|
2023-07-08 02:23:15 +09:30
|
|
|
->chunkById(100, function ($ports) {
|
2022-01-29 21:09:05 -06:00
|
|
|
foreach ($ports as $port) {
|
|
|
|
$port->delete();
|
|
|
|
}
|
|
|
|
});
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
|
|
|
|
// handle device dependency updates
|
|
|
|
$device->children->each->updateMaxDepth($device->device_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle the device "Pivot Attached" event.
|
|
|
|
*
|
2021-09-08 23:35:56 +02:00
|
|
|
* @param \App\Models\Device $device
|
|
|
|
* @param string $relationName parents or children
|
|
|
|
* @param array $pivotIds list of pivot ids
|
|
|
|
* @param array $pivotIdsAttributes additional pivot attributes
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function pivotAttached(Device $device, $relationName, $pivotIds, $pivotIdsAttributes)
|
|
|
|
{
|
|
|
|
if ($relationName == 'parents') {
|
|
|
|
// a parent attached to this device
|
|
|
|
|
|
|
|
// update the parent's max depth incase it used to be standalone
|
2022-05-16 02:57:58 -05:00
|
|
|
Device::whereIntegerInRaw('device_id', $pivotIds)->get()->each->validateStandalone();
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
|
|
|
|
// make sure this device's max depth is updated
|
|
|
|
$device->updateMaxDepth();
|
|
|
|
} elseif ($relationName == 'children') {
|
|
|
|
// a child device attached to this device
|
|
|
|
|
|
|
|
// if this device used to be standalone, we need to udpate max depth
|
|
|
|
$device->validateStandalone();
|
|
|
|
|
|
|
|
// make sure the child's max depth is updated
|
2022-05-16 02:57:58 -05:00
|
|
|
Device::whereIntegerInRaw('device_id', $pivotIds)->get()->each->updateMaxDepth();
|
Implement OS specific information discovery (#11446)
* Implement OS specific information discovery
That way it doesn't have to be fetched during polling
Also improve discovery process, os is only detected once, in the core module.
EXA is the test os, a couple improvements there.
* Use local variable, then unset it so we don't pollute.
* fix style issues
* test and other fixes
* attribute update fixes
* Update exa data, need new source data
* null missing "os" values
* fix ftos odd character
* fix ftos odd character
* only null for new style or we will reset to null every discovery
* Move device observer to own class
* Handle location, relocate event logging
* update exa e7-2 data
* update ird test data, apparently unicode is now working.
* update Linux ntc, now uses correct icon
* Only load all os on the web, also, we can't load existing the the database isn't connected.
* only for devices that have a location
* revert ftos test data apparently
* revert ird
2020-05-14 11:27:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function attributeChangedMessage($attribute, $value, $previous)
|
|
|
|
{
|
|
|
|
return trans("device.attributes.$attribute") . ': '
|
|
|
|
. (($previous && $previous != $value) ? "$previous -> " : '')
|
|
|
|
. $value;
|
|
|
|
}
|
|
|
|
}
|