Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

node_systemd_unit_state metrics silently ignores units that systemd failed to load

未关闭
#3,347 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
go

调研方向

从 collector/systemd_linux.go 中第 494-499 行附近的过滤逻辑开始,然后阅读引入该逻辑的关联 commit。确定加载失败的单元是否应直接报告,还是应由 CLI 标志控制,并验证生成的指标包含加载状态不是 loaded 的单元。

由索引模型根据 Issue 内容生成。

描述

Systemd units have two status fields, "load state" and "active state". Node Exporter only reports on active state. If a unit has any load state other than "loaded" it is silently ignored (unless debug logging is enabled, but it still does not appear in metrics).

Practical example: if a .timer unit has an invalid OnCalendar value (if like me you mistakenly assumed it would support typical crontab syntax), then the timer will fail to load and never be reported in any metrics by Node Exporter.

This filtering is done here: https://github.com/prometheus/node_exporter/blob/2179f0a34d2d7b6212f3a1c647d5aca44ffa33e5/collector/systemd_linux.go#L494-L499

It was added in this commit: https://github.com/prometheus/node_exporter/commit/0fdc089187c3d5d9fe62e528653986ee6e71325b

I am not sure why this filter was added, but i feel that being able to alert on units that failed to load would be a useful safety feature. Could this filter either be removed or controlled by a CLI flag?
Thanks!

主要语言
Go
星标
13.8k
派生
2.7k
平均合并
1 天 4 小时
30 天内合并 PR
7

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

prometheus/node_exporter 的其他 Issue

查看 prometheus/node_exporter 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。