一、安装概览
安装go 语言环境
在监控服务器上安装prometheus
在被监控环境上安装export
安装grafana
二、详细步骤
步骤1:安装go 语言环境
wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz vim /etc/profile 添加以下内容 export PATH=$PATH:/usr/local/go/bin 验证结果 go version
步奏2:安装prometheus
官网下载地址:https://prometheus.io/download/ wget https://github.com/prometheus/prometheus/releases/download/v2.27.1/prometheus-2.27.1.linux-amd64.tar.gz tar -xf prometheus-2.27.1.linux-amd64.tar.gz -C /data/ mv /data/prometheus-2.27.1.linux-amd64/ /data/prometheus
步奏3:加入系统启动命令
cd /usr/lib/systemd/system vim prometheus.service [Unit] Description=https://prometheus.io [Service] Restart=on-failure ExecStart=/data/prometheus/prometheus --config.file=/data/prometheus/prometheus.yml [Install] WantedBy=multi-user.target
启动
systemctl daemon-reload
systemctl start prometheus
systemctl stop prometheus