跳转到主要内容

将Flux实例指标导出到Prometheus

项目描述

Prometheus Flux

All Contributors

PyPI

导出关于Flux的Prometheus指标。

🚧️ 开发中 🚧️

此工具处于开发中,尚未准备用于生产。它相当简单,因此文档包含在README.md中。要查看pypi上的包

使用方法

安装

您可以从pypi或从源安装

$ python -m venv env
$ source env/bin/activate
$ pip install prometheus-flux

# or

$ git clone https://github.com/converged-computing/prometheus-flux
$ cd prometheus-flux
$ pip install
# you can also do "pip install -e ."

这将安装可执行文件到您的路径中,这可能是您本地用户的bin

$ which prometheus-flux
/home/vscode/.local/bin/prometheus-flux

请注意,提供的 .devcontainer 包含一个VSCode环境,其中您有Flux并可以安装此工具并立即使用!

启动

您需要在Flux实例中运行,因为我们需要连接到代理处理程序。

$ flux start --test-size=4

然后启动服务器。这将使用默认端口和主机(0.0.0.0:8080),您可以根据需要自定义。

$ prometheus-flux start

# customize the port or host
$ prometheus-flux start --port 9000 --host 127.0.0.1

例如,当Flux在没有作业(并使用默认选项)运行时,我们可以打开浏览器到 http://localhost:8080/metrics/ 来查看

# HELP flux_queue_state_counts Gauge for the counting job states in the queue.
# TYPE flux_queue_state_counts gauge
flux_queue_state_counts{state="INACTIVE"} 2.0
# HELP flux_node_cores_counts Gauge for the counting of cores in different states.
# TYPE flux_node_cores_counts gauge
flux_node_cores_counts{state="up"} 16.0
flux_node_cores_counts{state="free"} 16.0
# HELP flux_node_counts Total number of nodes in different states
# TYPE flux_node_counts gauge
flux_node_counts{state="up"} 4.0
flux_node_counts{state="free"} 4.0

如果您以 --verbose 模式运行,您还会看到服务器的指标

$ prometheus-flux start --verbose
示例Prometheus数据输出
# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 452.0
python_gc_objects_collected_total{generation="1"} 43.0
python_gc_objects_collected_total{generation="2"} 0.0
# HELP python_gc_objects_uncollectable_total Uncollectable objects found during GC
# TYPE python_gc_objects_uncollectable_total counter
python_gc_objects_uncollectable_total{generation="0"} 0.0
python_gc_objects_uncollectable_total{generation="1"} 0.0
python_gc_objects_uncollectable_total{generation="2"} 0.0
# HELP python_gc_collections_total Number of times this generation was collected
# TYPE python_gc_collections_total counter
python_gc_collections_total{generation="0"} 85.0
python_gc_collections_total{generation="1"} 7.0
python_gc_collections_total{generation="2"} 0.0
# HELP python_info Python platform information
# TYPE python_info gauge
python_info{implementation="CPython",major="3",minor="8",patchlevel="10",version="3.8.10"} 1.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.24461056e+08
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 3.4168832e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.68539579014e+09
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.22
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 13.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP flux_queue_state_counts Gauge for the counting job states in the queue.
# TYPE flux_queue_state_counts gauge
flux_queue_state_counts{state="INACTIVE"} 2.0
# HELP flux_node_cores_counts Gauge for the counting of cores in different states.
# TYPE flux_node_cores_counts gauge
flux_node_cores_counts{state="up"} 16.0
flux_node_cores_counts{state="free"} 16.0
# HELP flux_node_counts Total number of nodes in different states
# TYPE flux_node_counts gauge
flux_node_counts{state="up"} 4.0
flux_node_counts{state="free"} 4.0

请注意,我们正在测试此功能以帮助Kubernetes的自动扩展,这意味着指标将用于确定是否应该请求扩展或缩小集群。

Docker

我们有一个Docker容器,您可以根据自己的需求进行定制,但它更倾向于用作演示。您可以自己构建,或者使用我们的构建版本。

$ docker build -t promflux .
$ docker run -it -p 8080:8080 promflux

或者

$ docker run -it -p 8080:8080 ghcr.io/converged-computing/prometheus-flux

您可以在浏览器中打开http://localhost:8080/metrics/来查看指标!

😁️ 贡献者 😁️

我们使用all-contributors工具来生成下面的贡献者图形。

Vanessasaurus
Vanessasaurus

💻

许可证

HPCIC DevTools是在MIT许可证的条款下分发的。所有新的贡献都必须在这个许可证下进行。

请参阅LICENSECOPYRIGHTNOTICE以获取详细信息。

SPDX-License-Identifier: (MIT)

LLNL-CODE- 842614

项目详情


下载文件

下载适用于您平台的应用程序。如果您不确定选择哪一个,请了解更多关于安装包的信息。

源分布

prometheus-flux-0.0.0.tar.gz (11.8 kB 查看散列值)

上传时间

支持