這一節(jié),我們來配置一下Node-Exporter,那么我們先來了解一下什么是Prometheus的Exporter?
任何向Prometheus提供監(jiān)控樣本數(shù)據(jù)的程序都可以被稱為一個Exporter,它是一種用于將不同數(shù)據(jù)源的指標提供給Prometheus進行收集和監(jiān)控的工具。運行在應(yīng)用程序、計算機、網(wǎng)絡(luò)設(shè)備或者其他系統(tǒng)上的代碼,它可以將系統(tǒng)的指標信息以一種標準格式公開。將指標數(shù)據(jù)公開為HTTP端點或者指定的格式(如Redis、JMX等),Prometheus然后可以通過輪詢或指定的抓取器。
Exporter是Prometheus的指標數(shù)據(jù)收集組件,負責(zé)從目標Jobs收集數(shù)據(jù)。并把收集到的數(shù)據(jù)轉(zhuǎn)換為Prometheus支持的時序數(shù)據(jù)格式。只負責(zé)收集,并不向Server端發(fā)送數(shù)據(jù),而是等待Prometheus Server 主動抓取。
Prometheus社區(qū)以及其他團隊開發(fā)了大量的Exporter,覆蓋了許多不同類型的系統(tǒng)和服務(wù)。Node Exporter、MySQL Exporter、Redis Exporter、MongoDB Exporter、Nginx Exporter…
使用方式:在主機上安裝了一個 Exporter程序,該程序?qū)ν獗┞读艘粋€用于獲取當前監(jiān)控樣本數(shù)據(jù)的HTTP訪問地址。Prometheus通過輪詢的方式定時從這些Target中獲取監(jiān)控數(shù)據(jù)樣本,并且存儲在數(shù)據(jù)庫當中。
案例實戰(zhàn)-安裝部署 **node_exporter **
node_exporter 用于采集類UNIX內(nèi)核的硬件以及系統(tǒng)指標,包括CPU、內(nèi)存和磁盤。
下載node_exporter 組件
https://prometheus.io/download/
https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
下載安裝包到Linux服務(wù)器
#解壓
tar -zxvf node_exporter-1.6.0.linux-amd64.tar.gz
配置啟動文件,設(shè)置自啟動:vi /usr/lib/systemd/system/node_exporter.service
注意:ExecStart配置node_exporter目錄下的node_exporter啟動器
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/software/node_exporter/node_exporter \
--collector.ntp \
--collector.mountstats \
--collector.systemd \
--collector.tcpstat
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
啟動node_exporter ,設(shè)置開機自啟,檢查服務(wù)啟動情況
systemctl start node_exporter
systemctl enable node_exporter
netstat -natp | grep :9100
[root@localhost /]# netstat -natp | grep :9100
tcp6 0 0 :::9100 :::* LISTEN 1390/node_exporter
通過瀏覽器訪問 http://IP+9100/metrics可以查看到監(jiān)控信息
Prometheus服務(wù)器中添加被監(jiān)控機器的配置 vim prometheus.yml
, target的也可以寫ip
- job_name: 'agent-1'
static_configs:
- targets: ['ip:9100']
動態(tài)更新配置 curl -X POST http://localhost:9090/-/reload
查看Web UI界面的target和configuration是否有對應(yīng)的數(shù)據(jù)
Ok,Prometheus監(jiān)控組件Node-Exporter的實操就結(jié)束啦,記得三連?關(guān)注哦!文章來源:http://www.zghlxwxcb.cn/news/detail-557807.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-557807.html
到了這里,關(guān)于【監(jiān)控系統(tǒng)】Prometheus監(jiān)控組件Node-Exporter配置實戰(zhàn)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!