Repository navigation
Add LibreHardwareMonitor based OHM replacement - #963
Open
Tinnitus97 wants to merge 1 commit into
Open
Tinnitus97 wants to merge 1 commit into
Tinnitus97 wants to merge 1 commit into
Conversation
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
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.exebased 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.
To work with the current, unchanged agent and bakery, I adapted the CLI so that it deliberately presents itself as Open Hardware Monitor:
OpenHardwareMonitorCLI.exe, C# namespacesOpenHardwareMonitor.*LibreHardwareMonitorLib.dllis shipped renamed asOpenHardwareMonitorLib.dllroot\OpenHardwareMonitorThis 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:
agents/wnx/include/providers/ohm.h(kExeModule,kResetCommand, obsoletekDriverNameWide),agents/wnx/include/wnx/section_header.h(kWmiPathOhm,kOhm),providers/ohm.cpp/providers/wmi.cpp, bakery pluginwin_openhardwaremonitor.pyand its ruleset,agents/wnx/Makefile,third_party/openhardwaremonitor,doc/treasures/windows/ohm, the clean scripts, and the item naming incmk/plugins/openhardwaremonitorTODO(LHM rename)in the sourceThe complete list is in
agents/wnx/ohm/README.md, section "Important: Open Hardware Monitor naming is a temporary compatibility layer".Drop-in replacement
OpenHardwareMonitorCLI.exe+OpenHardwareMonitorLib.dll. The bakery pluginwin_openhardwaremonitordeploys them unchanged. All other dependencies are embedded in the EXE.root\OpenHardwareMonitor,Sensor/Hardware, same properties and types). The agent starts the CLI and runsSELECT Index,Name,Parent,SensorType,Value FROM Sensoras before.Adaptations for the check plugins
All in
agents/wnx/ohm/OpenHardwareMonitorCLI/IdentifierMapper.cs:/nvme/0→/hdd/0,/motherboard→/mainboard,/lpc/<chip>/0→/lpc/<chip>, …), so existing service names stay the sameDatain GB (LHM reports bytes since LibreHardwareMonitor/LibreHardwareMonitor@677a3a5, the parser multiplies by 2^30)Life→Remaining Lifeforopenhardwaremonitor_smart-nan(ind), which makesfloat()in the parser fail for the whole section)Testing
std::to_wstringformatting,WMIStatuscolumn), the bakery plugin and the check plugins.tests/unit/cmk/plugins/openhardwaremonitorpass.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/actionsNotes
WMI/*.csandUpdateVisitor.csare based on Open Hardware Monitor and keep their MPL-2.0 notices (GPL compatible). LibreHardwareMonitor (MPL-2.0) is fetched at build time.build.cmdbuilds LibreHardwareMonitor from a pinned commit (the one tested on real hardware);-p:LhmSource=nugetuses the NuGet release instead.agents/wnx/ohm/README.mdunder "Open points": the renaming above, integration into the agent build pipeline (e.g. viathird_partylike 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