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空閒率

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負載率

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.可用內存

node_memory_MemAvailable{instance="88node"}

註釋:

## node_memory_MemAvailable :Memory information field MemAvailable, node-exporter已經抓取出來,只需查詢展示即可;

    注意:該指標針對不同的系統是採集不同的,CentOS6.X 上就採集不到這個指標;CentOS7上可以;

 

4.空閒文件系統空間

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 :

node_memory_SwapFree{instance="134node"}

## node_memory_SwapTotal: Memory information field SwapTotal.

## swap :類似於可以把硬盤當內存用,那麼這一部分內存一般就叫做swap

 

Swap Usage :

node_memory_SwapTotal{instance="134node"} - node_memory_SwapFree{instance="134node"}

## node_memory_SwapFree: Memory information field SwapFree

 

Swap I/O(in):

rate(node_vmstat_pswpin{instance="88node"}[1m]) * 4096 or irate(node_vmstat_pswpin{instance="88node"}[5m]) * 4096

 

Swap I/O(out):

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使用率

avg without (cpu) (irate(node_cpu{instance="88node", mode!="idle"}[5m]))

## avg : 平均值

 

7.網路使用情況

上傳速率:

     irate(node_network_transmit_bytes{device!="lo",instance="88node"}[1m])

下載速率:

     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"}

 

可用內存佔比:

     (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分鐘內)

sum by (instance) (irate(node_disk_reads_completed{instance="88node"}[5m]))

##node_disk_reads_completed: The total number of reads completed successfully

磁盤每秒寫入(5分鐘內)

sum by (instance)(irate(node_disk_writes_completed{instance="88node"}[5m]))

##node_disk_writes_completed :The total number of writes completed successfully.

使用I/O的毫秒數(5分鐘內)

sum by (instance) (irate(node_disk_io_time_ms{instance="88node"}[5m]))

##node_disk_io_time_ms: Total Milliseconds spent doing I/Os

磁盤每秒讀寫總數(5分鐘內)

sum by (instance) (irate(node_disk_reads_completed{instance="88node"}[5m])) + sum by (instance) (irate(node_disk_writes_completed{instance="88node"}[5m]))

 

10.I/O Usage

磁盤讀取總數(1分鐘內)

sum(irate(node_disk_bytes_read{instance="88node"}[1m]))

##node_disk_bytes_read : The total number of bytes read successfully(成功讀取的字節數)

磁盤寫入總數(1分鐘內)

sum(irate(node_disk_bytes_written{instance="88node"}[1m]))

##node_disk_bytes_written :The total number of bytes written successfully(成功寫入的字節數)

使用I/O的毫秒數(1分鐘內)

sum(irate(node_disk_io_time_ms{instance="88node"}[1m]))

##node_disk_io_time_ms :Total Milliseconds spent doing I/Os.(使用IO的總毫秒數)

 

11.文件系統空閒空間

最低值:

min(node_filesystem_free{fstype=~"xfs|ext4",instance="88node"} / node_filesystem_size{fstype=~"xfs|ext4",instance="88node"})

最高值:

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。

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章