console-agent
架构图
console-agent
特性
- Leader/Follower 进程模型,保障监控模块高可用;
- 内置进程监控探针,采集进程信息;
- 与 connection 模块维持长连接,上报监控信息与执行远程端命令
快速开始
注册应用
1. 进入系统
2. 创建应用
3. 记录 app_id 与 app_secret
安装依赖
$ npm i -S console-agent
.kagentrc.js
创建 moduleexports = "server": "http://127.0.0.1:7009" // connection 模块暴露的地址 "appid": "5" // appid "secret": "84fe6510-1340-11e9-94fa-d9a76a880c81" // secret "cluster": "localjd" // 集群名
预加载
$ node index.js --require ./node_modules/console-agent/index.js
使用
模块引入
const agent = ;
ready
Leader/Follower
模型建立以及与 Connection
的对接是异步过程。本地埋探针的操作应当使用 ready
函数确保流程启动完毕。
const getMysqlConnections = {}; agent;
埋入探针 API
agent.guage
const getMysqlConnections = {};agent
agent.counter
该操作用来统计某一时刻的数量,常用于统计连接数
const redisCounter = agent; redisCounter;redisCounter;
agent.histogram
该操作用来统计某一操作的数据分布,如 MIN
/MAX
/AVG
const redisRT = agent; redisRT;redisRT;redisRT;
agent.meter
该操作用来统计某一操作的触发频率,如 QPS
const redisQPS = agent; redisRT;redisRT;redisRT;
agent.timer
timer
是 meter
与 histogram
的封装。
const http = ; http;
LICENSE
MIT