Files
ZYZ/scripts/easyMonitorTemplate.js

28 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// config
const fs = require('fs');
module.exports = {
// I. 必须的配置
server: 'MONITOR_SERVER_URL', // 填写前一节中部署的 xtransit-server 地址
appId: 'MONITOR_ID', // 创建应用得到的应用 ID
appSecret: 'MONITOR_SECRET', // 创建应用得到的应用 Secret
// II. 比较重要的可选配置
disks: [], // 数组,配置需要监控的 disk 全路径
errors: [], // 数组,配置需要监控的 error 日志全路径
packages: [], // 数组,配置需要监控的项目依赖文件全路径
// III. 不是很重要的可选的配置
logDir: '/zyz_logs/xprofiler', // xprofiler 插件生成性能日志文件的目录,默认两者均为 os.tmpdir()
docker: false, // 默认 false, 系统数据采集会依赖当前是否是 docker 环境而进行一些特殊处理,可以手动强制指定当前实例是否为 docker 环境
ipMode: false, // 默认 false此时仅使用 hostname 作为 agentId设置为 true 后 agentId 组装形式为 ${ip}_${hostname}
libMode: false, // 默认 false此时采集如果收到 shutdown 事件会退出当前进程;如果是以第三方库的形式引用接入应用内,请将此属性设置为 true
errexp: /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/i, // 匹配错误日志起始的正则,默认为匹配到 YYYY-MM-DD HH:mm:ss 时间戳即认为是一条错误日志的起始
logger: console, // 可以传入应用日志句柄方便日志统一管理,需要实现 error, info, warn 和 debug 四个方法
logLevel: 2, // 默认内置 logger 的日志级别0 error1 info2 warning3 debug,
titles: [], // 数组,如果应用使用了 process.title 自定义了名称,可以通过配置这里上报进程数据
customAgent: () => {
const hostname = fs.readFileSync('/etc/aliashost', 'utf8').trim();
return hostname;
}
};