激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務器之家:專注于服務器技術及軟件下載分享
分類導航

云服務器|WEB服務器|FTP服務器|郵件服務器|虛擬主機|服務器安全|DNS服務器|服務器知識|Nginx|IIS|Tomcat|

服務器之家 - 服務器技術 - 服務器知識 - Prometheus容器化部署的實踐方案

Prometheus容器化部署的實踐方案

2022-01-24 17:07天外來物_ 服務器知識

這篇文章主要介紹了Prometheus容器化部署,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

環境

主機名 IP地址 服務
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、運行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的默認配置文件
[root@prometheus ~]# ls /opt/
prometheus.yml

//運行容器
##--restart always 總是重啟,開機自啟
## 將本地提供的配置文件映射到容器,ro 容器內只讀
[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訪問prometheus默認網頁

Prometheus容器化部署的實踐方案

部署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文件,啟動并開機自啟
[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主機上添加節點進行監控

添加節點到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"			//指定一個工作名稱
    static_configs:
      - targets: ["192.168.237.131:9100"]				//指定node-exporter節點的IP和端口號
## 如果有多個節點
  - 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

訪問prometheus默認網頁
成功添加節點

Prometheus容器化部署的實踐方案

部署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鏡像運行容器
[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主機IP地址192.168.129.205 + 端口號3000在瀏覽器中訪問
默認賬號:admin 密碼:admin

Prometheus容器化部署的實踐方案

修改密碼

Prometheus容器化部署的實踐方案

首頁

Prometheus容器化部署的實踐方案

添加數據源

Prometheus容器化部署的實踐方案

數據源選擇prometheus

Prometheus容器化部署的實踐方案
Prometheus容器化部署的實踐方案
Prometheus容器化部署的實踐方案

導入儀表盤

模板地址

Prometheus容器化部署的實踐方案

模板ID為9276

Prometheus容器化部署的實踐方案
Prometheus容器化部署的實踐方案

效果圖

Prometheus容器化部署的實踐方案

到此這篇關于Prometheus容器化部署的文章就介紹到這了,更多相關Prometheus容器化部署內容請搜索服務器之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持服務器之家!

原文鏈接:https://blog.csdn.net/tianwailaiwu_/article/details/122231724

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 欧美成人午夜一区二区三区 | 亚洲成人第一区 | chinese中国真实乱对白 | 毛片大全免费 | 国产乱一区二区三区视频 | 91网站在线播放 | 国产激爽大片在线播放 | 热久久成人 | 成人三级电影网址 | 日日狠狠久久偷偷四色综合免费 | 久久网页 | 久久国产在线观看 | av在线观 | 5xsq在线视频| 日本爽快片100色毛片视频 | 国产精品一区二区免费在线观看 | 国内精品国产三级国产a久久 | 中文区永久区 | 91高清视频在线观看 | 69性欧美高清影院 | 久久国产精品二国产精品中国洋人 | 91在线视频精品 | 国产91久久精品 | 久久综合久久精品 | 全黄裸片武则天艳史 | 欧美精品免费一区二区三区 | 久久免费视频5 | 色偷偷欧美| 日韩在线播放第一页 | 欧美精品久久久久久久久久 | 久久久在线免费观看 | 欧美成人免费电影 | 亚洲国产色婷婷 | 欧美1| 黄色av免费网站 | 久久免费视频8 | 日韩激情 | 国产精品99久久久久久宅女 | 成人毛片在线播放 | 爱逼av| 黄色成人小视频 |