下载

官网:https://prometheus.io/
下载:https://github.com/prometheus...

安装

1.解压

[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.准备工作

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

3.查看版本

[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.添加系统服务

vim /etc/systemd/system/prometheus.service

将以下内容写入文件中

[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.启动服务,设置开机自启,并检查服务开启状态

systemctl daemon-reload
systemctl enable prometheus

6.启动服务

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.jpg


LeeYonghu
4 声望0 粉丝

下一篇 »
influxdb 安装