netalertx-plugin-run-development
GitHub指导如何创建、运行和测试 NetAlertX 插件。涵盖插件结构、配置、执行命令及结果获取,辅助插件开发工作流。
Trigger Scenarios
Install
npx skills add netalertx/NetAlertX --skill netalertx-plugin-run-development -g -y
SKILL.md
Frontmatter
{
"name": "netalertx-plugin-run-development",
"description": "Create and run NetAlertX plugins. Use this when asked to create plugin, run plugin, test plugin, plugin development, or execute plugin script."
}
Plugin Development
Expected Workflow for Running Plugins
- Read this skill document for context and instructions.
- Find the plugin in
server/plugins/<code_name>/. - Read the plugin's
config.jsonandscript.pyto understand its functionality and settings. - Formulate and run the command:
python3 server/plugins/<code_name>/script.py. - Retrieve the result from the plugin log folder (
/tmp/log/plugins/last_result.<PREF>.log) quickly, as the backend may delete it after processing.
Run a Plugin Manually
python3 server/plugins/<code_name>/script.py
Ensure sys.path includes /app/server/plugins and /app/server (as in the template).
Plugin Structure
server/plugins/<code_name>/
├── config.json # Manifest with settings
├── script.py # Main script
└── ...
Manifest Location
server/plugins/<code_name>/config.json
code_name== folder nameunique_prefixdrives settings and filenames (e.g.,ARPSCAN)
Settings Pattern
<PREF>_RUN: execution phase<PREF>_RUN_SCHD: cron-like schedule<PREF>_CMD: script path<PREF>_RUN_TIMEOUT: timeout in seconds — this is enforced by the core plugin runner as the whole script's kill-timeout (server/plugin.pypasses it straight tosubprocess(..., timeout=...)). It is not a safe per-HTTP-call timeout — don't reuse it for individual network calls in a loop, or one slow call can burn the whole budget and get the process killed before it writes its result file.<PREF>_WATCH: columns to watch for changes
Data Contract
Scripts write to /tmp/log/plugins/last_result.<PREF>.log
Important: The backend will almost immediately process this result file and delete it after ingestion. If you need to inspect the output, run the plugin and immediately retrieve the result file before the backend processes it.
Use server/plugins/plugin_helper.py:
from plugin_helper import Plugin_Objects
plugin_objects = Plugin_Objects()
plugin_objects.add_object(...) # During processing
plugin_objects.write_result_file() # Exactly once at end
Execution Phases
once: runs once at startupschedule: runs on cron schedulealways_after_scan: runs after every scanbefore_name_updates: runs before name resolutionon_new_device: runs when new device detectedon_notification: runs when notification triggered
Plugin Formats
| Format | Purpose | Runs |
|---|---|---|
| publisher | Send notifications | on_notification |
| dev scanner | Create/manage devices | schedule |
| name discovery | Discover device names | before_name_updates |
| importer | Import from services | schedule |
| system | Core functionality | schedule |
Before Opening a PR
Check the plugin against the Conventions Checklist in docs/PLUGINS_DEV.md — RUN default, schedule precedent, RUN_TIMEOUT semantics, reusing core settings, description length, and the multi-instance settings pattern. Most plugin PR review comments trace back to one of these.
Starting Point
Copy from server/plugins/__template and customize.
Version History
-
a686a01
Current 2026-09-03 06:47
改进了脚手架支持并优化了文档说明。
-
548d698
2026-08-19 22:09
插件目录从front/plugins迁移至server/plugins,并新增网站监控插件及相关工作流配置更新。
- 8aec57b 2026-07-24 22:14


