最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Prometheus容器化部署的實(shí)踐方案

 更新時(shí)間:2021年12月31日 10:52:57   作者:天外來(lái)物_  
這篇文章主要介紹了Prometheus容器化部署,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

環(huán)境

主機(jī)名 IP地址 服務(wù)
prometheus 192.168.237.137 prometheus、grafana
node-exporter 192.168.237.131 node_exporter

容器化部署prometheus

1、安裝docker

[root@prometheus ~]# docker version
Client: Docker Engine - Community
 Version:           20.10.11
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        dea9396
 Built:             Thu Nov 18 00:36:58 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.11
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       847da18
  Built:            Thu Nov 18 00:35:20 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

2、運(yùn)行prometheus容器

//拉取鏡像
[root@prometheus ~]# docker pull prom/prometheus
Using default tag: latest
latest: Pulling from prom/prometheus
3cb635b06aa2: Pull complete 
34f699df6fe0: Pull complete 
33d6c9635e0f: Pull complete 
f2af7323bed8: Pull complete 
c16675a6a294: Pull complete 
827843f6afe6: Pull complete 
3d272942eeaf: Pull complete 
7e785cfa34da: Pull complete 
05e324559e3b: Pull complete 
170620261a59: Pull complete 
ec35f5996032: Pull complete 
5509173eb708: Pull complete 
Digest: sha256:cb9817249c346d6cfadebe383ed3b3cd4c540f623db40c4ca00da2ada45259bb
Status: Downloaded newer image for prom/prometheus:latest
docker.io/prom/prometheus:latest

//在/opt目錄下提供prometheus的默認(rèn)配置文件
[root@prometheus ~]# ls /opt/
prometheus.yml

//運(yùn)行容器
##--restart always 總是重啟,開機(jī)自啟
## 將本地提供的配置文件映射到容器,ro 容器內(nèi)只讀
[root@prometheus ~]# docker run --name prometheus -d --restart always -p 9090:9090 -v /opt/prometheus.yml:/etc/prometheus/prometheus.yml:ro prom/prometheus:latest 
a0ba5535f0ea3b0f44574fd237802f2ef19f4624c3752c3bf8122a4d79a26428
[root@prometheus ~]# docker ps
CONTAINER ID   IMAGE                             COMMAND                  CREATED          STATUS                    PORTS                                       NAMES
a0ba5535f0ea   prom/prometheus:latest            "/bin/prometheus --c…"   11 seconds ago   Up 11 seconds             0.0.0.0:9090->9090/tcp, :::9090->9090/tcp   prometheus

//查看端口
[root@prometheus ~]# ss -anltu
Netid     State      Recv-Q      Send-Q           Local Address:Port           Peer Address:Port     Process     
tcp       LISTEN     0           128                    0.0.0.0:22                  0.0.0.0:*                    
tcp       LISTEN     0           128                    0.0.0.0:9090                0.0.0.0:*                    
tcp       LISTEN     0           128                       [::]:22                     [::]:*                    
tcp       LISTEN     0           128                       [::]:9090                   [::]:*                    

使用ip+9090/targets訪問(wèn)prometheus默認(rèn)網(wǎng)頁(yè)

在這里插入圖片描述

部署node_exporter

//下載安裝包
[root@node-exporter ~]# wget https://github.com/prometheus/node_exporter/releases/download/v1.3.0/node_exporter-1.3.0.linux-amd64.tar.gz
[root@node-exporter ~]# ls
anaconda-ks.cfg  node_exporter-1.3.0.linux-amd64.tar.gz

//解壓
[root@node-exporter ~]# tar xf node_exporter-1.3.0.linux-amd64.tar.gz -C /usr/local/
[root@node-exporter ~]# mv /usr/local/node_exporter-1.3.0.linux-amd64/ /usr/local/node_exporter
[root@node-exporter ~]# ls /usr/local/
bin  etc  games  include  lib  lib64  libexec  node_exporter  sbin  share  src

//編寫service文件,啟動(dòng)并開機(jī)自啟
[root@node-exporter ~]# cat /usr/lib/systemd/system/node_exporter.service
[unit]
Description=The node_exporter Server
After=network.target

[Service]
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure
RestartSec=15s
SyslogIdentifier=node_exporter

[Install]
WantedBy=multi-user.target
[root@node-exporter ~]# systemctl daemon-reload 
[root@node-exporter ~]# systemctl enable --now node_exporter.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.
[root@node-exporter ~]# systemctl status node_exporter.service 
● node_exporter.service
   Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; enabled; vendor preset: disabled)
   Active: active (running) since 四 2021-12-30 19:26:59 CST; 8s ago
 Main PID: 27878 (node_exporter)
   CGroup: /system.slice/node_exporter.service
           └─27878 /usr/local/node_exporter/node_exporter

