当前位置:网站首页>Calculate CPU utilization [Prometheus]
Calculate CPU utilization [Prometheus]
2022-07-24 09:40:00 【liuyunshengsir】
1.CPU Usage formula
We know
CPU The usage rate of = ( All non idle states CPU Total usage time )/( All States CPU The sum of time )
By the following formula :
CPU Total usage time = All non idle states CPU Total usage time + All idle states CPU Total usage time
obtain :
CPU The usage rate of = 1 - ( All idle states CPU Total usage time )/( All States CPU The sum of time )
2.prometheus Calculation CPU Usage rate
CPU Total usage time :node_cpu_seconds_total, It means all kinds of occupied time .
2.1 CPU Use your time 5m Incremental value
5m Incremental value = Current sampling point value - 5m Previous sampling point value
Input : increase(node_cpu_seconds_total[5m])
2.2 CPU Free time 5m Incremental value
node_cpu_seconds_total Sample data of , It is based on the implementation sequence key/vlue Format , and key yes "mode" The sampling is recorded CPU The time of that state (user、sys、idle etc. )
Input :increase(node_cpu_seconds_total{mode=“idle”}[5m])
2.3 Polymerized multicore CPU Free time 5m Incremental value
By sampling data , You can see CPU Free time 5m Incremental value , Is each cpu And are taken as a sampling value , And every virtual machine \ The physical machine , Most of them are multicore , So we need to aggregate the idle time of all cores .
Input :sum(increase(node_cpu_seconds_total{mode=“idle”}[5m]))
It can be seen from the results ,sum The function is to put all CPU Audit time wants to add , No aggregation by host , Therefore, it is necessary to introduce =by (instance)= function , It will bring sum The summed values are split in the specified way ,instance It represents the machine name . If you don't write by (instance) You need to be in {} Which instance of the data is required .
Input :sum(increase(node_cpu_seconds_total{mode=“idle”}[5m])) by (instance)
2.4 Aggregate single machine multicore CPU Total usage time 5m Incremental value
Input :sum(increase(node_cpu_seconds_total[5m])) by (instance)
2.5 Calculate the average 5 minute CPU Usage rate
Input :1- sum(increase(node_cpu_seconds_total{mode=“idle”}[5m])) by (instance)/sum(increase(node_cpu_seconds_total[5m])) by (instance)
边栏推荐
- Promise basic summary
- 华为无线设备安全策略配置命令
- 云原生(十二) | Kubernetes篇之Kubernetes基础入门
- Hucang integrated e-commerce project (I): introduction to the project background and structure
- 2022 trusted cloud authoritative assessment released: Tianyi cloud has obtained ten certifications and five best practices
- Spark Learning: using RDD API to implement inverted index
- [don't bother with reinforcement learning] video notes (I) 1. What is reinforcement learning?
- 数据中台:始于阿里,兴于DaaS
- Friends come to interview a unicorn company in Beijing at leisure. The interview question is priced at 25K
- 《动手学深度学习》(七) -- 边界框和锚框
猜你喜欢

Getting started with web security - open source firewall pfsense installation configuration

ASI-20220222-Implicit PendingIntent
![[note] what is kernel / user space? Let's start with how the CPU runs the program](/img/b5/0ab4f2841faf3573b4502d2cd09069.png)
[note] what is kernel / user space? Let's start with how the CPU runs the program
![[don't bother to strengthen learning] video notes (IV) 1. What is dqn?](/img/74/51219a19595f93e7a85449f54d354d.png)
[don't bother to strengthen learning] video notes (IV) 1. What is dqn?

力扣300-最长递增子序列——动态规划

Detailed LinkedList

js定位大全获取节点的兄弟,父级,子级元素含robot实例
![[MySQL] - deep understanding of index](/img/a6/6ca1356fe11bd33ec7362ce7cdc652.png)
[MySQL] - deep understanding of index

Getting started with sorting - insert sorting and Hill sorting

The next stop of data visualization platform | gifts from domestic open source data visualization datart "super iron powder"
随机推荐
Friends come to interview a unicorn company in Beijing at leisure. The interview question is priced at 25K
Account 1-2
Cloud primordial (12) | introduction to kubernetes foundation of kubernetes chapter
唐宇迪opencv-背景建模
2022 trusted cloud authoritative assessment released: Tianyi cloud has obtained ten certifications and five best practices
代码随想录笔记_链表_25K个一组翻转链表
Spark Learning: Spark implementation of distcp
Leetcode question brushing series -- 174. Dungeon games
Spark Learning: implement compact table command
2021 robocom world robot developer competition - undergraduate group (Preliminary) problem solution
Why add where exists() to the update select statement? And update with a with statement
获取所有股票历史行情数据
Promise basic summary
Gin framework uses session and redis to realize distributed session & Gorm operation mysql
js定位大全获取节点的兄弟,父级,子级元素含robot实例
[don't bother with intensive learning] video notes (III) 1. What is SARS?
Will your NFT disappear? Dfinity provides the best solution for NFT storage
Spark Learning: compile spark source code in win10
DSP development, using CCS software to establish engineering and burning
Build practical product help documents to improve user satisfaction