Laravel Health is a package by Spatie to monitor the health of your applications. You accomplish this by configuring one or more of the available checks (or creating a custom check). At the time of release, Spatie's Health package has the following checks:
- CPU Load
- Database Connection
- Debug Mode
- Environment
- Flare Error Count
- Horizon
- MeiliSearch
- Ping
- Redis
- Schedule
- Used Disk Space
Here's an example of how you'd register a check as seen in the documentation:
1use Spatie\Health\Facades\Health;2use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck;3 4Health::checks([5 UsedDiskSpaceCheck::new()6 ->warnWhenUsedSpaceIsAbovePercentage(70)7 ->failWhenUsedSpaceIsAbovePercentage(90),8]);
Given the above disk space check, when used space is above 90%, the health package will send a notification via email, Slack, or Oh Dear! Spatie Health automatically throttles notifications so that you'll only receive one notification per hour by default, or you can configure a custom throttling timeframe in minutes.
Lastly, you can view health statuses via a web browser UI provided by this package, from the CLI, or as JSON.
You can learn more about this package, get full installation instructions, and view the source code on GitHub. Also, read A Laravel package to monitor the health of your application for more background on the package.
0 comments:
Post a Comment
Thanks