//查看端口
[root@node-exporter ~]# ss -anltu
Netid State      Recv-Q Send-Q         Local Address:Port                        Peer Address:Port              
tcp   LISTEN     0      128                        *:22                                     *:*                  
tcp   LISTEN     0      128                     [::]:22                                  [::]:*                  
tcp   LISTEN     0      128                     [::]:9100                                [::]:*                  

## node-exporter部署成功就可以在Prometheus主機(jī)上添加節(jié)點(diǎn)進(jìn)行監(jiān)控

添加節(jié)點(diǎn)到prometheus中

修改本地prometheus.yml文件

//修改配置文件
[root@prometheus ~]# tail -8 /opt/prometheus.yml 
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]
  - job_name: "centos"			//指定一個(gè)工作名稱
    static_configs:
      - targets: ["192.168.237.131:9100"]				//指定node-exporter節(jié)點(diǎn)的IP和端口號(hào)
## 如果有多個(gè)節(jié)點(diǎn)
  - job_name: "centos"	
    static_configs:
      - targets: 
        - "192.168.237.131:9100"
        - "192.168.237.132:9100"
        - "192.168.237.133:9100"


//重啟容器,重新讀取配置文件
[root@prometheus ~]# docker restart prometheus
prometheus
[root@prometheus ~]# docker ps
CONTAINER ID   IMAGE                             COMMAND                  CREATED          STATUS                    PORTS                                       NAMES
a0ba5535f0ea   prom/prometheus:latest            "/bin/prometheus --c…"   26 minutes ago   Up 3 seconds              0.0.0.0:9090->9090/tcp, :::9090->9090/tcp   prometheus

訪問(wèn)prometheus默認(rèn)網(wǎng)頁(yè)
成功添加節(jié)點(diǎn)

在這里插入圖片描述

部署grafana畫圖工具

//拉取grafan/grafan官方鏡像
[root@prometheus ~]# docker pull grafana/grafana
Using default tag: latest
latest: Pulling from grafana/grafana
97518928ae5f: Pull complete 
5b58818b7f48: Pull complete 
d9a64d9fd162: Pull complete 
4e368e1b924c: Pull complete 
867f7fdd92d9: Pull complete 
387c55415012: Pull complete 
07f94c8f51cd: Pull complete 
ce8cf00ff6aa: Pull complete 
e44858b5f948: Pull complete 
4000fdbdd2a3: Pull complete 
Digest: sha256:18d94ae734accd66bccf22daed7bdb20c6b99aa0f2c687eea3ce4275fe275062
Status: Downloaded newer image for grafana/grafana:latest
docker.io/grafana/grafana:latest

[root@prometheus ~]# docker images
REPOSITORY                      TAG       IMAGE ID       CREATED        SIZE
prom/prometheus                 latest    a3d385fc29f9   12 days ago    201MB
grafana/grafana                 latest    9b957e098315   2 weeks ago    275MB

//使用官方grafana鏡像運(yùn)行容器
[root@prometheus ~]# docker run -d --name grafana -p 3000:3000 --restart always grafana/grafana
0b5986fc63442538a6fae845e5d1b8afc78caec4f4bdd81ca3623eb1329ad562

[root@prometheus ~]# docker ps
CONTAINER ID   IMAGE                             COMMAND                  CREATED          STATUS                    PORTS                                       NAMES
0b5986fc6344   grafana/grafana                   "/run.sh"                4 seconds ago    Up 2 seconds              0.0.0.0:3000->3000/tcp, :::3000->3000/tcp   grafana
a0ba5535f0ea   prom/prometheus:latest            "/bin/prometheus --c…"   33 minutes ago   Up 6 minutes              0.0.0.0:9090->9090/tcp, :::9090->9090/tcp   prometheus

//查看端口
[root@prometheus ~]# ss -anltu
Netid     State      Recv-Q      Send-Q           Local Address:Port           Peer Address:Port     Process             
tcp       LISTEN     0           128                    0.0.0.0:22                  0.0.0.0:*                    
tcp       LISTEN     0           128                    0.0.0.0:3000                0.0.0.0:*                    
tcp       LISTEN     0           128                    0.0.0.0:9090                0.0.0.0:*                             
tcp       LISTEN     0           128                       [::]:22                     [::]:*                    
tcp       LISTEN     0           128                       [::]:3000                   [::]:*                    
tcp       LISTEN     0           128                       [::]:9090                   [::]:*                    

使用prometheus主機(jī)IP地址192.168.129.205 + 端口號(hào)3000在瀏覽器中訪問(wèn)
默認(rèn)賬號(hào):admin 密碼:admin

在這里插入圖片描述

修改密碼

在這里插入圖片描述

首頁(yè)

在這里插入圖片描述

添加數(shù)據(jù)源

在這里插入圖片描述

數(shù)據(jù)源選擇prometheus

