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
fix(plugins): argparse choices, date math, fall-through (#1070)
Three real issues and a handful of false positives closing out the
semantic audit backlog (#1070):
- sap-open-concur-com: `choices=services.append('All')` evaluated to
`choices=None` because `list.append()` returns `None`, so the
`--service` argument accepted any value without validation. Use
`choices=services + ['All']` to build a proper choices list.
- nextcloud-security-scan: compute scan age as
`(today - scan_date).days` instead of `abs(scan_date - today).days`,
so a scan with a clock-skewed future timestamp no longer triggers a
rescan. Only past scans older than `--trigger` days trigger a rescan.
- fortios-network-io: make the "no warnings vs warnings present"
branches structurally exclusive via an explicit `else:`. Same
readability fix as the chunk-3 plugins.
False positives from the same audit, not touched:
- grafana-version: the agent claimed `shell_exec()` return-type
confusion, but the code correctly unpacks the outer `(success,
result)` tuple and then indexes the inner `(stdout, stderr, retc)`
on success.
- icinga-topflap-services: the agent claimed the `SELECT ... FROM
perfdata` target didn't match a CREATE. In fact `lib.db_sqlite`
defaults the table name to `perfdata`, so the whole plugin works
on the implicit default table.
- infomaniak-events: the `ended_at - started_at` subtraction is
guarded by `if event.get('ended_at') is not None`, so the None
subtraction the agent flagged never runs.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,12 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
14
* axenita-stats: fix the version-number extraction slice `[8 : 8 + find('-') - 1]` that only worked for exactly 6-character versions like `14.0.8` and silently truncated any longer patch number. Use `split('-')[1]` instead, which handles `14.0.12`, `1.2.3`, and 2-digit majors correctly ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
15
15
* deb-updates: add missing `lib.txt` import so the "N update(s) available" summary no longer crashes with `AttributeError` at runtime
16
16
* Fix `--require-hashes` pip install in pre-commit autoupdate workflow by using pinned version instead
17
+
* fortios-network-io: make the "no warnings vs warnings present" branches structurally exclusive via an explicit `else:`. The old code relied on `lib.base.oao()` exiting to skip the follow-up call, which works but is fragile to read ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
17
18
* hin-status: when incidents are found, set `cnt_incidents = len(incidents)` instead of the hardcoded `1`, so the perfdata counter matches the actual number of incidents listed in the message ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
18
19
* keycloak-version: replace the fragile regex `r'n (.*)'` (which relied on the "n " in the word "Version" of `/opt/keycloak/version.txt`) with an explicit `r'[Vv]ersion\s+(\d+(?:\.\d+)*)'` pattern. Also fall through to the API fallback when the file is present but the regex does not match, instead of aborting with "Keycloak not found" ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
19
20
* mysql-memory: fix `get_other_process_memory()` fallback path for psutil older than 5.3.0 (referenced an undefined `cmdline` variable and the wrong attribute on the process dict) and drop an unreachable `break` after `return` in `get_pfs_memory()`
20
21
* mysql-storage-engines: drop a dead `SELECT ... FROM information_schema.engines` query whose result was never used
21
22
* mysql-table-locks: the "X immediate / Y locks" message denominator used `Table_locks_immediate` twice instead of `Table_locks_immediate + Table_locks_waited` as the total, so the output lied about the total lock count. The ratio displayed as a percentage was already correct ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
22
23
* network-connections: the final `lib.base.oao()` call passed a hardcoded `STATE_OK` instead of the accumulated `state`, discarding all WARN/CRIT decisions from the loop. The plugin now exits with the correct accumulated state ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
24
+
* nextcloud-security-scan: compute scan age as `(today - scan_date).days` instead of `abs(scan_date - today).days`, so a scan with a clock-skewed future timestamp no longer triggers a rescan. Only past scans older than `--trigger` days trigger a rescan ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
23
25
* ntp-ntpd: collapse four sequential `if`-then-`oao()` early-exit guards into a single `if/elif` chain so the intent (try each failure mode in turn and exit on the first one that matches) is explicit ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
24
26
* ntp-w32tm: when the "Time since Last Good Sync Time" check yields a non-OK state, the appended state label is now the actual `local_state` (WARN or CRIT) instead of a hardcoded `STATE_WARN`, so a CRIT state no longer shows up as "WARNING" in the message ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
25
27
* openstack-swift-stat: the "bytes used" block gated on `'x-account-meta-quota-bytes' in headers` (a quota header) when it should have gated on `'x-account-bytes-used' in headers`. The "used" line now shows up for any account with non-zero bytes, regardless of whether a quota is set ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
@@ -29,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
29
31
* qts-temperatures: the `systemp` and `cputemp` perfdata entries had their `warn` / `crit` thresholds swapped (system perfdata used the CPU threshold fields and vice versa). The message text was already correct ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
30
32
* redis-status, valkey-status: the `key_count` perfdata value used the loop variable `keys` (the last database's per-DB key count) instead of the accumulated `key_count` (total across all databases). The "with X keys" message text was already using `key_count` ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
31
33
* rocketchat-stats: add missing `lib.txt` import so the user-count pluralization no longer crashes with `AttributeError` at runtime
34
+
* sap-open-concur-com: `choices=services.append('All')` was effectively `choices=None` because `list.append()` returns `None`. The `--service` argument therefore accepted any value without validation. Use `choices=services + ['All']` to build a proper choices list ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
32
35
* starface-java-memory-usage: the heap and non-heap state checks used `state += lib.base.get_worst(used_state, state)` which adds state integers together and corrupts the accumulated state (e.g. WARN+WARN=2 reads as CRIT, WARN+CRIT=3 is outside the valid range). Replaced with `state = lib.base.get_worst(state, used_state)` so the accumulated state remains a valid STATE_OK / STATE_WARN / STATE_CRIT value ([#1070](https://github.com/Linuxfabrik/monitoring-plugins/issues/1070))
33
36
* tools/run-unit-tests: skip the `example` plugin in default runs. Its unit test is a template meant to be copy-pasted into new plugins and does not correspond to a real check. Explicit `python tools/run-unit-tests example` still runs it
34
37
* tox.ini: disable the sdist build (`no_package = true`) so `tox` no longer trips over the flat top-level layout with "Multiple top-level packages discovered". The repo is a collection of plugin scripts, not a Python package
0 commit comments