Alarm-Mail bei fehlgeschlagenen geplanten Aufgaben und Queue-Jobs

- OperationalAlert: Log (Kanal monitoring) immer, Mail an
  MONITORING_ALERT_EMAIL (Standard EXCEPTION_MAIL), optional ntfy;
  gleiche Meldung hoechstens einmal pro Stunde
- Kernel: onFailure fuer alle geplanten Aufgaben (auch kuenftige)
- AppServiceProvider: Queue::failing
- withoutOverlapping mit kurzen Sperrdauern (10-60 Min.) statt 24 h

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin 2026-10-08 09:49:18 +00:00
parent fdbb4f3853
commit c9cd17a41a
7 changed files with 300 additions and 4 deletions

View file

@ -6,9 +6,12 @@ use App\Services\Backoffice\BackofficeDashboardService;
use App\Services\Payment\Payone\PayonePaymentService;
use App\Services\Payment\Stripe\StripeClientWrapper;
use App\Services\Util;
use App\Support\OperationalAlert;
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Illuminate\Foundation\Console\AboutCommand;
use Illuminate\Pagination\Paginator;
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
@ -30,6 +33,14 @@ class AppServiceProvider extends ServiceProvider
URL::forceScheme('https');
}
Queue::failing(function (JobFailed $event): void {
OperationalAlert::send('Queue-Job fehlgeschlagen: '.$event->job->resolveName(), [
'connection' => $event->connectionName,
'queue' => $event->job->getQueue(),
'exception' => $event->exception->getMessage(),
]);
});
AboutCommand::add('mivita', fn (): array => [
'Version' => config('app.version') ?? 'unbekannt',
]);