介绍一个prometheus监控数据生成工具

prometheus-data-generator

Prometheus数据模拟工具旨在通过配置文件模拟Prometheus数据,用于测试和开发目的。该工具允许您生成用于测试和开发的合成数据。

配置

工具的配置信息存储在一个YAML文件中。以下部分描述了可用的选项:

yaml 复制代码
template_dir: ./templates
output_dir: ./output
template_value_dir: ./template_values

global_config:
  template_value_path: ./template_values_without_unix.json
  days: 1
  resolution_seconds: 15
  endtime_unix: 1698048047

template_without_unix_configs:
  - name: nvidia_gpu_exporter
    template_value_path: gpu_node_2.json

template_with_unix_configs:
  - name: nvidia_gpu_exporter_with_unix
    template_value_path: samples_gpu_node_1.json

全局配置

全局配置部分包含适用于所有模板的设置,这些设置在global_config键下指定。可用的选项有:

  • template_value_path: 包含模板值的JSON文件的路径。默认情况下,工具在template_values目录中查找此文件。
  • days: 生成数据的天数。默认值为30。
  • resolution_seconds: 生成数据的分辨率(秒)。默认值为15。
  • endtime_unix: 生成数据的结束时间的Unix时间戳。默认值为1698048047。

模板配置

模板配置定义了各个模板及其特定设置。有两种类型的模板配置:

  • 无Unix时间戳的模板

    在template_without_unix_configs键下定义无Unix时间戳的模板配置。每个模板配置包括以下选项:

    • name: 模板的名称。
    • template_value_path: 包含此模板特定模板值的JSON文件的路径。默认情况下,工具在template_values目录中查找此文件。
  • 带Unix时间戳的模板

    在template_with_unix_configs键下定义带Unix时间戳的模板配置。每个模板配置包括以下选项:

    • name: 模板的名称。
    • template_value_path: 包含此模板特定模板值的JSON文件的路径。默认情况下,工具在template_values目录中查找此文件。

使用

shell 复制代码
./prometheus-data-generator --config.file=config.yaml
Dec  1 03:46:22.488 nvidia_gpu_exporter, 2023-10-22T08:00:47Z -> 2023-10-23T08:00:47Z, step: 15s
Dec  1 03:46:22.488 progress: 0%, 2023-10-22T08:00:47Z -> 2023-10-22T10:00:00Z
Dec  1 03:46:22.488 process template...
Dec  1 03:46:22.722 create blocks...
BLOCK ULID                  MIN TIME                       MAX TIME                       DURATION     NUM SAMPLES  NUM CHUNKS   NUM SERIES   SIZE
01HGHQR4GFSFXM8Q5SSNW7Y1RJ  2023-10-22 08:00:47 +0000 UTC  2023-10-22 09:59:47 +0000 UTC  1h59m0.001s  30528        256          64           72KiB840B
Dec  1 03:46:22.950 progress: 8%, 2023-10-22T10:00:00Z -> 2023-10-22T12:00:00Z
Dec  1 03:46:22.950 process template...
Dec  1 03:46:23.118 create blocks...

文件下载

https://github.com/gmodx/prometheus-data-generator/releases/tag/v1.0.1

源码

https://github.com/gmodx/prometheus-data-generator

相关推荐
Dovis(誓平步青云)12 小时前
《如何通过prometheus-webhook-dingtalk解决 Alertmanager 原生不支持钉钉 Webhook问题》
人工智能·生成对抗网络·钉钉·运维开发·prometheus
KK溜了溜了1 天前
Prometheus监控主机,Grafana成图
grafana·prometheus
伏加特遇上西柚1 天前
Loki+Alloy+Grafana日志采集部署
java·linux·服务器·spring boot·grafana·prometheus
川石课堂软件测试2 天前
软件测试|常见面试题整理
数据库·python·jmeter·mysql·appium·postman·prometheus
蜀道山老天师2 天前
云原生监控入门:监控基础概念 + SLI/SLO/SLA 详解 + Prometheus 从零安装配置
linux·运维·云原生·prometheus
专业白嫖怪2 天前
监控平台Prometheus+Grafana的部署
运维·grafana·prometheus
Elastic 中国社区官方博客3 天前
从平均值到任意百分位数:Elasticsearch 在 ES|QL 中原生支持指数直方图
大数据·数据库·sql·elasticsearch·搜索引擎·全文检索·prometheus
Elastic 中国社区官方博客3 天前
在 Elasticsearch 中使用原生 PromQL 支持查询 Prometheus 指标
大数据·elasticsearch·搜索引擎·信息可视化·全文检索·prometheus
Elastic 中国社区官方博客3 天前
Elastic 9.4:Workflows 正式发布、Agent Builder 更新,以及 Prometheus / PromQL 支持
运维·数据库·人工智能·elasticsearch·搜索引擎·信息可视化·prometheus
无所事事O_o5 天前
【监控报警体系建设】监控标准与最佳实践
java·架构·监控