|
5 | 5 | use App\Console\Commands\MaintenanceFetchOuis; |
6 | 6 | use App\Console\Commands\MaintenanceFetchRSS; |
7 | 7 | use App\Jobs\PingCheck; |
| 8 | +use App\Models\Eventlog; |
8 | 9 | use Illuminate\Support\Facades\Artisan; |
9 | 10 | use Illuminate\Support\Facades\Cache; |
| 11 | +use Illuminate\Support\Facades\Config; |
10 | 12 | use Illuminate\Support\Facades\Schedule; |
| 13 | +use LibreNMS\Enum\Severity; |
11 | 14 | use LibreNMS\Util\Time; |
12 | 15 | use Symfony\Component\Process\Process; |
13 | 16 |
|
|
178 | 181 | Schedule::command(MaintenanceFetchOuis::class) |
179 | 182 | ->weeklyOn(0, Time::pseudoRandomBetween('01:00', '01:59')) |
180 | 183 | ->onOneServer() |
181 | | - ->appendOutputTo($maintenance_log_file); |
| 184 | + ->appendOutputTo($maintenance_log_file) |
| 185 | + ->onFailure(fn () => Eventlog::log('The scheduled command maintenance:fetch-ouis failed to run. Check the maintenance.log for details.', null, 'maintenance', Severity::Error)); |
182 | 186 |
|
183 | 187 | Schedule::command(MaintenanceCleanupNetworks::class) |
184 | 188 | ->weeklyOn(0, Time::pseudoRandomBetween('02:00', '02:59')) |
185 | 189 | ->onOneServer() |
186 | | - ->appendOutputTo($maintenance_log_file); |
| 190 | + ->appendOutputTo($maintenance_log_file) |
| 191 | + ->onFailure(fn () => Eventlog::log('The scheduled command maintenance:cleanup-networks failed to run. Check the maintenance.log for details.', null, 'maintenance', Severity::Error)); |
187 | 192 |
|
188 | 193 | Schedule::command(MaintenanceFetchRSS::class) |
189 | 194 | ->dailyAt(Time::pseudoRandomBetween('03:00', '03:59')) |
190 | 195 | ->onOneServer() |
191 | | - ->appendOutputTo($maintenance_log_file); |
| 196 | + ->appendOutputTo($maintenance_log_file) |
| 197 | + ->onFailure(fn () => Eventlog::log('The scheduled command maintenance:fetch-rss failed to run. Check the maintenance.log for details.', null, 'maintenance', Severity::Error)); |
192 | 198 |
|
193 | 199 | Schedule::command(MaintenanceCleanupSyslog::class) |
194 | 200 | ->dailyAt('03:30') |
195 | 201 | ->onOneServer() |
196 | | - ->appendOutputTo($maintenance_log_file); |
| 202 | + ->appendOutputTo($maintenance_log_file) |
| 203 | + ->onFailure(fn () => Eventlog::log('The scheduled command maintenance:cleanup-syslog failed to run. Check the maintenance.log for details.', null, 'maintenance', Severity::Error)); |
0 commit comments