01-prometheus监控系统-安装部署prometheus

一、准备环境

主机名ip配置
prometheus-server3110.0.0.311核1g-20GB
prometheus-server3210.0.0.311核1g-20GB
prometheus-server3310.0.0.311核1g-20GB

二、下载/上传软件包

1,软件包地址

这里给大家准备了百度云盘的安装包;

链接:https://pan.baidu.com/s/1fhg5UD1HkQo0XWrwHTkAzQ?pwd=9m5p 
提取码:9m5p

2,准备工作目录

[root@prometheus-server31 ~]# mkdir -pv /prometheus/{soft,data,logs}
[root@prometheus-server31 ~]# cd /prometheus/soft/

3,上传软件包

[root@prometheus-server31 soft]# rz -E
[root@prometheus-server31 soft]# tar xf prometheus-2.37.8.linux-amd64.tar.gz 
[root@prometheus-server31 soft]# ll
total 81396
drwxr-xr-x 4 1001  123      132 May  5  2023 prometheus-2.37.8.linux-amd64

做个软连接,方便操作

[root@prometheus-server31 soft]# ln -sv prometheus-2.37.8.linux-amd64 prometheus
‘prometheus’ -> ‘prometheus-2.37.8.linux-amd64’

三、启动prometheus

1,查看prometheus软连接中的文件

[root@prometheus-server31 soft]# cd prometheus

[root@prometheus-server31 prometheus]# ll
total 207040
drwxr-xr-x 2 1001 123        38 May  5  2023 console_libraries
drwxr-xr-x 2 1001 123       173 May  5  2023 consoles
-rw-r--r-- 1 1001 123     11357 May  5  2023 LICENSE
-rw-r--r-- 1 1001 123      3773 May  5  2023 NOTICE

#启动文件
-rwxr-xr-x 1 1001 123 109128753 May  5  2023 prometheus
-rw-r--r-- 1 1001 123       934 May  5  2023 prometheus.yml
-rwxr-xr-x 1 1001 123 102856799 May  5  2023 promtool

2,启动prometheus

[root@prometheus-server31 prometheus]# ./prometheus

3,检查端口9090

[root@prometheus-server31 ~]# netstat -tnulp

四、页面查看

浏览器访问:10.0.0.31:9090

你会发现一个非常丑的图,这代表你部署成功了;

五、配置systemctl启动文件

1,编辑启动文件

[root@prometheus-server31 ~]# vim /etc/systemd/system/prometheus-server.service

[Unit]
Description=xinjizhiwa Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target

[Service]
Restart=on-failure
ExecStart=/prometheus/soft/prometheus/prometheus \
    --config.file=/prometheus/soft/prometheus/prometheus.yml \
    --web.enable-lifecycle
ExecReload=/bin/kill -HUP \$MAINPID
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

2,重新加载systemctl

[root@prometheus-server31 ~]# systemctl daemon-reload 
[root@prometheus-server31 ~]# systemctl enable --now prometheus-server.service 

3,重新加载prometheus

[root@prometheus-server31 ~]# systemctl reload prometheus-server.service

#如果不管用,则使用下面的命令

curl -X POST http://10.0.0.31:9090/-/reload

六、查看启动后是否生成data/数据目录

[root@prometheus-server31 ~]# ll /prometheus/soft/prometheus/

至此,prometheus部署完毕;

  • 23
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

心机の之蛙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值