[monitor] 设计应用监控的采集定义结构yml,参数定义结构yml

This commit is contained in:
tomsun28
2021-11-13 21:44:03 +08:00
parent 81aeb19573
commit 19be984dc1
10 changed files with 493 additions and 1 deletions

View File

@@ -0,0 +1,105 @@
# 监控应用类型名称(与文件名保持一致) eg: linux windows tomcat mysql aws...
app: cloud
# 参数映射map. type是参数类型: number数字, string明文字符串, secret加密字符串
# 强制固定必须参数 - host
configmap:
- key: host
type: string
- key: port
type: number
- key: username
type: string
- key: password
type: secret
- key: param1
type: string
# 指标组列表
metrics:
# 第一个监控指标组 cpu
- name: cpu
# 指标组调度优先级(0-127)越小优先级越高,优先级低的指标组会等优先级高的指标组采集完成后才会被调度,相同优先级的指标组会并行调度采集
# 优先级为0的指标组为可用性指标组,即它会被首先调度,采集成功才会继续调度其它指标组,采集失败则中断调度
priority: 0
# 指标组中的具体监控指标
fields:
# 指标信息 包括 field名称, type字段类型:number数字,string字符串, unit:指标单位
- field: usage
type: number
unit: %
- field: cores
type: number
- field: waitime
type: number
unit: s
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
aliasFields:
- core1
- core2
- usage
- allTime
- runningTime
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
calculates:
- cores=core1+core2
- usage=usage
- waitTime=allTime-runningTime
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# 当protocol为http协议时具体的采集配置
http:
# 主机host: ipv4 ipv6 域名
host: ^_^host^_^
# 端口
port: ^_^port^_^
# url请求接口路径
url: /cpu
# 请求方式 GET POST PUT DELETE PATCH
method: GET
# 是否启用ssl/tls,即是http还是https,默认false
ssl: false
# 请求头内容
headers:
apiVersion: 'v1'
# 请求参数内容
params:
- param1: param1
- param2: param2
# 认证
authorization:
# 认证方式: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# 响应数据解析方式: default-系统规则,json_path-jsonPath脚本,xml_path-xmlPath脚本,prometheus-Prometheus数据规则
parseType: jsonPath
parseScript: "$.cpu[:1].*"
- name: memory
priority: 1
fields:
- field: total
type: number
unit: kb
- field: usage
type: number
unit: %
- field: speed
type: number
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: /memory
method: GET
headers:
apiVersion: 'v1'
params:
- param1: param1
- param2: param2
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: "$.memory[:1].*"

View File

@@ -0,0 +1,23 @@
# 监控应用类型名称(与文件名保持一致) eg: linux windows tomcat mysql aws...
app: cloud
# 强制固定必须参数 - host(ipv4,ipv6,域名)
param:
# field-字段名称标识符 type-字段类型,样式(大部分映射input标签type属性)
- field: host
type: host
- field: port
type: number
# 当type为number时,用range表示范围
range: 0-255
- field: username
type: text
# 当type为text时,用limit表示字符串限制大小
limit: 20
- field: password
type: password
- field: param1
type: radio
# 当type为radio单选框,checkbox复选框时,option表示可选项值列表
option:
- param3
- param4