在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

導(dǎo)入儀表盤

模板地址

在這里插入圖片描述

模板ID為9276

在這里插入圖片描述
在這里插入圖片描述

效果圖

在這里插入圖片描述

到此這篇關(guān)于Prometheus容器化部署的文章就介紹到這了,更多相關(guān)Prometheus容器化部署內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • docker 的volumes清理步驟

    docker 的volumes清理步驟

    文章介紹了如何在Docker中清理volumes以釋放磁盤空間,包括查看所有卷、查找未使用的卷、清理未使用的卷、手動(dòng)刪除特定卷、檢查卷的使用情況、清理卷中的數(shù)據(jù)、預(yù)防措施以及遷移Docker數(shù)據(jù)目錄等步驟,感興趣的朋友一起看看吧
    2025-03-03
  • 使用Docker部署Dashdot服務(wù)器儀表盤的步驟

    使用Docker部署Dashdot服務(wù)器儀表盤的步驟

    Dashdot是一款簡(jiǎn)單、實(shí)用的開源服務(wù)器儀表盤,設(shè)計(jì)時(shí)考慮到了玻璃形態(tài),它旨在用于較小的?VPS?和私人服務(wù)器,這篇文章主要介紹了使用Docker部署Dashdot服務(wù)器儀表盤,需要的朋友可以參考下
    2022-12-12
  • docker私庫(kù)Harbor的架構(gòu)與組件說(shuō)明

    docker私庫(kù)Harbor的架構(gòu)與組件說(shuō)明

    今天小編就為大家分享一篇關(guān)于docker私庫(kù)Harbor的架構(gòu)與組件說(shuō)明,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2018-12-12
  • docker安裝部署zabbix的全過(guò)程

    docker安裝部署zabbix的全過(guò)程

    zabbix由2部分構(gòu)成,zabbix?server與可選組件zabbix?agent,要想搭建一個(gè)Zabbix的工作環(huán)境,主要有三個(gè)方面(界面、服務(wù)器和數(shù)據(jù)庫(kù))可以安裝在同一臺(tái)服務(wù)器上,也可以不在同一個(gè)服務(wù)器,本次使用Docker開源的應(yīng)用容器來(lái)快速搭建zabbix,需要的朋友可以參考下
    2024-03-03
  • harbor修改配置文件后重啟操作

    harbor修改配置文件后重啟操作

    這篇文章主要介紹了harbor修改配置文件后重啟操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-11-11
  • docker開通2375端口防漏洞問(wèn)題

    docker開通2375端口防漏洞問(wèn)題

    這篇文章主要介紹了docker開通2375端口防漏洞問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-08-08
  • 解決docker中ifconfig不可用的問(wèn)題

    解決docker中ifconfig不可用的問(wèn)題

    這篇文章主要介紹了解決docker中ifconfig不可用的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-03-03
  • Docker常見命令整理匯總(包括鏡像命令、容器命令)

    Docker常見命令整理匯總(包括鏡像命令、容器命令)

    這篇文章主要給大家介紹了關(guān)于Docker常見命令整理匯總的相關(guān)資料,包括鏡像命令、容器命令等等,通過(guò)一個(gè)個(gè)示例來(lái)加深各位看官對(duì)docker相關(guān)命令的理解以及記憶,需要的朋友可以參考下
    2022-07-07
  • 基于Docker搭建iServer集群

    基于Docker搭建iServer集群

    Docker擴(kuò)展了LXC,提供了更高級(jí)別的API,并簡(jiǎn)化了應(yīng)用的打包和部署,為終端用戶創(chuàng)建彼此獨(dú)立的私有環(huán)境,可有效節(jié)約開發(fā)者和系統(tǒng)管理員的環(huán)境部署時(shí)間。這篇文章主要介紹了基于Docker搭建iServer集群,需要的朋友可以參考下
    2022-04-04
  • Docker數(shù)據(jù)管理與網(wǎng)絡(luò)通信的使用

    Docker數(shù)據(jù)管理與網(wǎng)絡(luò)通信的使用

    這篇文章主要介紹了Docker數(shù)據(jù)管理與網(wǎng)絡(luò)通信的使用,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-11-11

最新評(píng)論

万山特区| 绥芬河市| 大英县| 繁峙县| 镇康县| 大兴区| 公主岭市| 贵州省| 屏边| 古田县| 灵川县| 东源县| 平塘县| 太和县| 苏尼特右旗| 宾川县| 哈密市| 河曲县| 青铜峡市| 道孚县| 临桂县| 东源县| 泰顺县| 五家渠市| 桐梓县| 乐平市| 孟村| 祁东县| 博白县| 色达县| 张家川| 城步| 青州市| 文化| 新余市| 拜城县| 揭东县| 房山区| 高阳县| 景德镇市| 凤凰县|