日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > centos >内容正文

centos

Centos8 部署Promethus(普罗米修斯)+grafana画图

發布時間:2024/1/8 centos 58 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Centos8 部署Promethus(普罗米修斯)+grafana画图 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • 1. 普羅米修斯概述
  • 2. 時間序列數據
  • 3. 普羅米修斯特征
  • 4. 普羅米修斯原理架構圖
  • 5. 部署普羅米修斯
    • 5.1 安裝prometheus
    • 5.2 prometheus web界面
  • 6. 監控遠程Linux主機
  • 7. 結合grafana畫圖

1. 普羅米修斯概述

Prometheus(由go語言(golang)開發)是一套開源的監控&報警&時間序列數 據庫的組合。適合監控docker容器。

2. 時間序列數據

  • 什么是序列數據
  • 時間序列數據(TimeSeries Data) : 按照時間順序記錄系統、設備狀態變化 的數據被稱為時序數據。
    應用的場景很多, 如:

    氣候的變化 某一個地區的各車輛的行駛軌跡數據 傳統證券行業實時交易數據 實時運維監控數據等
  • 時間序列數據特點

    性能好

  • 關系型數據庫對于大規模數據的處理性能糟糕。NOSQL可以比較好的處理 大規模數據,讓依然比不上時間序列數據庫。

    存儲成本低

    高效的壓縮算法,節省存儲空間,有效降低IO
    Prometheus有著非常高效的時間序列數據存儲方法,每個采樣數據僅僅占 用3.5byte左右空間,上百萬條時間序列,30秒間隔,保留60天,大概花了 200多G(來自官方數據

    3. 普羅米修斯特征

  • 一個多維數據模型(時間序列由指標名稱定義和設置鍵/值尺寸)

  • 一個靈活的查詢語言來利用這一維度

  • 不依賴于分布式存儲;單服務器節點是自治的

  • 時間序列收集通過HTTP 上的拉模型進行

  • 通過中間網關支持推送時間序列

  • 通過服務發現或靜態配置發現目標

  • 多種圖形和儀表板支持模式

  • 支持分層和水平聯合

  • 4. 普羅米修斯原理架構圖

    5. 部署普羅米修斯

    實驗環境:

    主機名服務器IP地址
    masterPrometneus服務器192.168.216.200
    slave1被監控服務器192.168.216.210
    grafanagrafana服務器192.168.216.215

    環境準備,3臺主機可聯通外網

    //3臺主機均需要關閉防火墻,selinux [root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# systemctl disable firewalld.service Removed /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config [root@localhost ~]# vim /etc/selinux/config [root@localhost ~]# setenforce 0

    5.1 安裝prometheus

    從官網下載相應的安裝包https://prometheus.io/download/

    [root@master ~]# ls anaconda-ks.cfg prometheus-2.31.1.linux-amd64.tar.gz//解壓到/usr/local [root@master ~]# tar -zxvf prometheus-2.31.1.linux-amd64.tar.gz -C /usr/local///改名字或者做軟連接 [root@master ~]# cd /usr/local/ [root@master local]# mv prometheus-2.31.1.linux-amd64 prometheus [root@master local]# ls bin etc games include lib lib64 libexec prometheus sbin share src//使用默認配置文件啟動 [root@master local]# /usr/local/prometheus/prometheus --config.file="/usr/local/prometheus/prometheus.yml" //另外開一個終端查看端口號,9090就是默認端口號 [root@master ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 *:9090 *:* LISTEN 0 128 [::]:22 [::]:*

    5.2 prometheus web界面




    6. 監控遠程Linux主機

    去之前的官網下載安裝node_exporter組件

    [root@slave1 ~]# ls anaconda-ks.cfg node_exporter-0.17.0.linux-amd64.tar.gz//一樣的解壓,改名 [root@slave1 ~]# tar -zxvf node_exporter-0.17.0.linux-amd64.tar.gz -C /usr/local/ node_exporter-0.17.0.linux-amd64/ node_exporter-0.17.0.linux-amd64/NOTICE node_exporter-0.17.0.linux-amd64/node_exporter node_exporter-0.17.0.linux-amd64/LICENSE[root@slave1 local]# mv node_exporter-0.17.0.linux-amd64/ node_exporter [root@slave1 local]# ls bin etc games include lib lib64 libexec node_exporter sbin share src [root@slave1 local]# cd node_exporter/ //就一個可執行文件,直接運行 [root@slave1 node_exporter]# ls LICENSE node_exporter NOTICE//這樣運行不用開新終端 [root@slave1 node_exporter]# nohup /usr/local/node_exporter/node_exporter nohup: 忽略輸入并把輸出追加到'nohup.out' [root@slave1 node_exporter]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 *:9100 *:* LISTEN 0 128 [::]:22 [::]:* //確認端口9100正常運行//在服務器上配置slave1,注意格式 [root@master ~]# vim /usr/local/prometheus/prometheus.yml .........- job_name: "prometheus"# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ["localhost:9090"]- job_name: "slave1" //監控主機的別名static_configs:- targets: ['192.168.216.210:9100'] //ip+端口//重啟服務 [root@master ~]# pkill prometheus [root@master ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* [root@master ~]# /usr/local/prometheus/prometheus --config.file="/usr/local/prometheus/prometheus.yml" & [root@master local]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 *:9090 *:* LISTEN 0 128 [::]:22 [::]:*

    回到服務器網頁

    7. 結合grafana畫圖

    官網下載grafana
    地址:https://grafana.com/grafana/download

    [root@grafana ~]# ls anaconda-ks.cfg grafana-enterprise-8.2.5-1.x86_64.rpm//安裝 [root@grafana ~]# yum install -y grafana-enterprise-8.2.5-1.x86_64.rpm //啟動服務并設置開機自啟 [root@grafana ~]# systemctl enable --now grafana-server Synchronizing state of grafana-server.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable grafana-server Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /usr/lib/systemd/system/grafana-server.service. [root@grafana ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 128 *:3000 *:* //默認端口為3000







    總結

    以上是生活随笔為你收集整理的Centos8 部署Promethus(普罗米修斯)+grafana画图的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。