leankoala/healthfoundation
Composer 安装命令:
composer require leankoala/healthfoundation
包简介
A expendable health check framework for PHP
README 文档
README
The HealthCheckFoundation is an open source library that should make it easy to provide continuous health statuses for all important components in web projects. It was designed to be very extensible.
Using HealthFoundation
HealthFoundation was designed to be run standalone or within any project.
Example
Config file
This example checks if the disc space is used is less than 95 percent.
$ php bin/health.php run health.yml
The config file health.yml could look like this
format: class: Leankoala\HealthFoundation\Result\Format\Ietf\IetfFormat parameters: passedMessage: "Storage server is up and running." failureMessage: "Some problems occurred on storage server." checks: spaceUsed: check: Leankoala\HealthFoundation\Check\Device\SpaceUsedCheck identifier: space_used_check description: 'Space used on storage server' parameters: maxUsageInPercent: 95
For more information on how to use this have a look at the RunCommand.
Code
The same check as code
# health.php include_once __DIR__ . '/../vendor/autoload.php'; $foundation = new \Leankoala\HealthFoundation\HealthFoundation(); // max disc usage 95% $spaceUsedCheck = new \Leankoala\HealthFoundation\Check\Device\SpaceUsedCheck(); $spaceUsedCheck->init(95); $foundation->registerCheck( $spaceUsedCheck, 'space_used_check', 'Space used on storage server'); $runResult = $foundation->runHealthCheck(); $formatter = new \Leankoala\HealthFoundation\Result\Format\Ietf\IetfFormat( 'Storage server is up and running.', 'Some problems occurred on storage server.' ); $formatter->handle( $runResult );
Checks
Formatter
It is possible to produce any kind of health check format. At the moment the IETF standard (Health Check Response Format for HTTP APIs) is supported but there is an simple interface that can be implemented to create new formats.
Status
Implemented health checks
As this is an open source project we want everybody to submit their own checks, that is why we provide the main author of every check in this list.
- Basic
- Number
- LessThan (nils.langner@leankoala.com)
- Number
- Database
- MySQL
- Slave
- SlaveStatusField (nils.langner@leankoala.com)
- MysqlRunning (nils.langner@leankoala.com)
- Slave
- Redis
- ListLength (nils.langner@leankoala.com)
- MySQL
- Device
- SpaceUsed (nils.langner@leankoala.com)
- Uptime (nils.langner@leankoala.com)
- Docker
- Container
- ContainerIsRunningCheck (nils.langner@leankoala.com)
- Container
- Files
- Content
- NumberOfLines (nils.langner@leankoala.com)
- FileCreatedAfter (nils.langner@leankoala.com)
- FileExists (nils.langner@leankoala.com)
- Content
- Resource
- HTTP
- StatusCode (galenski@online-verlag-freiburg.de)
- HTTP
- System
- Uptime (nils.langner@leankoala.com)
- NumberProcesses (nils.langner@leankoala.com)
Ideas for health checks
- Database
- MySQL
- NumberOfReturnedElements
- Redis
- isRunning
- MySQL
- Files
- isWritable
- FileEditedAfter
- Tool
- Wordpress
- Plugins
- NumberOfOutdatedPlugins
- isOutdated
- isInsecure
- Plugins
- Wordpress
Outlook / Ideas
- Suggestions - the tool should find on its own what can be tested
- Plugins - It would be great if there where plugins/bundles for WordPress, Shopware, Symfony etc.
- History - Remember the last health status
- Action - Do something after a health check fails
leankoala/healthfoundation 适用场景与选型建议
leankoala/healthfoundation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.99k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2019 年 02 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 leankoala/healthfoundation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 leankoala/healthfoundation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9.99k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 7
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-01