scottrobertson / scrutiny
一个用 PHP 编写的无差别的监控系统。您可以监控任何服务,并在其故障时将其报告到任何地方(例如 pushover.net)。
dev-master
2014-02-12 17:14 UTC
Requires
- php: >=5.3.3
- scottymeuk/pushover: dev-master
This package is not auto-updated.
Last update: 2024-09-10 05:36:02 UTC
README
一个用 PHP 编写的无差别的监控系统。监控任何服务,并报告其状态。
每个 报告器 可以订阅 事件 从 服务。有三个事件:up(上线)、down(故障)和 recovery(恢复)。服务可以收集任何想要的元数据,报告器将能够访问这些数据。这允许您收集实例统计数据。
安装
{ "require" : { "scottrobertson/scrutiny" : "dev-master" } }
<?php include __DIR__ . '/vendor/autoload.php'; $scrutiny = new \ScottRobertson\Scrutiny\Client(); // Setup Services to monitor $scrutiny->addService(new \ScottRobertson\Scrutiny\Service\Http('http://example.com')); // Set options on a service $mongodb = new \ScottRobertson\Scrutiny\Service\MongoDB(); $mongodb->setName('MongoDB'); $mongodb->setInterval(20); $mongodb->setDownMessage('ER MER GERD MORGOR ER DORN'); $scrutiny->addService($mongodb); // Setup Reporters $scrutiny->addReporter(new \ScottRobertson\Scrutiny\Reporter\Post('http://api.example.com')); $scrutiny->addReporter( new \ScottRobertson\Scrutiny\Reporter\Pushover( 'token', 'user' ) ); $scrutiny->watch();
当前服务
- MySQL
- MongoDB
- Http(检查网站是否可用)
当前报告器
- Pushover.net
- Post
示例用例
例如,如果您想监控 MySQL,您可以设置 Pushover 报告器来订阅 "down" 事件。这意味着如果 MySQL 故障,您将收到推送通知。