-
Notifications
You must be signed in to change notification settings - Fork 115
Monitor
Qiao Junlong edited this page Nov 23, 2015
·
1 revision
监控器会周期性地检查logkafka的各个日志收集项是否出现异常。
Default
会监控Not Collecting或Lagging (收集卡住或太慢),并将报警信息打印到终端。
- 监控所有日志收集项
php tools/log_config.php --monitor --monitor_name=Default \
--zookeeper_connect=127.0.0.1:2181
- 监控指定了logkafka id的日志收集项
php tools/log_config.php --monitor --monitor_name=Default \
--zookeeper_connect=127.0.0.1:2181 \
--logkafka_id=test.qihoo.net
- 监控指定了logkafka id和日志路径的日志收集项
php tools/log_config.php --monitor --monitor_name=Default \
--zookeeper_connect=127.0.0.1:2181 \
--logkafka_id=test.qihoo.net \
--log_path=/usr/local/apache2/logs/access_log.%Y%m%d
创建文件tools/plugin/Monitor<YourMonitorName>.php
添加类Monitor<YourMonitorName>
,继承Monitor
,实现方法public function mon($zookeeper_connect, $logkafka_id, $path_pattern, $collectionInfo)
然后就可以通过命令行使用了。
php tools/log_config.php --monitor --monitor_name=<YourMonitorName> \
--zookeeper_connect=127.0.0.1:2181
Option | Default | Description |
---|---|---|
monitor_max_count | 0 | Specify checking max count, if setting it to 0, the monitor will keep checking |
monitor_interval_ms | 3000 | Specify checking interval. |
例子:
php tools/log_config.php --monitor --monitor_name=Default \
--monitor_max_count=3 \
--monitor_interval_ms=3000 \
--zookeeper_connect=127.0.0.1:2181