feat: add System Monitor sensor plugin for hardware telemetry#4
Closed
luckyson113 wants to merge 6 commits intosrc/inputs/plugins/system_monitor.pyfrom
Closed
feat: add System Monitor sensor plugin for hardware telemetry#4luckyson113 wants to merge 6 commits intosrc/inputs/plugins/system_monitor.pyfrom
luckyson113 wants to merge 6 commits intosrc/inputs/plugins/system_monitor.pyfrom
Conversation
Implemented the SystemMonitorSensor in `src/inputs/plugins/system_monitor.py` to track hardware health. Key changes: - Inherits correctly from `Sensor[dict]` (inputs/base). - Implements required abstract methods: `_listen_loop`, `formatted_latest_buffer`, and `raw_to_text`. - Monitors CPU usage, Memory usage, and Temperature using `psutil`. - Includes robust exception handling and Mock mode support for non-hardware environments. - Complies with Ruff/Black formatting standards (sorted imports, relative imports).
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.
Overview
This PR introduces the
SystemMonitorSensorto the OM1 sensor suite. This plugin allows the AI Agent to self-monitor its hardware health (CPU Load, RAM Usage, and Thermal status), which is essential for stability when deployed on edge devices like Raspberry Pi or Jetson.Changes
src/inputs/plugins/system_monitor.py.SystemMonitorSensorinheriting correctly fromSensor[dict](referencingsrc/inputs/base)._listen_loopto yield metrics asynchronously every 2 seconds.formatted_latest_bufferto allow the LLM/Fuser to read system status as context.raw_to_textfor JSON logging.mock_modeand robust exception handling (catchingpsutilspecific errors) to ensure the agent doesn't crash on unsupported hardware (Docker/MacOS).Testing
ruff check .with strict import sorting (I001) and specific exception handling (BLE001).mock_mode=True(safe for CI/CD).psutilto fetch real CPU/RAM metrics.Impact
psutil(standard system monitoring library).Additional Information
This implementation fixes previous import sorting issues by placing the file in the correct
src/inputs/pluginsdirectory and using relative imports (from ..base import Sensor) as per the project structure.