consul
prometheus作为监控平台,连接consul服务器,当有新服务注册到consul的时候,prometheus可以自动的发现并监测。
node-exporter
可以实时监测系统的状态,以prometheus可以识别的格式输出。监测包括cpu温度,内存等等系统信息。
常用指标
CPU空闲率
sum(irate(node_cpu{mode="idle", instance="134node"}[1m])) * 100 / count_scalar(node_cpu{mode="user", instance="134node"})
注释:
instance:指的是label,具体根据实际配置,也可用正则匹配
mode : 指cpu模式,node-exporter已经抓取出来,可以在node-exporter部署ip:9100这个网址上查看, 例如:http://172.17.123.134:9100/metrics
sum()函数: 指将括号内的指标值求和
irate()函数: 指计算范围向量中时间序列的每秒钟的瞬时(per-second)速度(calculates the per-second instant rate of increase of the time series in the range vector)
count_scalar()函数 : 指将时间序列向量中的元素个数作为标量返回(returns the number of elements in a time series vector as a scalar)
网友评论