File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 3434use App \Facades \DeviceCache ;
3535use App \Facades \LibrenmsConfig ;
3636use App \Facades \Rrd ;
37- use App \Models \Alert ;
3837use App \Models \AlertTransport ;
3938use App \Models \ApplicationMetric ;
4039use App \Models \Eventlog ;
40+ use Illuminate \Support \Facades \DB ;
41+ use Illuminate \Support \Facades \Log ;
4142use LibreNMS \Alerting \QueryBuilderParser ;
4243use LibreNMS \Enum \AlertState ;
4344use LibreNMS \Enum \MaintenanceStatus ;
@@ -510,11 +511,17 @@ public function runAlerts()
510511 $ alert ['details ' ]['count ' ] = 0 ;
511512 }
512513
513- $ status_check = Alert:: where ('alerts.device_id ' , $ alert [ ' device_id ' ] )
514+ $ status_check = DB :: table ('alerts ' )
514515 ->where ('alerts.rule_id ' , $ alert ['rule_id ' ])
515- ->join ('devices ' , 'alerts.device_id ' , '= ' , 'devices.device_id ' )
516+ ->leftJoin ('devices ' , 'alerts.device_id ' , '= ' , 'devices.device_id ' )
516517 ->first (['alerts.alerted ' , 'devices.ignore ' , 'devices.disabled ' ]);
517518
519+ if ($ status_check === null ) {
520+ Log::error ('Alert rule not found ' );
521+
522+ return ;
523+ }
524+
518525 if ($ status_check ->alerted == $ alert ['state ' ]) {
519526 $ noiss = true ;
520527 }
You can’t perform that action at this time.
0 commit comments