liunx 基礎資源監(jiān)控使用 exporter
創(chuàng)新互聯(lián)公司從2013年開始,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務公司,擁有項目成都網(wǎng)站設計、做網(wǎng)站網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元岳陽做網(wǎng)站,已為上家服務,為岳陽各地企業(yè)和個人服務,聯(lián)系電話:18980820575什么是exporter
exporter 是一個采集監(jiān)控數(shù)據(jù)并通過 prometheus 監(jiān)控對外提供數(shù)據(jù)的組件,exporter 主要通過被監(jiān)控對象提供的監(jiān)控相關接口獲取監(jiān)控數(shù)據(jù)
安裝部署
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
安裝到對應目錄
制作標準啟動服務
cat /etc/systemd/system/node_exporter.service
[Unit]
Description=node_export
[Service]
ExecStart=/op/xxx/node_export
[Install]
WantedBy=multi-user.target
啟動
systemctl enable node_exporter.service
systemctl start node_exporter.service
在prometheus server 添加主機信息
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'shanghai'
static_configs:
- targets: ['x.x.x.x:9090']
relabel_configs:
- action: replace
source_labels: ['job']
regex: (.*)
replacement: $1
target_label: idc
- job_name: 'node1'
static_configs:
- targets: ['x.x.x.x:9100']
重啟prometheus 或者重載配置文件 kill -hup $pid
查看監(jiān)控是否生效
exporter 常見的監(jiān)控項
node_disk 磁盤
node_cpu cpu
node_memory 內(nèi)存
node_network 網(wǎng)絡
node_load1 系統(tǒng)負載
常用查詢語句
cpu 使用率
100 - (avg by (instance) (irate(node_cpu{instance="xxx:9100", mode="idle"}[5m])) * 100)
機器平均負載
網(wǎng)卡接收
sum(rate(node_network_receive_bytes_total{instance="xxx:9100",job="server",device!="lo"}[5m]))
網(wǎng)卡出量
sum(rate(node_network_transmit_bytes{instance="xxx:9100",job="server",device!="lo"}[5m]))
系統(tǒng)負載
node_load1{instance="xxx:9100"} // 1分鐘負載
node_load5{instance="xxx:9100"} // 5分鐘負載
node_load15{instance="xxx:9100"} // 15分鐘負載
內(nèi)存使用率
round((node_memory_MemTotal_bytes-(node_memory_MemFree_bytes+node_memory_Buffers_bytes+node_memory_Cached_bytes))/node_memory_MemTotal_bytes * 100)
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
本文題目:prometheus監(jiān)控liunx主機-創(chuàng)新互聯(lián)
文章分享:http://muchs.cn/article34/heipe.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)站內(nèi)鏈、靜態(tài)網(wǎng)站、網(wǎng)站設計、App開發(fā)、微信公眾號
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)