首页 > 编程语言 >Mapping iostat to the node exporter’s node_disk_* metrics

Mapping iostat to the node exporter’s node_disk_* metrics

时间:2023-08-05 18:57:13浏览次数:47  
标签:node 5m exporter iostat disk rate total

参考:https://www.robustperception.io/mapping-iostat-to-the-node-exporters-node_disk_-metrics/

 

The node exporter and tools like iostat and sar use the same core data, but how do they relate to each other?

 

Prometheus metric names tend to tie pretty directly to a raw data source, so node_disk_reads_completed_total is the number of bytes written to a given disk device given by the 1st field of /proc/diskstats. It's reasonably obvious what it means just from the name. iostat -x has output like:

Device: rrqm/s wrqm/s  r/s   w/s rkB/s  wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda       0.00  8.00  0.00 15.00  0.00 342.00    45.60     0.04  2.40    0.00    2.40  0.40  0.60

Here the r/s is the number of reads per second calculated from the previous measurement iostat made (or since boot for the first one). The equivalent is rate(node_disk_reads_completed_total[5m]) in PromQL. Similarly with w/s and node_disk_writes_completed_totalrrqm/s and node_disk_reads_merged_total, and wrqm/s and node_disk_writes_merged_total.

For bandwidth, iostat will report in kilobytes by default. The kernel reports this in 512-sectors (irrelevant of the sector size of the underlying device), and Prometheus uses bytes as standard. So rkB/s and wkB/s would be rate(node_disk_read_bytes_total[5m]) and rate(node_disk_written_bytes_total[5m]) only 1024 times bigger.

avgrq-sz is the average size of each request, combining both read and write. It's calculated by iostat by dividing the bytes by the operations, so
(rate(node_disk_read_bytes_total[5m]) + rate(node_disk_written_bytes_total[5m]))
/
(rate(node_disk_reads_completed_total[5m]) + rate(node_disk_writes_completed_total[5m]))

and once again in bytes rather than kilobytes. Personally I'd rather view reads and writes separately.

avgqu-sz is simpler, the average queue length. This is based on field 11, which gives us rate(node_disk_io_time_weighted_seconds_total[5m]).

r_await and w_await are how long read and write requests took on average, so for reads that's rate(node_disk_read_time_seconds_total[5m]) / rate(node_disk_reads_completed_total[5m])and similarly for writes. await is both combined, so you can add and then divide if you want it.

%util is utilisation as a percentage, rate(node_disk_io_time_seconds_total[5m]) will produce the same as a ratio which is more standard in Prometheus. svctm is deprecated, but it'd be the IO time divided by the sum of the reads and writes completed.

There one other notable metric which iostat doesn't expose which is field 9, node_disk_io_now the number of IOs in progress. Newer kernels will also expose discard stats, useful for SSDs.

 

标签:node,5m,exporter,iostat,disk,rate,total
From: https://www.cnblogs.com/uncleyong/p/17608404.html

相关文章

  • 基于NodeJS家政保姆网站
    21世纪的今天,随着社会的不断发展与进步,人们对于信息科学化的认识,已由低层次向高层次发展,由原来的感性认识向理性认识提高,管理工作的重要性已逐渐被人们所认识,科学化的管理,使信息存储达到准确、快速、完善,并能提高工作管理效率,促进其发展。论文主要是对家政保姆网站进行了介绍,包括研......
  • nrm控制node镜像源
    nrmnpm的镜像源管理工具在国内使用npm安装镜像时,默认使用的镜像源在国外,从而导致下载慢或者失败;比较推荐的做法是切换npm的镜像源,或者使用yarn/pnpm/cnpm等工具;本文主要是切换npm镜像源的工具nrm的基本使用;安装npminrm-g //要全局安装;macos需要sudo+nrmls//查看......
  • shell 脚本:nginx jdk maven node-exporter docker-ce
     写一个脚本,本地自带nginx1.24源码包,然后自动完成安装,并加入system管理。并设置开启自启动,并启动ng。并完成对80端口的curl测试,返回状态码200打印启动正常的消息:#!/bin/bash#安装依赖sudoapt-getupdatesudoapt-getinstall-ybuild-essentialwgetcurl#下载并解......
  • Newnode's NOI(P?)模拟赛 第二题 dp决策单调优化
    其实直接暴力O(n3)DP+O2O(n^3)DP+O_2O(n3)DP+O2优化能过…CODEO(n3)O(n^3)O(n3)先来个O(n3)O(n^3)O(n3)暴力DP(开了O2O_2O2)100分代码(极限数据0.5s0.5s0.5s)#include<cstdio>#include<cstring>#include<algorithm>usingnamespacestd;......
  • k8s node节点NotReady
    问题rke加入新节点报错ERRO[0150]Failedtoupgradehosts:k8s-node03witherror[hostk8s-node03notready]FATA[0150][workerPlane]FailedtoupgradeWorkerPlane:[hostk8s-node03notready]解决思路使用kubectldescribe查看节点信息:kubectldescribenok8s-nod......
  • ubuntu18.04安装nodejs最新版、指定版 12.x 14.x
    ubuntu18.04安装nodejs最新版、指定版12.x14.x 今天准备在ubuntu服务器里面安装nodejs版本,ubuntu18.04仓库nodejs默认是8.x版本。1.通过apt安装nodejs在Ubuntu18.04的默认仓库包含了一个Node.js的版本,截至当前,该仓库的node.js版本是8.10.0。要安......
  • Linux下Nodejs安装三种方式及开发环境
    很久之前安装过windows下以及Mac下的node,感觉还是很方便的,不成想今天安装linux下的坑了老半天,特此记录。    首先去官网下载代码,这里一定要注意安装分两种,一种是SourceCode源码,一种是编译后的文件。我就是按照网上源码的安装方式去操作编译后的文件,结果坑了好久好久。    ......
  • 遇到:nodejs unhandledPromiseRejectionWarning 错误应该如何解决
    遇到"unhandledPromiseRejectionWarning"错误是因为在Node.js中,一个Promise被rejected了,但是没有被处理(handled)。这可能是因为你没有使用适当的错误处理机制,导致Promise的rejected状态没有被捕获。要解决这个问题,你可以考虑以下几个步骤:使用catch方法捕获错误:在你的......
  • Node.js 事件
    一、Node.js事件循环Node.js是单进程单线程应用程序,但是因为V8引擎提供的异步执行回调接口,通过这些接口可以处理大量的并发,所以性能非常高。Node.js几乎每一个API都是支持回调函数的。Node.js基本上所有的事件机制都是用设计模式中观察者模式实现。Node.js单线程类似......
  • Node中fs模块的一些操作API
    ❝这里主要讲一讲node里面fs模块的一些基操!本篇只讲几个API,后续的可能会在其他文章补充!声明:本文的代码是koa2环境中的,是CommonJS的规范,需要使用require引入!❞什么是fsfs全称为filesystem,称之为文件系统,是Node.js中的内置模块,直接导入使用即可!模块中的API,分异步和同步操作......