日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

配置Node Exporter

  1. 安裝Node Exporter

我們依然選用Ubuntu 18.04作為監(jiān)控目標(biāo)

root@prometheous# mkdir node-exporter;cd node-exporter
root@prometheous:~/node-exporter# wget https://github.com/prometheus/node_exporter/releases/download/v1.0.0/node_exporter-1.0.0.linux-amd64.tar.gz
root@prometheous:~/node-exporter# tar xfz node_exporter-1.0.0.linux-amd64.tar.gz
root@prometheous:~/node-exporter# cp node_exporter-1.0.0.linux-amd64/node_exporter /usr/local/bin
root@prometheous:~/node-exporter# node_exporter --version
node_exporter, version 1.0.0 (branch: HEAD, revision: b9c96706a7425383902b6143d097cf6d7cfd1960)
  build user:       root@3e55cc20ccc0
  build date:       20200526-06:01:48
  go version:       go1.14.3
  1. 配置textfile收集器

有時想給主機(jī)增加一些自定義的指標(biāo),比如物理位置和用途等,我們需要暴露一些自定義的指標(biāo),這是textfile收集器將起到作用。

這里我們定義了主機(jī)的角色和DataCenter的名稱,你也可以根據(jù)自己的需求設(shè)定如添加Rack等信息

root@prometheous:~/node-exporter#  mkdir textfile
root@prometheous:~/node-exporter#  echo 'metadata{role="Nginx",datacenter="labstage"} 1' | tee .textfile/metadata.prom
  1. 配置systemd收集器

systemd收集器記錄了systemd中的服務(wù)和系統(tǒng)狀態(tài),默認(rèn)收集所有內(nèi)容。如果只想收集部分關(guān)鍵的業(yè)務(wù),我們可以添加白名單。

可以運(yùn)行下面的命令查看systemd下的服務(wù):

root@prometheous:~/node-exporter# systemctl --type=service --state=running
  1. 運(yùn)行Node Export服務(wù)

我們?yōu)閠extfile收集器指定目錄以便查找指標(biāo),然后啟用了systemd收集器并使用白名單過濾待監(jiān)控的服務(wù)

root@prometheous:~/node-exporter# node_exporter --collector.textfile.directory ./textfile/ --collector.systemd.unit-whitelist="(ssh|taniumclient)"

抓取 Node Exporter

為了抓取Node Exporter我們需要修改Prometheus配置文件

  1. 過濾收集器

Node Expoerter可以返回很多指標(biāo),除了在node exporter上限制運(yùn)行哪些收集器外,我們還可以在Prometheus上通過添加特定收集器列表來實(shí)現(xiàn),這對無法控制正在抓取的主機(jī)配置非常有用。

可以過濾的內(nèi)容參考如下鏈接:

https://github.com/prometheus/node_exporter

  1. 創(chuàng)建抓取job

要獲取新數(shù)據(jù),需要為prometheus.yml添加另外一個新的job,結(jié)合過濾收集器,新的配置文件如下:

root@prometheous:/etc/prometheous#cat prometheus.yml 
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['localhost:9090']
  - job_name: 'linux_node'
    static_configs:
    - targets: ['10.110.204.54:9090']
      
    params:labels:
        group: 'production'
      collect[]:
        - cpu
        - meminfo
        - diskstats
        - netdev
        - netstat
        - filesystem
        - systemd

重新加載prometheus.yml文件

root@prometheous:~/prometheous# prometheus --config.file /etc/prometheous/prometheus.yml &

使用PromQL

PromQL是Prometheus自帶的查詢語言,有三種數(shù)據(jù)類型

  • 即時向量:數(shù)據(jù)采樣的時間序列
  • 范圍向量:包含特定時間范圍內(nèi)的數(shù)據(jù)的一組時間序列
  • 標(biāo)量:具體的值

我們可以通過在瀏覽器上的Excute按鈕旁邊輸入相關(guān)的內(nèi)容進(jìn)行查詢,可以參考下面鏈接

https://prometheus.io/docs/prometheus/latest/querying/basics/

下圖中我們通過其labels即{group="production"}的查詢結(jié)果

Prometheus之監(jiān)控Linux主機(jī)

 

分享到:
標(biāo)簽:Prometheus
用戶無頭像

網(wǎng)友整理

注冊時間:

網(wǎng)站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運(yùn)動步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績評定2018-06-03

通用課目體育訓(xùn)練成績評定