Skip to content

Add LibreHardwareMonitor based OHM replacement - #963

Open
Tinnitus97 wants to merge 1 commit into
Checkmk:masterfrom
Tinnitus97:librehardwaremonitor-ohm-cli
Open

Tinnitus97 wants to merge 1 commit into
Checkmk:masterfrom
Tinnitus97:librehardwaremonitor-ohm-cli

Conversation

@Tinnitus97

Copy link
Copy Markdown

Summary

Open Hardware Monitor was removed from the distribution with Werk #18537 because Windows Defender reports its WinRing0 driver as vulnerable (CVE-2020-14979). The werk says a proper replacement is being investigated. This PR contributes one: a headless replacement for OpenHardwareMonitorCLI.exe based on the actively developed LibreHardwareMonitor and the signed PawnIO driver.

As discussed in the forum, I am opening this PR so that the code can be used for an official integration.

⚠️ Important: "Libre" becomes "Open" – temporary compatibility layer

To work with the current, unchanged agent and bakery, I adapted the CLI so that it deliberately presents itself as Open Hardware Monitor:

  • executable OpenHardwareMonitorCLI.exe, C# namespaces OpenHardwareMonitor.*
  • LibreHardwareMonitorLib.dll is shipped renamed as OpenHardwareMonitorLib.dll
  • WMI namespace root\OpenHardwareMonitor
  • LibreHardwareMonitor identifiers are translated to Open Hardware Monitor identifiers

This is not meant to stay. For the official integration, the naming has to be changed to LibreHardwareMonitor in the Checkmk code and in this CLI in one change, otherwise agent and CLI no longer find each other:

  • Checkmk: agents/wnx/include/providers/ohm.h (kExeModule, kResetCommand, obsolete kDriverNameWide), agents/wnx/include/wnx/section_header.h (kWmiPathOhm, kOhm), providers/ohm.cpp / providers/wmi.cpp, bakery plugin win_openhardwaremonitor.py and its ruleset, agents/wnx/Makefile, third_party/openhardwaremonitor, doc/treasures/windows/ohm, the clean scripts, and the item naming in cmk/plugins/openhardwaremonitor
  • CLI: all places are marked with TODO(LHM rename) in the source

The complete list is in agents/wnx/ohm/README.md, section "Important: Open Hardware Monitor naming is a temporary compatibility layer".

Drop-in replacement

  • Same two files as before: OpenHardwareMonitorCLI.exe + OpenHardwareMonitorLib.dll. The bakery plugin win_openhardwaremonitor deploys them unchanged. All other dependencies are embedded in the EXE.
  • Same WMI namespace and classes (root\OpenHardwareMonitor, Sensor/Hardware, same properties and types). The agent starts the CLI and runs SELECT Index,Name,Parent,SensorType,Value FROM Sensor as before.
  • No changes to the Windows agent, the bakery plugin or the check plugins.

Adaptations for the check plugins

All in agents/wnx/ohm/OpenHardwareMonitorCLI/IdentifierMapper.cs:

  • OHM compatible identifiers (/nvme/0 → /hdd/0, /motherboard → /mainboard, /lpc/<chip>/0 → /lpc/<chip>, …), so existing service names stay the same
  • Data in GB (LHM reports bytes since LibreHardwareMonitor/LibreHardwareMonitor@677a3a5, the parser multiplies by 2^30)
  • Life → Remaining Life for openhardwaremonitor_smart
  • Constant limit values that LHM reports as temperatures (NVMe warning/critical temperature, DIMM thermal limits) are not published; they would become permanently CRIT temperature services
  • Fans only after their first rotation, like OHM (no services for unconnected fan headers)
  • Commas/line breaks in names and identifiers are replaced; NaN/Inf are published as 0 (the agent formats NaN as -nan(ind), which makes float() in the parser fail for the whole section)

Testing

  • Reviewed against the current agent code (process start, WMI query, std::to_wstring formatting, WMIStatus column), the bakery plugin and the check plugins.
  • Ran parser, discovery and all five check plugins (clock, temperature, fan, power, SMART) with real sensor data from a Ryzen system (NVMe + SATA SSDs, Nuvoton NCT6799D, DDR5): 64 services, no crashes; SMART, fans, power and clock OK. The existing unit tests in tests/unit/cmk/plugins/openhardwaremonitor pass.
  • On GitHub Actions (windows-latest), the CLI is built from the LibreHardwareMonitor source and the exact WMI query of the agent returns the published sensors: https://github.com/Tinnitus97/Libre_Hardware_Monitor_checkmk/actions

Notes

  • New files carry the Checkmk GPLv2 header. WMI/*.cs and UpdateVisitor.cs are based on Open Hardware Monitor and keep their MPL-2.0 notices (GPL compatible). LibreHardwareMonitor (MPL-2.0) is fetched at build time.
  • build.cmd builds LibreHardwareMonitor from a pinned commit (the one tested on real hardware); -p:LhmSource=nuget uses the NuGet release instead.
  • Not part of this PR, listed in agents/wnx/ohm/README.md under "Open points": the renaming above, integration into the agent build pipeline (e.g. via third_party like before), distribution of the PawnIO driver, doc/treasures/windows/ohm, and two possible improvements in the check plugins (skip non-numeric values in the parser, default temperature levels for current hardware).

Related: Ideas portal, forum thread

🤖 Generated with Claude Code

https://claude.ai/code/session_01GitjeitbSTC17n3ESBjdQN

Open Hardware Monitor was removed from the distribution with Werk
#18537 because Windows Defender reports its WinRing0 driver as
vulnerable (CVE-2020-14979). This adds a headless replacement for
OpenHardwareMonitorCLI.exe based on LibreHardwareMonitor and the
signed PawnIO driver.

It is a drop-in replacement: same two files
(OpenHardwareMonitorCLI.exe, OpenHardwareMonitorLib.dll), same WMI
namespace and classes (root\OpenHardwareMonitor: Sensor, Hardware).
The agent, the bakery plugin win_openhardwaremonitor and the check
plugins need no changes.

LibreHardwareMonitor data is adapted to what the check plugins
expect: OHM compatible identifiers, Data in GB, "Remaining Life" for
the SMART check, no constant limit values as temperatures, fans only
after their first rotation, separators and NaN values sanitized.

Note: to work with the unchanged agent, the CLI deliberately presents
itself as Open Hardware Monitor ("Libre" becomes "Open"): file names,
WMI namespace root\OpenHardwareMonitor and OHM identifiers. This is a
temporary compatibility layer. For the official integration it has to
be renamed to LibreHardwareMonitor in the agent (providers/ohm.h,
section_header.h, bakery plugin) and in the CLI in one change. All
places are listed in agents/wnx/ohm/README.md and marked with
TODO(LHM rename) in the CLI source.

The source is placed in agents/wnx/ohm, where the source of the
original CLI used to be. build.cmd builds LibreHardwareMonitor from a
pinned commit together with the CLI.

Related: https://ideas.checkmk.com/suggestions/535894
Related: https://forum.checkmk.com/t/47175

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GitjeitbSTC17n3ESBjdQN
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Tinnitus97

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants