Prometheus监控node-exporter常用指标含义
一、说明
最近使用Prometheus新搭建监控系统时候发现内存采集时centos6和centos7下内存监控指标采集计算公式不相同,最后采用统一计算方法并整理计算公式如下:
| 1 | 100-(node_memory_MemFree_bytes+node_memory_Cached_bytes+node_memory_Buffers_bytes)/node_memory_MemTotal_bytes*10 | 
二、node-exporter常用指标含义(参考文档)
https://www.gitbook.com/book/songjiayang/prometheus/details (Prometheus 实战)
https://github.com/1046102779/prometheus (Prometheus 非官方中文手册)
http://www.bubuko.com/infodetail-2004088.html (基于prometheus监控k8s集群)
http://www.cnblogs.com/sfnz/p/6566951.html (安装prometheus+grafana监控mysql redis kubernetes等,非docker安装)
https://github.com/kayrus/prometheus-kubernetes (prometheus-kubernetes)
https://github.com/prometheus/node_exporter (prometheus/node_exporter)
http://dockone.io/article/2579 ( Prometheus在Kubernetes下的监控实践)
https://github.com/prometheus/prometheus/releases (prometheus 下载列表)
https://github.com/prometheus/node_exporter/releases/ (node_exporter下载列表)
前提概念:
1.时间序列是指将同一统计指标的数值按其发生的时间先后顺序排列而成的数列
2.表达式
=:选择正好相等的字符串标签
!=:选择不相等的字符串标签
=~:选择匹配正则表达式的标签(或子标签)
!~:选择不匹配正则表达式的标签(或子标签)
3.时间定义
s:seconds
m:minutes
h:hours
d:days
w:weeks
y:years
注: [5m]指过去的5分钟内
4.操作符
bool
and
or
unless
on
without : without(label)在结果中移除括号内的标签和值
by : by(label)在结果中只保留括号内的标签和值
1.CPU空闲率
| 1 | 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)
2.CPU负载率
| 1 | node_load1{instance="134node"} / count by(job, instance)(count by(job, instance, cpu)(node_cpu{instance="134node"}))  | 
注释:
## node_load1 : 指1分钟内cpu平均负载,同样cpu_load5指5分钟内cpu平均负载,cpu_load15指15
分钟内cpu平均负载
## count : 指聚合向量中的每个元素(即计数)
## 待添加后续注解
3.可用内存
| 1 | node_memory_MemAvailable{instance="88node"}   | 
注释:
## node_memory_MemAvailable :Memory information field MemAvailable, node-exporter已经抓取出来,只需查询展示即可;
注意:该指标针对不同的系统是采集不同的,CentOS6.X 上就采集不到这个指标;CentOS7上可以;
4.空闲文件系统空间
| 1 2 3 | sum(node_filesystem_free{fstype="xfs",instance="88node"})  sum(node_filesystem_free{fstype="ext4",instance="134node"}) | 
## node_filesystem_free: Filesystem free space in bytes
## fstype 有如下种类:
## aufs : 指联合文件系统,用来把原本分离的两个文件系统联合在一起
## cgroup : Cgroups(控制组)是Linux内核的一个功能,用来限制、统计和分离一个进程组的资源
(CPU、内存、磁盘输入输出等)。
## tmpfs : tmpfs是一种虚拟内存文件系统,而不是块设备。
## overlay : 一个 overlay 文件系统包含两个文件系统,一个 upper 文件系统和一个 lower 文件系
统,是一种新型的联合文件系统
### proc、xfs、mqueue等等。
5.swap硬盘交换区:从硬盘到内存或从内存到硬盘,虚拟内存交换
Swap free :
| 1 | node_memory_SwapFree{instance="134node"} | 
## node_memory_SwapTotal: Memory information field SwapTotal.
## swap :类似于可以把硬盘当内存用,那么这一部分内存一般就叫做swap
Swap Usage :
| 1 | node_memory_SwapTotal{instance="134node"} - node_memory_SwapFree{instance="134node"} | 
## node_memory_SwapFree: Memory information field SwapFree
Swap I/O(in):
| 1 | rate(node_vmstat_pswpin{instance="88node"}[1m]) * 4096 or irate(node_vmstat_pswpin{instance="88node"}[5m]) * 4096 | 
Swap I/O(out):
| 1 | rate(node_vmstat_pswpout{instance="88node"}[1m]) * 4096 or irate(node_vmstat_pswpout{instance="88node"}[5m]) * 4096 | 
## vmstat :vmstat命令是最常见的Linux/Unix监控工具,可以展现给定时间间隔的服务器的状态值,
包括服务器的CPU使用率,内存使用,虚拟内存交换情况,IO读写情况。
## pswpin/s:每秒从硬盘交换区传送进入内存的次数。
## pswpout/s:每秒从内存传送到硬盘交换区的次数。
## pswpin/s、 pswpout/s描述的是与硬盘交换区相关的交换活动。交换关系到系统的效率。交换区在
硬盘上对硬盘的读,写操作比内存读,写慢得多,因此,为了提高系统效率就应该设法减少交换。
通常的作法就是加大内存,使交换区中进行的交换活动为零,或接近为零。如果swpot/s的值大
于 1,预示可能需要增加内存或减少缓冲区(减少缓冲区能够释放一部分自由内存空间)。
Swap free 率(百分百)
(node_memory_SwapFree{instance=~"$server"} /node_memory_SwapTotal{instance=~"$server"}) * 100
6.CPU使用率
| 1 | avg without (cpu) (irate(node_cpu{instance="88node", mode!="idle"}[5m])) | 
## avg : 平均值
7.网路使用情况
上传速率:
| 1 | irate(node_network_transmit_bytes{device!="lo",instance="88node"}[1m]) | 
下载速率:
| 1 | irate(node_network_receive_bytes{device!="lo",instance="88node"}[1m]) | 
## eth0: ethernet的简写,一般用于以太网接口。
## wifi0:wifi是无线局域网,因此wifi0一般指无线网络接口。
## ath0: Atheros的简写,一般指Atheros芯片所包含的无线网络接口。
## tunl0:tunl0是隧道接口,封装数据的时候使用
## lo: local的简写,一般指本地环回接口。
8.内存使用率
已用内存:(总内存-空闲内存-缓存=已使用内存)
node_memory_MemTotal{instance="88node"} -
node_memory_MemFree{instance="88node"} -
node_memory_Cached{instance="88node"} -
node_memory_Buffers{instance="88node"} -
node_memory_Slab{instance="88node"}
Buffer缓存:
node_memory_Buffers{instance="88node"}
Cached缓存:
node_memory_Cached{instance="88node"}
+ node_memory_Slab{instance="88node"}
Free空闲内存:
node_memory_MemFree{instance="88node"}
可用内存占比:
| 1 2 3 | (node_memory_MemAvailable{instance="88node"} /node_memory_MemTotal{instance="88node"}) * 100 | 
## total:总计物理内存的大小。
## Free:空闲内存有多少。
## Shared:多个进程共享的内存总额。
## Buffers:表示buffers cache的内存数量,一般对块设备的读写才需要缓冲
## Cached:表示page cached的内存数量,一般作文件系统的cached,频繁访问的文件都会被
cached。如果cached值较大,就说明cached文件数较多。如果此时IO中的bi比较小,就
说明文件系统效率比较好
## Slab:slab分配器不仅可以提供动态内存的管理功能,而且可以作为经常分配并释放的内存的缓存
## MemAvailable: Free + Buffers + Cached - 不可回收的部分。不可回收部分包括:共享内存段,
tmpfs,ramfs等
9.磁盘读写(IOPs)
磁盘每秒读取(5分钟内)
| 1 | sumby (instance) (irate(node_disk_reads_completed{instance="88node"}[5m])) | 
##node_disk_reads_completed: The total number of reads completed successfully
磁盘每秒写入(5分钟内)
| 1 | sumby (instance)(irate(node_disk_writes_completed{instance="88node"}[5m])) | 
##node_disk_writes_completed :The total number of writes completed successfully.
使用I/O的毫秒数(5分钟内)
| 1 | sumby (instance) (irate(node_disk_io_time_ms{instance="88node"}[5m])) | 
##node_disk_io_time_ms: Total Milliseconds spent doing I/Os
磁盘每秒读写总数(5分钟内)
| 1 | sumby (instance) (irate(node_disk_reads_completed{instance="88node"}[5m])) + sumby (instance) (irate(node_disk_writes_completed{instance="88node"}[5m])) | 
10.I/O Usage
磁盘读取总数(1分钟内)
| 1 | sum(irate(node_disk_bytes_read{instance="88node"}[1m])) | 
##node_disk_bytes_read : The total number of bytes read successfully(成功读取的字节数)
磁盘写入总数(1分钟内)
| 1 | sum(irate(node_disk_bytes_written{instance="88node"}[1m])) | 
##node_disk_bytes_written :The total number of bytes written successfully(成功写入的字节数)
使用I/O的毫秒数(1分钟内)
| 1 | sum(irate(node_disk_io_time_ms{instance="88node"}[1m])) | 
##node_disk_io_time_ms :Total Milliseconds spent doing I/Os.(使用IO的总毫秒数)
11.文件系统空闲空间
最低值:
| 1 | min(node_filesystem_free{fstype=~"xfs|ext4",instance="88node"} / node_filesystem_size{fstype=~"xfs|ext4",instance="88node"}) | 
最高值:
| 1 | max(node_filesystem_free{fstype=~"xfs|ext4",instance="88node"} / node_filesystem_size{fstype=~"xfs|ext4",instance="88node"}) | 
## ext4是第四代扩展文件系统(英语:Fourth EXtended filesystem,缩写为ext4)是linlli
linux下的日志文件系统,ext4的文件系统容量达到1EB,而文件容量则达到16TB
## XFS是一个64位文件系统,最大支持8EB减1字节的单个文件系统,实际部署时取决于宿主操作系
统的最大块限制。对于一个32位linux系统,文件和文件系统的大小会被限制在16TB。
原文:https://blog.csdn.net/ffzhihua/article/details/88131507
Prometheus监控node-exporter常用指标含义的更多相关文章
- node-exporter常用指标含义,比如在prometheus中查询node_load1的指标数据
		参考: https://blog.csdn.net/yjph83/article/details/84909319 https://www.gitbook.com/book/songjiayang/p ... 
- Prometheus 集成 Node Exporter
		文章首发于公众号<程序员果果> 地址:https://mp.weixin.qq.com/s/40ULB9UWbXVA21MxqnjBxw 简介 Prometheus 官方和一些第三方,已经 ... 
- 使用Prometheus监控Linux系统各项指标
		首先在Linux系统上安装一个探测器node explorer, 下载地址https://prometheus.io/docs/guides/node-exporter/ 这个探测器会定期将linux ... 
- Prometheus监控学习笔记之全面学习Prometheus
		0x00 概述 Prometheus是继Kubernetes后第2个正式加入CNCF基金会的项目,容器和云原生领域事实的监控标准解决方案.在这次分享将从Prometheus的基础说起,学习和了解Pro ... 
- Prometheus监控实战day2——监控主机和容器
		Prometheus使用exporter工具来暴露主机和应用程序上的指标,目前有很多exporter可供利用.对于收集各种主机指标数据(包括CPU.内存和磁盘),我们使用Node Exporter即可 ... 
- K8s之Prometheus监控
		目录 容器监控与报警 Prometheus prometheus简介 prometheus系统架构 prometheus 安装方式 容器方式安装prometheus operator部署 克隆项目 创 ... 
- Prometheus监控Nginx
		转载自:https://www.cnblogs.com/you-men/p/13173245.html CentOS7.3 prometheus-2.2.1.linux-amd64.tar.gz ng ... 
