一、下载
官方下载地址:https://prometheus.io/download/
[root@server1 ~]# ls
[root@server1 ~]# mkdir prometheus
[root@server1 ~]# cd prometheus/
[root@server1 prometheus]# cd
[root@server1 ~]# ls
prometheus prometheus-2.29.0-rc.1.linux-amd64.tar.gz #下载的2.29.0版本
二、安装Prometheus,并启动
[root@server1 ~]# mv prometheus-2.29.0-rc.1.linux-amd64.tar.gz prometheus
[root@server1 ~]# cd prometheus/
[root@server1 prometheus]# ls
\prometheus-2.29.0-rc.1.linux-amd64.tar.gz
[root@server1 prometheus]# tar -C /usr/local/ -xvf prometheus-2.29.0-rc.1.linux-amd64.tar.gz #解压到指定目录
[root@server1 prometheus]# ln -sv /usr/local/prometheus-2.29.0-rc.1.linux-amd64/ /usr/local/Prometheus #做软连接
‘/usr/local/Prometheus’ -> ‘/usr/local/prometheus-2.29.0-rc.1.linux-amd64/’
[root@server1 prometheus]# vim /usr/local/Prometheus/prometheus.yml #编辑默认配置文件
[root@server1 prometheus]# /usr/local/Prometheus/prometheus --config.file=/usr/local/Prometheus/prometheus.yml & #启动prometheus
三、浏览器访问
浏览器打开IP:9090端口即可打开普罗米修斯自带的监控页面
http://172.25.14.1:9090
四、安装Grafana
普罗米修斯默认的页面可能没有那么直观,我们可以安装grafana使监控看起来更直观 官网下载地址:https://grafana.com/grafana/download
wget https://dl.grafana.com/oss/release/grafana-8.1.0-1.x86_64.rpm
sudo yum install grafana-8.1.0-1.x86_64.rpm
1.真机下载,上传至虚拟机server1
[root@foundation50 Downloads]# wget https://dl.grafana.com/oss/release/grafana-8.1.0-1.x86_64.rpm
--2021-08-06 22:09:09-- https://dl.grafana.com/oss/release/grafana-8.1.0-1.x86_64.rpm
Resolving dl.grafana.com (dl.grafana.com)... 2a04:4e42:6::729, 151.101.42.217
Connecting to dl.grafana.com (dl.grafana.com)|2a04:4e42:6::729|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 57008341 (54M) [application/x-redhat-package-manager]
Saving to: ‘grafana-8.1.0-1.x86_64.rpm’
grafana-8.1.0-1.x86_64.rpm 100%[================================================>] 54.37M 4.00MB/s in 22s
2021-08-06 22:09:39 (2.45 MB/s) - ‘grafana-8.1.0-1.x86_64.rpm’ saved [57008341/57008341]
[root@foundation50 Downloads]# scp grafana-8.1.0-1.x86_64.rpm 172.25.14.1:
root@172.25.14.1's password:
grafana-8.1.0-1.x86_64.rpm 100% 54MB 265.1MB/s 00:00
[root@foundation50 Downloads]# ls
grafana-8.1.0-1.x86_64.rpm prometheus-2.29.0-rc.1.linux-amd64.tar.gz
[root@foundation50 Downloads]#
## 2.安装
[root@server1 prometheus]# ls
data prometheus-2.29.0-rc.1.linux-amd64.tar.gz
[root@server1 prometheus]# cd
[root@server1 ~]# ls
grafana-8.1.0-1.x86_64.rpm prometheus
[root@server1 ~]# mv grafana-8.1.0-1.x86_64.rpm prometheus/
[root@server1 ~]# ls
prometheus
[root@server1 ~]# cd prometheus/
[root@server1 prometheus]# ls
data grafana-8.1.0-1.x86_64.rpm prometheus-2.29.0-rc.1.linux-amd64.tar.gz
[root@server1 prometheus]# yum install grafana-8.1.0-1.x86_64.rpm #安装
五、启动
[root@server1 prometheus]# systemctl daemon-reload #刷新
[root@server1 prometheus]# systemctl start grafana-server.service #启动服务
[root@server1 prometheus]# systemctl enable grafana-server.service #设置开机自启
Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.
[root@server1 prometheus]# systemctl status grafana-server
[root@server1 prometheus]# netstat -ntlp | grep grafana-serve
六、浏览器访问
访问grafana 浏览器访问IP:3000端口,即可打开grafana页面,默认用户名密码都是admin,初次登录会要求修改默认的登录密码
172.25.14.1:3000
|