password
查看人数
type
status
date
slug
summary
category
icon
tags
作者
状态
prometheus+node_exporter+mysqld_exporter+Grafana

Docker 方式安装

  • 下载并运行docker 镜像
Plain Text $ docker run --name prometheus -d -p 127.0.0.1:9090:9090 quay.io/prometheus/prometheus
  • Docker 管理 prometheus
Plain Text # 运行 docker ps 查看所有服务 docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e9ebc2435387 quay.io/prometheus/prometheus "/bin/prometheus -..." 26 minutes ago Up 26 minutes 127.0.0.1:9090->9090/tcp prometheus
运行 docker start prometheus 启动服务
运行 docker stats prometheus 查看 prometheus 状态
运行 docker stop prometheus 停止服务
UI 页面跟上面一样都使用 IP:9090

1)修改Prometheus主配置文件

2)重启Prometheus容器

node_exporter

服务器下载太慢时,可直接从github网站下载,并将压缩包上传至服务器。 文章最后分享了网盘链接也可自行下载。
tar -zxvf node_exporter-1.2.2.linux-amd64.tar.gz -C /usr/local/ cd /usr/local/ mv node_exporter-1.2.2.linux-amd64/ node_exporter/
nohup ./node_exporter &
导入模板8919 ,12884,

mysqld_exporter

tar -zxvf mysqld_exporter-0.14.0.linux-amd64.tar.gz
mv mysqld_exporter-0.14.0.linux-amd64 mysqld_exporter
cd mysqld_exporter
创建my.cnf
vi my.cnf
启动
nohup ./mysqld_exporter –config.my-cnf=‘my.cnf’&
使用模板(14057)
Grafana 安装
docker run -d -p 3000:3000 grafana/grafana
默认密码admin/admin

添加数据原为prometheus

notion image
notion image
notion image
保存提示
Error reading Prometheus: Post “http://localhost/:9090/api/v1/query”: dial tcp 127.0.0.1:80: connect: connection refused
如果是docker启动的Prometheus,url改为下面的

添加模板 (https://grafana.com/grafana/dashboards/ )

notion image
获取模板
notion image
node_exporter:8919 ,12884
mysqld_exporter:14057
nginx跨域配置python 运行字符串代码
Loading...