From 1e46f3364829fe78d3902dc45de98f76d70ccaf8 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Fri, 31 Jul 2026 09:51:21 -0400 Subject: [PATCH] fix: correct plugin import path in docs, wire up orphaned footer template docs/PLUGIN_DEVELOPMENT.md referenced a nonexistent hbd/plugin.py and hbd/plugins/ directory; the real module is hbd/client/plugin.py with plugins under hbd/client/plugins/, as README.md and the actual code already use. Anyone following the doc would hit ModuleNotFoundError. foot.html was never included by any template (confirmed via git grep and template audit) despite being actively maintained; wired it into about.html. menu.html was fully commented out and unreferenced, so removed it. Co-Authored-By: Claude Sonnet 5 --- docs/PLUGIN_DEVELOPMENT.md | 20 ++++++++++---------- hbd/server/templates/about.html | 2 ++ hbd/server/templates/menu.html | 2 -- 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 hbd/server/templates/menu.html diff --git a/docs/PLUGIN_DEVELOPMENT.md b/docs/PLUGIN_DEVELOPMENT.md index ed6caf0..e5bff6e 100644 --- a/docs/PLUGIN_DEVELOPMENT.md +++ b/docs/PLUGIN_DEVELOPMENT.md @@ -21,7 +21,7 @@ Heartbeat's plugin system is designed to be simple yet powerful. Plugins are Pyt ### Key Concepts - **Plugin Registry**: Central registry that manages all loaded plugins -- **Plugin Loader**: Automatically discovers and loads plugins from the `hbd/plugins/` directory +- **Plugin Loader**: Automatically discovers and loads plugins from the `hbd/client/plugins/` directory - **Plugin Types**: InfoPlugin (static data) and MonitorPlugin (periodic metrics) - **Async/Await**: All plugin methods are async for non-blocking operation @@ -64,7 +64,7 @@ Decide whether your plugin collects static information (InfoPlugin) or dynamic m ### Step 2: Create Plugin File -Create a new Python file in `hbd/plugins/` directory: +Create a new Python file in `hbd/client/plugins/` directory: ```python """ @@ -82,7 +82,7 @@ try: except ImportError: psutil = None -from hbd.plugin import MonitorPlugin # or InfoPlugin +from hbd.client.plugin import MonitorPlugin # or InfoPlugin logger = logging.getLogger(__name__) @@ -193,7 +193,7 @@ from pathlib import Path # Add parent directory to path sys.path.insert(0, str(Path(__file__).parent)) -from hbd.plugins.my_awesome_plugin import MyAwesomePlugin +from hbd.client.plugins.my_awesome_plugin import MyAwesomePlugin async def test(): # Create plugin instance @@ -224,7 +224,7 @@ Understanding the plugin lifecycle helps you implement plugins correctly: ``` 1. Plugin Discovery - └─> Loader scans hbd/plugins/ directory + └─> Loader scans hbd/client/plugins/ directory └─> Finds Python files (except those starting with _) └─> Imports modules @@ -378,7 +378,7 @@ Document your plugin thoroughly: ### Example 1: Simple InfoPlugin ```python -from hbd.plugin import InfoPlugin +from hbd.client.plugin import InfoPlugin import platform class SimpleInfoPlugin(InfoPlugin): @@ -406,7 +406,7 @@ plugin = SimpleInfoPlugin ### Example 2: MonitorPlugin with State ```python -from hbd.plugin import MonitorPlugin +from hbd.client.plugin import MonitorPlugin import time class CounterPlugin(MonitorPlugin): @@ -442,7 +442,7 @@ plugin = CounterPlugin ### Example 3: Plugin with External Command ```python -from hbd.plugin import MonitorPlugin +from hbd.client.plugin import MonitorPlugin import asyncio class CommandPlugin(MonitorPlugin): @@ -561,7 +561,7 @@ python -m hbd.hbc -c test_config.yaml --verbose ## Further Reading -- [Plugin Framework Source](../hbd/plugin.py) - Core plugin implementation -- [Built-in Plugins](../hbd/plugins/) - Examples of working plugins +- [Plugin Framework Source](../hbd/client/plugin.py) - Core plugin implementation +- [Built-in Plugins](../hbd/client/plugins/) - Examples of working plugins - [Nagios Integration](NAGIOS_INTEGRATION.md) - Running external plugins - [Configuration Guide](../hbd/config_example.yaml) - Full configuration reference diff --git a/hbd/server/templates/about.html b/hbd/server/templates/about.html index 944ec82..4850494 100644 --- a/hbd/server/templates/about.html +++ b/hbd/server/templates/about.html @@ -107,6 +107,8 @@ + {% include 'foot.html' %} +