专栏文章 学习笔记:JMeter+InfluxDB+Grafana+Prometheus 搭建可视化性能实时监控平台

大海 · 2021年12月07日 · 3729 次阅读

安装 influxdb

https://portal.influxdata.com/downloads ,尽量不要选最新版防止有未知问题

下载完成后解压到本地如:D:\influxdb\influxdb-1.7.3-1, 使用 sublime text3 编辑 influxdb.conf,修改如下内容自行对比








win+R 进入 cmd ,切换到 influxdb 安装路径
D:\influxdb\influxdb-1.8.3-1>influxd -config influxdb.conf

服务不要关,另起一个 cmd


安装 grafana

https://grafana.com/grafana/download,一键到底
启动 grafana 服务后;浏览器进入:http://ip:3000 ,首次登陆名密码都是 admin,登陆后会让你配置密码
配置数据源


我们选导入模板,点击进入模板地址后往下拉一屏,点击进入详情


安装 Jmeter

自行下载 https://jmeter.apache.org/
配置 jmeter

最终效果

安装 Prometheus

下载地址

https://prometheus.io/download/

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]

上边注释已经很明确了:

  • global 是全局配置
  • scrape_interval 表示抓取的时间间隔
  • evaluation_interval 表示数据分析的时间间隔
  • Altering 表示告警的配置
  • Rule_files 表示表示规则配置
  • Scrape_configs 表示监控数据拉取的一些配置

其中 job_name 表示抓取的任务名称,static_configs 表示该任务下的一些静态配置,targets 表示要抓取的地址,显然这块可以配置多个。
这个后边再研究,这里的默认配置就是监控 prometheus 本身。

Grafana 配置 Prometheus 数据库




浏览器中输入 URL 打开

配置信息





执行脚本,查看数据



参考资料

http://testerhome.com/topics/16548
https://blog.csdn.net/weixin_45005677/article/details/113342957
https://www.freesion.com/article/2160149721/
https://www.jianshu.com/p/20b867553654
https://grafana.com/grafana/dashboards/?search=jmeter
https://www.jianshu.com/p/d2924790c69d
https://blog.csdn.net/tianjingle_blog/article/details/118005523
https://blog.csdn.net/yprufeng/article/details/116016858
https://qainsights.com/jmeter-prometheus-and-grafana-integration/
https://blog.csdn.net/weixin_39831902/article/details/111248462
https://blog.csdn.net/qq_38362419/article/details/108527506
https://blog.csdn.net/qq_25305833/article/details/122289483
https://testerhome.com/articles/22897

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
暫無回覆。
需要 登录 後方可回應,如果你還沒有帳號按這裡 注册