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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
4c3a63e645
commit
1e46f33648
+10
-10
@@ -21,7 +21,7 @@ Heartbeat's plugin system is designed to be simple yet powerful. Plugins are Pyt
|
|||||||
### Key Concepts
|
### Key Concepts
|
||||||
|
|
||||||
- **Plugin Registry**: Central registry that manages all loaded plugins
|
- **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)
|
- **Plugin Types**: InfoPlugin (static data) and MonitorPlugin (periodic metrics)
|
||||||
- **Async/Await**: All plugin methods are async for non-blocking operation
|
- **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
|
### 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
|
```python
|
||||||
"""
|
"""
|
||||||
@@ -82,7 +82,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
psutil = None
|
psutil = None
|
||||||
|
|
||||||
from hbd.plugin import MonitorPlugin # or InfoPlugin
|
from hbd.client.plugin import MonitorPlugin # or InfoPlugin
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ from pathlib import Path
|
|||||||
# Add parent directory to path
|
# Add parent directory to path
|
||||||
sys.path.insert(0, str(Path(__file__).parent))
|
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():
|
async def test():
|
||||||
# Create plugin instance
|
# Create plugin instance
|
||||||
@@ -224,7 +224,7 @@ Understanding the plugin lifecycle helps you implement plugins correctly:
|
|||||||
|
|
||||||
```
|
```
|
||||||
1. Plugin Discovery
|
1. Plugin Discovery
|
||||||
└─> Loader scans hbd/plugins/ directory
|
└─> Loader scans hbd/client/plugins/ directory
|
||||||
└─> Finds Python files (except those starting with _)
|
└─> Finds Python files (except those starting with _)
|
||||||
└─> Imports modules
|
└─> Imports modules
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ Document your plugin thoroughly:
|
|||||||
### Example 1: Simple InfoPlugin
|
### Example 1: Simple InfoPlugin
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from hbd.plugin import InfoPlugin
|
from hbd.client.plugin import InfoPlugin
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
class SimpleInfoPlugin(InfoPlugin):
|
class SimpleInfoPlugin(InfoPlugin):
|
||||||
@@ -406,7 +406,7 @@ plugin = SimpleInfoPlugin
|
|||||||
### Example 2: MonitorPlugin with State
|
### Example 2: MonitorPlugin with State
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from hbd.plugin import MonitorPlugin
|
from hbd.client.plugin import MonitorPlugin
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class CounterPlugin(MonitorPlugin):
|
class CounterPlugin(MonitorPlugin):
|
||||||
@@ -442,7 +442,7 @@ plugin = CounterPlugin
|
|||||||
### Example 3: Plugin with External Command
|
### Example 3: Plugin with External Command
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from hbd.plugin import MonitorPlugin
|
from hbd.client.plugin import MonitorPlugin
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
class CommandPlugin(MonitorPlugin):
|
class CommandPlugin(MonitorPlugin):
|
||||||
@@ -561,7 +561,7 @@ python -m hbd.hbc -c test_config.yaml --verbose
|
|||||||
|
|
||||||
## Further Reading
|
## Further Reading
|
||||||
|
|
||||||
- [Plugin Framework Source](../hbd/plugin.py) - Core plugin implementation
|
- [Plugin Framework Source](../hbd/client/plugin.py) - Core plugin implementation
|
||||||
- [Built-in Plugins](../hbd/plugins/) - Examples of working plugins
|
- [Built-in Plugins](../hbd/client/plugins/) - Examples of working plugins
|
||||||
- [Nagios Integration](NAGIOS_INTEGRATION.md) - Running external plugins
|
- [Nagios Integration](NAGIOS_INTEGRATION.md) - Running external plugins
|
||||||
- [Configuration Guide](../hbd/config_example.yaml) - Full configuration reference
|
- [Configuration Guide](../hbd/config_example.yaml) - Full configuration reference
|
||||||
|
|||||||
@@ -107,6 +107,8 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include 'foot.html' %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
var startEpoch = {{ start_epoch }};
|
var startEpoch = {{ start_epoch }};
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
<!-- <label for="drawer-toggle" id="drawer-toggle-label"></label>
|
|
||||||
s<header>{{ header }}</header> -->
|
|
||||||
Reference in New Issue
Block a user