mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Remove Log::event (#14526)
* Remove Log::event Use the Eventlog class directly instead * wip * wip * wip * Apply fixes from StyleCI * Update Eventlog.php
This commit is contained in:
@@ -72,9 +72,9 @@ function external_exec($command)
|
||||
|
||||
if ($proc->getExitCode()) {
|
||||
if (Str::startsWith($proc->getErrorOutput(), 'Invalid authentication protocol specified')) {
|
||||
Log::event('Unsupported SNMP authentication algorithm - ' . $proc->getExitCode(), optional($device)->device_id, 'poller', Alert::ERROR);
|
||||
\App\Models\Eventlog::log('Unsupported SNMP authentication algorithm - ' . $proc->getExitCode(), optional($device)->device_id, 'poller', Alert::ERROR);
|
||||
} elseif (Str::startsWith($proc->getErrorOutput(), 'Invalid privacy protocol specified')) {
|
||||
Log::event('Unsupported SNMP privacy algorithm - ' . $proc->getExitCode(), optional($device)->device_id, 'poller', Alert::ERROR);
|
||||
\App\Models\Eventlog::log('Unsupported SNMP privacy algorithm - ' . $proc->getExitCode(), optional($device)->device_id, 'poller', Alert::ERROR);
|
||||
}
|
||||
d_echo('Exitcode: ' . $proc->getExitCode());
|
||||
d_echo($proc->getErrorOutput());
|
||||
|
||||
@@ -154,7 +154,7 @@ function discover_device(&$device, $force_module = false)
|
||||
} catch (Throwable $e) {
|
||||
// isolate module exceptions so they don't disrupt the polling process
|
||||
Log::error("%rError discovering $module module for {$device['hostname']}.%n $e", ['color' => true]);
|
||||
Log::event("Error discovering $module module. Check log file for more details.", $device['device_id'], 'discovery', Alert::ERROR);
|
||||
\App\Models\Eventlog::log("Error discovering $module module. Check log file for more details.", $device['device_id'], 'discovery', Alert::ERROR);
|
||||
report($e);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,12 +68,12 @@ if ($vlanversion == 'version1' || $vlanversion == '2') {
|
||||
|
||||
//vlan does not exist
|
||||
if (! $vlanDB->exists) {
|
||||
Log::event("Vlan added: $vlan_id with name $vlan_name ", $device['device_id'], 'vlan', 4);
|
||||
\App\Models\Eventlog::log("Vlan added: $vlan_id with name $vlan_name ", $device['device_id'], 'vlan', 4);
|
||||
}
|
||||
|
||||
if ($vlanDB->vlan_name != $vlan_name) {
|
||||
$vlanDB->vlan_name = $vlan_name;
|
||||
Log::event("Vlan changed: $vlan_id new name $vlan_name", $device['device_id'], 'vlan', 4);
|
||||
\App\Models\Eventlog::log("Vlan changed: $vlan_id new name $vlan_name", $device['device_id'], 'vlan', 4);
|
||||
}
|
||||
|
||||
$vlanDB->save();
|
||||
|
||||
@@ -59,11 +59,11 @@ if (isset($sIndex)) {
|
||||
]);
|
||||
|
||||
if ($vlan->isDirty('vlan_name')) {
|
||||
Log::event("Vlan id: $vId changed name to: $vName from " . $vlan->getOriginal('vlan_name'), $device['device_id'], 'vlan', 4);
|
||||
\App\Models\Eventlog::log("Vlan id: $vId changed name to: $vName from " . $vlan->getOriginal('vlan_name'), $device['device_id'], 'vlan', 4);
|
||||
}
|
||||
|
||||
if (! $vlan->exists) {
|
||||
Log::event("Vlan id: $vId: $vName added", $device['device_id'], 'vlan', 4);
|
||||
\App\Models\Eventlog::log("Vlan id: $vId: $vName added", $device['device_id'], 'vlan', 4);
|
||||
}
|
||||
|
||||
$vlan->save();
|
||||
|
||||
@@ -520,7 +520,7 @@ function log_event($text, $device = null, $type = null, $severity = 2, $referenc
|
||||
$device = $device['device_id'];
|
||||
}
|
||||
|
||||
Log::event($text, $device, $type, $severity, $reference);
|
||||
\App\Models\Eventlog::log($text, $device, $type, $severity, $reference);
|
||||
}
|
||||
|
||||
// Parse string with emails. Return array with email (as key) and name (as value)
|
||||
|
||||
@@ -27,10 +27,10 @@ if ($port) {
|
||||
if ($port->save()) {
|
||||
if (empty($speed)) {
|
||||
$port->device->forgetAttrib('ifSpeed:' . $port->ifName);
|
||||
Log::event("{$port->ifName} Port speed cleared manually", $port->device, 'interface', 3, $port_id);
|
||||
\App\Models\Eventlog::log("{$port->ifName} Port speed cleared manually", $port->device, 'interface', 3, $port_id);
|
||||
} else {
|
||||
$port->device->setAttrib('ifSpeed:' . $port->ifName, 1);
|
||||
Log::event("{$port->ifName} Port speed set manually: $speed", $port->device, 'interface', 3, $port_id);
|
||||
\App\Models\Eventlog::log("{$port->ifName} Port speed set manually: $speed", $port->device, 'interface', 3, $port_id);
|
||||
$port_tune = $port->device->getAttrib('ifName_tune:' . $port->ifName);
|
||||
$device_tune = $port->device->getAttrib('override_rrdtool_tune');
|
||||
if ($port_tune == 'true' ||
|
||||
|
||||
@@ -341,7 +341,7 @@ function poll_device($device, $force_module = false)
|
||||
} catch (Throwable $e) {
|
||||
// isolate module exceptions so they don't disrupt the polling process
|
||||
Log::error("%rError polling $module module for {$device['hostname']}.%n $e", ['color' => true]);
|
||||
Log::event("Error polling $module module. Check log file for more details.", $device['device_id'], 'poller', Alert::ERROR);
|
||||
\App\Models\Eventlog::log("Error polling $module module. Check log file for more details.", $device['device_id'], 'poller', Alert::ERROR);
|
||||
report($e);
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ function update_application($app, $response, $metrics = [], $status = '')
|
||||
$event_msg = 'has UNKNOWN state';
|
||||
break;
|
||||
}
|
||||
Log::event('Application ' . $app->displayName() . ' ' . $event_msg, DeviceCache::getPrimary(), 'application', $severity);
|
||||
\App\Models\Eventlog::log('Application ' . $app->displayName() . ' ' . $event_msg, DeviceCache::getPrimary(), 'application', $severity);
|
||||
}
|
||||
|
||||
$app->save();
|
||||
|
||||
Reference in New Issue
Block a user