prometheus安裝

下載

官網:https://prometheus.io/
下載:https://github.com/prometheus...html

安裝

1.解壓node

[root@iZ2ze40ci8v0g1kx9hqvs0Z prometheus]# tar -zxvf prometheus-2.17.1.linux-amd64.tar.gz 
prometheus-2.17.1.linux-amd64/
prometheus-2.17.1.linux-amd64/NOTICE
prometheus-2.17.1.linux-amd64/LICENSE
prometheus-2.17.1.linux-amd64/prometheus.yml
prometheus-2.17.1.linux-amd64/prometheus
prometheus-2.17.1.linux-amd64/promtool
prometheus-2.17.1.linux-amd64/console_libraries/
prometheus-2.17.1.linux-amd64/console_libraries/menu.lib
prometheus-2.17.1.linux-amd64/console_libraries/prom.lib
prometheus-2.17.1.linux-amd64/consoles/
prometheus-2.17.1.linux-amd64/consoles/prometheus-overview.html
prometheus-2.17.1.linux-amd64/consoles/index.html.example
prometheus-2.17.1.linux-amd64/consoles/node-cpu.html
prometheus-2.17.1.linux-amd64/consoles/node-overview.html
prometheus-2.17.1.linux-amd64/consoles/node.html
prometheus-2.17.1.linux-amd64/consoles/node-disk.html
prometheus-2.17.1.linux-amd64/consoles/prometheus.html
prometheus-2.17.1.linux-amd64/tsdb

2.準備工做linux

cp prometheus promtool /usr/local/bin/
mkdir -p /etc/prometheus/
cp prometheus.yml /etc/prometheus/

3.查看版本git

[root@iZ2ze40ci8v0g1kx9hqvs0Z prometheus-2.17.1.linux-amd64]# prometheus --version
prometheus, version 2.17.1 (branch: HEAD, revision: ae041f97cfc6f43494bed65ec4ea4e3a0cf2ac69)
  build user:       root@806b02dfe114
  build date:       20200326-16:18:19
  go version:       go1.13.9

4.添加系統服務github

vim /etc/systemd/system/prometheus.service

將如下內容寫入文件中web

[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/prometheus --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
Restart=on-failure
[Install]
WantedBy=multi-user.target

5.啓動服務,設置開機自啓,並檢查服務開啓狀態vim

systemctl daemon-reload
systemctl enable prometheus

6.啓動服務api

systemctl start prometheus

7.檢測服務狀態瀏覽器

systemctl status prometheus
● prometheus.service - Prometheus
   Loaded: loaded (/etc/systemd/system/prometheus.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-04-09 22:25:47 CST; 43min ago
     Docs: https://prometheus.io/
 Main PID: 21067 (prometheus)
   CGroup: /system.slice/prometheus.service
           └─21067 /usr/local/bin/prometheus --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml

Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: level=info ts=2020-04-09T14:25:47.899Z caller=head.go:624 component=tsdb msg="WAL segment loaded" segment=60 maxSegment=60
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: level=info ts=2020-04-09T14:25:47.899Z caller=head.go:627 component=tsdb msg="WAL replay completed" duration=15.120978ms
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: level=info ts=2020-04-09T14:25:47.900Z caller=main.go:683 fs_type=EXT4_SUPER_MAGIC
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: level=info ts=2020-04-09T14:25:47.900Z caller=main.go:684 msg="TSDB started"
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: level=info ts=2020-04-09T14:25:47.900Z caller=main.go:788 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: ts=2020-04-09T14:25:47.901Z caller=dedupe.go:112 component=remote level=info remote_name=0283ed url="http://localhost:8086/api/v1/prom/w... queue=0283ed
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: ts=2020-04-09T14:25:47.902Z caller=dedupe.go:112 component=remote level=info remote_name=0283ed url="http://localhost:8086/api/v1/prom/w... queue=0283ed
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: level=info ts=2020-04-09T14:25:47.902Z caller=main.go:816 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml
Apr 09 22:25:47 iZ2ze40ci8v0g1kx9hqvs0Z prometheus[21067]: level=info ts=2020-04-09T14:25:47.902Z caller=main.go:635 msg="Server is ready to receive web requests."

8.驗證web服務
瀏覽器打開http://IP:9090便可打開普羅米修斯自帶的監控頁面
1586445169419.jpgui

相關文章
相關標籤/搜索