You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
14
15
15
### Changed
16
16
17
+
* Add ruff linter and formatter to pre-commit hooks, enforce single-quote style
17
18
* CONTRIBUTING: add "no continuous counters" policy with rationale and link to example plugin ([#320](https://github.com/Linuxfabrik/monitoring-plugins/issues/320))
18
19
* CONTRIBUTING: add early reference to example plugin as skeleton for new plugins
19
20
* CONTRIBUTING: add Grafana migration note for grafanactl ([#1062](https://github.com/Linuxfabrik/monitoring-plugins/issues/1062))
21
+
* CONTRIBUTING: add PEP 8 string quoting convention (single quotes, `"""` for triple-quoted)
22
+
* CONTRIBUTING: add README structure guidelines with fixed section order, Fact Sheet template, and Nagios/Icinga check name for SEO
20
23
* CONTRIBUTING: rewrite unit-test section with declarative test pattern, naming conventions, and tox usage
21
24
* CONTRIBUTING: run pylint without `--disable` flags
22
25
* CONTRIBUTING: remove inline `pylint: disable` comments from code examples
23
26
* example: rewrite as comprehensive skeleton covering all standard patterns (argparse, SQLite delta calculations, regex filtering, `--lengthy` table output, human-readable formatting, get_state/get_worst, Grafana-compatible perfdata)
27
+
* example: rewrite README as skeleton template with Overview, Fact Sheet, States, Perfdata, and Troubleshooting sections
24
28
* Update and extend pre-commit hooks (add `check-added-large-files`, `check-merge-conflict`, `check-yaml`; update all hook versions)
25
29
* Unify CONTRIBUTING and enhance it with the official Monitoring Plugins and Nagios Plugin Development Guidelines
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -585,6 +585,8 @@ A monitoring plugin has to calculate such values always on its own. If this is n
585
585
586
586
We use [PEP 8 -- Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/) where it makes sense.
587
587
588
+
**String quoting:** Use single quotes as the default. Use double quotes only inside f-string expressions (e.g. `f'{lib.base.state2str(state, prefix=" ")}'`) or when the string itself contains single quotes (e.g. `'Python module "psutil" is not installed.'`). Use `"""` for all triple-quoted strings (docstrings, `DESCRIPTION`, SQL, etc.). This is enforced by `ruff format`.
589
+
588
590
589
591
### Docstrings
590
592
@@ -830,6 +832,43 @@ If you want to create a Service Set, edit `assets/icingaweb2-module-director/all
830
832
If you want to move a service from one Service Set to another, you have to create a new UUID for the new service (this isn't even possible in the Icinga Director GUI).
831
833
832
834
835
+
### README Structure
836
+
837
+
Each plugin README follows a fixed structure. See [check-plugins/example/README.md](check-plugins/example/README.md) for the reference template. The sections are:
838
+
839
+
1. **Overview**: Describes *what* the plugin does. A leading sentence stating the main purpose. This must include at least the text from the plugin's `DESCRIPTION` variable. Followed by subsections:
840
+
841
+
* **Data Collection**: How data is gathered (shell command, API, psutil, etc.), filtering options, SQLite usage, non-blocking measurement.
842
+
* **Compatibility**: Supported platforms, required tools or modules.
843
+
* **Important Notes** (optional): Operational edge cases the admin must know before deploying, for example: "Requires sudo", "Only works with Redis 3.0+", "First run returns OK with 'Waiting for more data.'", "After a reboot, counters reset and the check waits for a new baseline". No implementation details - only things that affect deployment and daily operations.
844
+
845
+
2. **Fact Sheet**: Key properties as a table (download link, check name, check interval, parameters required, Windows support, 3rd party modules, state file path, etc.). Only list applicable rows.
| Nagios/Icinga Check Name | `check_example` (for SEO: helps admins find the plugin when searching for the traditional Nagios-style name) |
851
+
| Check Interval Recommendation | Every minute, Every 5/15/30 minutes, Every hour, Every 4/8/12 hours, Every day, Every week |
852
+
| Can be called without parameters | Yes/No |
853
+
| Compiled for Windows | Yes (when `.windows` file exists)/No (runs with Python interpreter) |
854
+
| Requirements | command-line tool `foo`; User with higher permissions |
855
+
| 3rd Party Python modules | `module-name` |
856
+
| Handles Periods | Yes (alerts only after `--count` consecutive threshold violations) |
857
+
| Uses State File | `$TEMP/linuxfabrik-monitoring-plugins-<plugin-name>.db` |
858
+
859
+
3. **Help**: The full `--help` output in a code block. Regenerate via `tools/update-readmes`.
860
+
861
+
4. **Usage Examples**: One or more realistic invocations with their output. Show at least one OK case. If the plugin has `--lengthy`, show both variants.
862
+
863
+
5. **States**: Describes *when* the plugin returns which state. Be precise about OK, WARN, CRIT, UNKNOWN conditions (e.g. "WARN if the percentage value is >= `--warning`"). Include `--always-ok` behavior, consecutive-run requirements, and first-run/reboot edge cases.
864
+
865
+
6. **Perfdata / Metrics**: Table with columns Name, Type, Description. Types: `Bytes`, `Number`, `Percentage`, `Seconds`. Where possible, use the metric descriptions from the vendor's official documentation (e.g. Redis INFO, psutil docs, API references).
866
+
867
+
7. **Troubleshooting** (optional): Known error messages with their solutions. Format: error message in backticks on its own line, followed by two trailing spaces for a Markdown line break, solution on the next line. Separate entries with a blank line.
868
+
869
+
8. **Credits, License**: Always present.
870
+
871
+
833
872
### Grafana Dashboards
834
873
835
874
The title of the dashboard should be capitalized, the name has to match the folder/plugin name (spaces will be replaced with `-`, `/` will be ignored. eg `Network I/O` will become `network-io`). Each Grafana panel should be meaningful, especially when comparing it to other related panels (eg memory usage and CPU usage).
Copy file name to clipboardExpand all lines: check-plugins/example/README.md
+61-48Lines changed: 61 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,50 +2,45 @@
2
2
3
3
## Overview
4
4
5
-
Help text from check command.
5
+
Skeleton plugin demonstrating all standard patterns and library functions: argparse with append/deprecated/suppress parameters, (success, result) error handling, SQLite delta calculations (no continuous counters), regex filtering, `--lengthy` table output, human-readable formatting (bytes, seconds, numbers), perfdata, get_state/get_worst, and Grafana-compatible panel design. Use this as a template for new check plugins.
6
6
7
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
7
+
**Data Collection:**
8
8
9
-
Hints:
9
+
* Executes a shell command (`cat /etc/os-release` as a placeholder) to collect data
10
+
* Items can be filtered by `--name` (exact match) and excluded by `--ignore-regex` (Python regular expression)
11
+
* Uses SQLite state persistence between runs to calculate deltas (e.g. bytes per second)
12
+
* On the first run, returns "Waiting for more data." until at least two measurements are available
13
+
* After a system reboot, counter values may be lower than the previous measurement. The check detects this (negative delta) and returns "Waiting for more data." until the next valid measurement pair
10
14
11
-
* Might be useful.
12
-
* Could help.
15
+
**Compatibility:**
13
16
17
+
* Cross-platform: Linux, Windows, and all psutil-supported systems
0 commit comments