[monitor]feature:support linux cpu usage,memory usage,disk free (#76)
This commit is contained in:
@@ -68,6 +68,26 @@ metrics:
|
||||
- field: context_switch
|
||||
type: 0
|
||||
unit: 个数
|
||||
- field: usage
|
||||
type: 0
|
||||
unit: '%'
|
||||
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||
aliasFields:
|
||||
- info
|
||||
- cores
|
||||
- interrupt
|
||||
- load
|
||||
- context_switch
|
||||
- idle
|
||||
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
|
||||
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
|
||||
calculates:
|
||||
- info=info
|
||||
- cores=cores
|
||||
- interrupt=interrupt
|
||||
- load=load
|
||||
- context_switch=context_switch
|
||||
- usage=100-idle
|
||||
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||
protocol: ssh
|
||||
# 当protocol为http协议时具体的采集配置
|
||||
@@ -79,7 +99,7 @@ metrics:
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}'"
|
||||
script: "LANG=C lscpu | awk -F: '/Model name/ {print $2}';awk '/processor/{core++} END{print core}' /proc/cpuinfo;uptime | sed 's/,/ /g' | awk '{for(i=NF-2;i<=NF;i++)print $i }' | xargs;vmstat 1 1 | awk 'NR==3{print $11}';vmstat 1 1 | awk 'NR==3{print $12}';vmstat 1 1 | awk 'NR==3{print $15}'"
|
||||
parseType: oneRow
|
||||
|
||||
- name: memory
|
||||
@@ -101,6 +121,25 @@ metrics:
|
||||
- field: available
|
||||
type: 0
|
||||
unit: Mb
|
||||
- field: usage
|
||||
type: 0
|
||||
unit: '%'
|
||||
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||
aliasFields:
|
||||
- total
|
||||
- used
|
||||
- free
|
||||
- buff_cache
|
||||
- available
|
||||
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
|
||||
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
|
||||
calculates:
|
||||
- total=total
|
||||
- used=used
|
||||
- free=free
|
||||
- buff_cache=buff_cache
|
||||
- available=available
|
||||
- usage=(used / total) * 100
|
||||
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||
protocol: ssh
|
||||
# 当protocol为http协议时具体的采集配置
|
||||
@@ -173,4 +212,36 @@ metrics:
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: cat /proc/net/dev | tail -n +3 | awk 'BEGIN{ print "interface_name receive_bytes transmit_bytes"} {print $1,$2,$10}'
|
||||
parseType: multiRow
|
||||
|
||||
- name: disk_free
|
||||
priority: 5
|
||||
fields:
|
||||
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||
- field: filesystem
|
||||
type: 1
|
||||
- field: used
|
||||
type: 0
|
||||
unit: Mb
|
||||
- field: available
|
||||
type: 0
|
||||
unit: Mb
|
||||
- field: usage
|
||||
type: 0
|
||||
unit: '%'
|
||||
- field: mounted
|
||||
type: 1
|
||||
instance: true
|
||||
# 监控采集使用协议 eg: sql, ssh, http, telnet, wmi, snmp, sdk
|
||||
protocol: ssh
|
||||
# 当protocol为http协议时具体的采集配置
|
||||
ssh:
|
||||
# 主机host: ipv4 ipv6 域名
|
||||
host: ^_^host^_^
|
||||
# 端口
|
||||
port: ^_^port^_^
|
||||
username: ^_^username^_^
|
||||
password: ^_^password^_^
|
||||
timeout: ^_^timeout^_^
|
||||
script: df -m | tail -n +2 | awk 'BEGIN{ print "filesystem used available usage mounted"} {print $1,$3,$4,$5,$6}'
|
||||
parseType: multiRow
|
||||
Reference in New Issue
Block a user