- 05 . Prometheus监控Nginx
		List CentOS7.3 prometheus-2.2.1.linux-amd64.tar.gz nginx-module-vts 节点名 IP 软件版本 硬件 网络 说明 Prometheus ... 
- 【开源监控】Prometheus+Node Exporter+Grafana监控linux服务器
		Prometheus Prometheus介绍 Prometheus新一代开源监控解决方案.github地址 Prometheus主要功能 多维 数据模型(时序由 metric 名字和 k/v 的 l ... 
随机推荐
- koa2  的处理请求体koa-bodyparser koa-router 的中间件的学习
			1.官网 https://www.npmjs.com/package/koa-router https://www.npmjs.com/package/koa-bodyparser 2. demo / ... 
- Spring注解详解(转)
			概述 注释配置相对于 XML 配置具有很多的优势: 它可以充分利用 Java 的反射机制获取类结构信息,这些信息可以有效减少配置的工作.如使用 JPA 注释配置 ORM 映射时,我们就不需要指定 PO ... 
- 【记录】spring boot 图片上传与显示
			问题:spring boot 使用的是内嵌的tomcat, 文件上传指定目录时不知道文件上传到哪个地方,不知道访问路径. //部署到服务器的tomcat上时通常使用这种方式request.getSer ... 
- cocos2D-X 4.0 build
			{ cmake . -G "Visual Studio 15 2017" cmake --build ./ } 
- Delphi Close、Halt、terminate、ExitProcess的区别
			Close:1.只关闭本窗体2.当Close是一个主窗体时,程序会退出.3.Close会发生FormClose事件,FormCloseQuery事件4.主窗体close以后程序就Application ... 
- idea关联git后 Git上传项目提示Push rejected: Push to origin/master was rejected解决办法
			当所有的东西都配好以后 就是不上数据 解决方案是在所属右键 点击Git BashHere后 输入:git pull origin master –allow-unrelated-historie ... 
- 每天一个Linux命令:cd(2)
			cd cd命令用来切换工作目录至dirname. 其中dirName表示法可为绝对路径或相对路径.若目录名称省略,则变换至使用者的home directory(也就是刚login时所在的目录).另外, ... 
- CSP-S2019退役记
			分两次写完思路不是很清晰. 作为一名强迫症患者我选择以后再更新一些细节…… upd 真·退役,D1T1为什么都是95分算法他们AC了我挂成了70分555555555555 普及-的题目A不掉我死了55 ... 
- phpmyadmin利用的多种方式
			关于phpmyadmin的利用方式大佬们已经总结的很好了,这里只是造轮子(便于记录学习) 确认版本 渗透测试信息搜集永远是首位(也是最重要的一步).   默认目录/doc/html/index ... 
- NX二次开发-MFC对话框获取UG界面句柄,设置MFC对话框在UG界面固定显示位置
			extern "C" DllExport void ufusr(char *param, int *retcod, int param_len) { if (UF_initiali ... 
