标签:lib fail 数据源 ice restart job tar mic star
1.安装prometheus服务端#下载软件包
wget https://github.com/prometheus/prometheus/releases/download/v2.21.0/prometheus-2.21.0.linux-amd64.tar.gz
#解压
tar xf prometheus-2.21.0.linux-amd64.tar.gz -C /opt/
cd /opt/
mv prometheus-2.21.0.linux-amd64 prometheus
#配置systemctl启动
cat > /usr/lib/systemd/system/prometheus.service <<EOF
[Unit]
Description=https://prometheus.io
[Service]
Restart=on-failure
ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml
[Install]
WantedBy=multi-user.target
EOF
#启动prometheus
systemctl daemon-reload
systemctl start prometheus
#检查监听端口9090
[root@master opt]# netstat -lntup|grep 9090
#浏览器访问http://ip:9090主界面
#下载软件包
wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
#解压
tar xf node_exporter-1.0.1.linux-amd64.tar.gz -C /opt/
cd /opt
mv node_exporter-1.0.1.linux-amd64 node_exporter
#配置systemctl启动
cat > /usr/lib/systemd/system/node_exporter.service <<EOF
[Service]
User=root
Group=root
ExecStart=/opt/node_exporter/node_exporter
[Install]
WantedBy=multi-user.target
[Unit]
Description=node_exporter
After=network.target
EOF
#启动node_exporter
systemctl start node_exporter
#检查监听端口9100
netstat -lntup|grep 9100
#修改prometheus.yml配置文件,新增如下功能
vim /opt/prometheus/prometheus.yml
- job_name: ‘node1‘
static_configs:
- targets: [‘192.168.223.132:9100‘]
- job_name: ‘node2‘
static_configs:
- targets: [‘192.168.223.133:9100‘]
#重启
systemctl restart prometheus
#安装
wget https://dl.grafana.com/oss/release/grafana-5.3.4-1.x86_64.rpm
yum -y install grafana-5.3.4-1.x86_64.rpm
#启动
systemctl start grafana-server
systemctl enable grafana-server
#检查监听端口3000
netstat -lntup|grep 3000
#浏览器访问http://ip:3000主界面,用户名密码 admin / admin
#配置prometheus数据源
标签:lib fail 数据源 ice restart job tar mic star
原文地址:https://blog.51cto.com/dropak/2542963