1.下载Prometheus软件
官网: https://prometheus.io/
下载软件:https://github.com/prometheus/prometheus/releases/download/v2.43.0/prometheus-2.43.0.linux-amd64.tar.gz
2.安装:
tar xf prometheus-2.43.0.linux-amd64.tar.gz -C /data/monior
mv prometheus-2.43.0.linux-amd64 prometheus
3.启动:
/data/monior/prometheus/prometheus --config.file='/data/monior/prometheus/prometheus.yml' &
4.启动日志:
日志文件4.1访问prometheus: http://ip:9090 (默认端口:9090)
4.2通过浏览器查看监控信息http://IP:9090/metrics
容器安装:
docker run --name prometheus -d -p 9090:9090 quay.io/prometheus/prometheus
5.单节点服务器监控部署(node_exporter):
下载地址:https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
安装:
tar xf node_exporter-1.5.0.linux-amd64.tar.gz -C /app/monior
mv /app/monior/node_exporter-1.5.0.linux-amd64 /app/monior/node_exporter
启动:
nohup /app/monior/node_exporter/node_exporter &
启动日志:
启动日志修改prometheus的配置文件:
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "memcache"
static_configs:
- targets: ['192.168.37.17:9100']
重启prometheus:
pkill prometheus
/data/monior/prometheus/prometheus --config.file='/data/monior/prometheus/prometheus.yml' &
6.prometheus界面查看:
界面7.安装Grafana
下载地址:wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.4.7-1.x86_64.rpm
安装:
yum install fontconfig urw-fonts -y
yum install polkit -y
rpm -ivh grafana-enterprise-9.4.7-1.x86_64.rpm
启动:
systemctl daemon-reload
systemctl start grafana-server.service
默认端口:3000
浏览器访问IP:3000,即可打开grafana页面,默认用户名密码都是admin,初次登录会要求修改默认的登录密码.
grafana页面8.添加数据源:
数据源1 配置信息 添加成功9.Grafana图形显示Linux硬件信息
Grafana官方提供模板地址:https://grafana.com/grafana/dashboards
要导入的模板:https://grafana.com/grafana/dashboards/11074
导入步骤:
步骤1 导入界面查看
网友评论