Prometheus+node_exporter+grafana监控部署(上)

目录

一、部署Prometheus

二、部署node_exporter

三、把node_exporter加载进Prometheus

四、部署grafana

一、部署Prometheus

1、从官网下载好Prometheus的安装包

2、解压 tar xf prometheus-2.41.0.linux-amd64.tar.gz

3、做个软链方便更新   ln -sv prometheus-2.41.0.linux-amd64 prometheus

4、进入Prometheus所在的文件夹,启动  

./prometheus --config.file="/usr/local/prometheus/prometheus.yml" & (加个&是放在后台运行)也可以是

nohup ./prometheus --config.file="/usr/local/prometheus/prometheus.yml" &

5、Lsof -i:9090  查看端口是否已经监听,验证是否启动

6、然后浏览器访问 192.168.1.151:9090就会出现Prometheus的界面

7、此操作可以更改Prometheus的默认窗口

 ./prometheus --config.file=prometheus.yml  --web.listen-address=localhost:9191 

但是Prometheus.yml里的收集metrics的使用的仍是9090的话,访问9191将毫无意义

8、将Prometheus设为systemed管理

1.# cat /usr/lib/systemd/system/prometheus.service
2.[Unit]
3.Description=Prometheus Node Exporter
4.After=network.target
5. 
6.[Service]
7.ExecStart=/usr/local/prometheus/prometheus --config.file=/etc/prometheus.yml --web.read-timeout=5m  --web.max-connections=10 --storage.tsdb.retention=15d --storage.tsdb.path=/prometheus/data --query.max-concurrency=20 --query.timeout=2m
8.User=root
9.[Install]
10.WantedBy=multi-user.target

systemctl daemon-reload  重新加载配置

你可能感兴趣的:(Linux,prometheus,grafana,linux)