prometheus的安装和grafana的可视化图形界面

一 准备以下软件包(告警  grafana可视化界面 node  prometheus监控 )并将包依次导入虚拟机中

二  导入prometheus的tar包,将tar包存放在/usr/local路径下

[root@prometheus ~]# cd /usr/local
[root@prometheus local]# rz -E
rz waiting to receive.
[root@prometheus local]# ls
bin  etc  games  include  lib  lib64  libexec  prometheus-2.53.1.linux-amd64.tar.gz  sbin  share  src
[root@prometheus local]# 

三 解压tar包,重命名

bin  etc  games  include  lib  lib64  libexec  prometheus-2.53.1.linux-amd64.tar.gz  sbin  share  src
[root@prometheus local]# tar zxvf prometheus-2.53.1.linux-amd64.tar.gz 
prometheus-2.53.1.linux-amd64/
prometheus-2.53.1.linux-amd64/prometheus.yml
prometheus-2.53.1.linux-amd64/prometheus
prometheus-2.53.1.linux-amd64/consoles/
prometheus-2.53.1.linux-amd64/consoles/node-disk.html
prometheus-2.53.1.linux-amd64/consoles/node-overview.html
prometheus-2.53.1.linux-amd64/consoles/node-cpu.html
prometheus-2.53.1.linux-amd64/consoles/node.html
prometheus-2.53.1.linux-amd64/consoles/prometheus-overview.html
prometheus-2.53.1.linux-amd64/consoles/index.html.example
prometheus-2.53.1.linux-amd64/consoles/prometheus.html
prometheus-2.53.1.linux-amd64/LICENSE
prometheus-2.53.1.linux-amd64/promtool
prometheus-2.53.1.linux-amd64/console_libraries/
prometheus-2.53.1.linux-amd64/console_libraries/menu.lib
prometheus-2.53.1.linux-amd64/console_libraries/prom.lib
prometheus-2.53.1.linux-amd64/NOTICE
[root@prometheus local]# mv prometheus-2.53.1.linux-amd64 prometheus

四  ,切换到prometheus目录,备份prometheus.yml文件(以防万一)修改prometheus.yml文件,红线里面的换成虚拟机的IP地址

[root@prometheus local]# cd prometheus/
[root@prometheus prometheus]# ls
console_libraries  consoles  LICENSE  NOTICE  prometheus  prometheus.yml  promtool
[root@prometheus prometheus]# cp prometheus.yml prometheus.bak
[root@prometheus prometheus]# ls
console_libraries  consoles  LICENSE  NOTICE  prometheus  prometheus.bak  prometheus.yml  promtool
[root@prometheus prometheus]# vim prometheus.yml 

设置Prometheus的用户组和用户都为root

[root@prometheus local]# chown -R root:root ./prometheus
[root@prometheus local]# ll
总用量 101752
drwxr-xr-x. 2 root root       134 6月  29 14:57 bin
drwxr-xr-x. 2 root root         6 4月  11 2018 etc
drwxr-xr-x. 2 root root         6 4月  11 2018 games
drwxr-xr-x. 2 root root         6 4月  11 2018 include
drwxr-xr-x. 2 root root         6 4月  11 2018 lib
drwxr-xr-x. 2 root root         6 4月  11 2018 lib64
drwxr-xr-x. 2 root root         6 4月  11 2018 libexec
drwxr-xr-x. 4 root root       154 7月  24 09:16 prometheus
-rw-r--r--. 1 root root 104191695 7月  23 15:52 prometheus-2.53.1.linux-amd64.tar.gz
drwxr-xr-x. 2 root root         6 4月  11 2018 sbin
drwxr-xr-x. 5 root root        49 6月  29 17:49 share
drwxr-xr-x. 3 root root        51 6月  29 14:55 src
[root@prometheus local]# 

五 设置开机自启动,创建prometheus.service,添加以下内容,保存退出

[root@prometheus prometheus]# cd /usr/lib/systemd/system
[root@prometheus system]# vim prometheus.service
[Unit]
Description=Prometheus server
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/usr/local/prometheus/data --web.external-url=http://0.0.0.0:9090

[Install]
WantedBy=mult
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值