Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
909 B
PHP
Raw Permalink Normal View History

2022-01-30 16:28:18 -06:00
<?php
namespace App\Observers;
2022-11-09 09:47:19 +01:00
use App\Models\Eventlog;
2022-01-30 16:28:18 -06:00
use App\Models\Stp;
class StpObserver
{
/**
* Handle the Stp "updating" event.
*
* @param \App\Models\Stp $stp
* @return void
*/
public function updating(Stp $stp)
{
if ($stp->isDirty('designatedRoot')) {
2022-11-09 09:47:19 +01:00
Eventlog::log('STP designated root changed: ' . $stp->getOriginal('designatedRoot') . ' > ' . $stp->designatedRoot, $stp->device_id, 'stp', 4);
2022-01-30 16:28:18 -06:00
}
if ($stp->isDirty('rootPort')) {
2022-11-09 09:47:19 +01:00
Eventlog::log('STP root port changed: ' . $stp->getOriginal('rootPort') . ' > ' . $stp->rootPort, $stp->device_id, 'stp', 4);
2022-01-30 16:28:18 -06:00
}
if ($stp->isDirty('rootPort')) {
$time = \LibreNMS\Util\Time::formatInterval($stp->timeSinceTopologyChange);
2022-11-09 09:47:19 +01:00
Eventlog::log('STP topology changed after: ' . $time, $stp->device_id, 'stp', 4);
2022-01-30 16:28:18 -06:00
}
}
}