Change default thresolds minimum duration for memswap

This commit is contained in:
nicolargo
2026-05-15 17:11:47 +02:00
parent dbcfbffd51
commit 1da7047688
4 changed files with 59 additions and 5 deletions

View File

@@ -256,7 +256,6 @@ critical=90
[memswap]
disable=False
min_duration_seconds=60
# Define SWAP usage thresholds in % (applies to `percent`)
# Default values if not defined: 60/80/95
percent_careful=60
@@ -267,9 +266,11 @@ percent_critical=95
# v5 only — swap I/O rate thresholds (bytes/sec).
# No default ladder: thresholds are opt-in. Uncomment to activate.
# Suggested values: 40_960 / 409_600 / 819_200 (≈ 40 / 400 / 800 KB/s)
#sin_min_duration_seconds=60
#sin_careful=40960
#sin_warning=409600
#sin_critical=819200
#sout_min_duration_seconds=60
#sout_careful=40960
#sout_warning=409600
#sout_critical=819200

View File

@@ -177,6 +177,59 @@ free 12.0G
---
## fs
**Source:** `glances/plugins/fs/__init__.py::msg_curse`
**Guard:** returns empty if `not self.stats`, plugin disabled, or
`max_width` is `None` (logs a debug message).
**Expected v4-equivalent output (default — used + total):**
```
FILE SYS Used Total
/ 125.0G 500.0G
/home 512.0G 1.0T
```
**`name_max_width` computation:** `max_width - 13`
**Header field table:**
| field | label | format | alignment | width | notes |
|---|---|---|---|---|---|
| (title) | `FILE SYS` | `'{:{width}}'.format('FILE SYS', width=name_max_width)` | left | name_max_width | `TITLE` |
| Used / Free | `Used` or `Free` | `'{:>8}'.format(...)` | right | 8 | depends on `--fs-free-space` flag |
| Total | `Total` | `'{:>7}'.format('Total')` | right | 7 | `DEFAULT` |
**Per-filesystem row:**
| field | format | alignment | width | color rule |
|---|---|---|---|---|
| mnt_point | concatenated `mnt (device_short)` when room, else truncated with leading `_` | left | name_max_width | `DEFAULT` |
| used / free | `auto_unit(value)` right-padded to 7 | right | 7 | `get_alert(used, max=size)` |
| total | `auto_unit(size)` right-padded to 7 | right | 7 | `DEFAULT` |
**Sort order:** mountpoint ascending (`operator.itemgetter('mnt_point')`).
**Color logic:** the `used` cell carries the alert decoration computed
from `get_alert(current=size-free, maximum=size, header=mnt_point)`
standard CAREFUL/WARNING/CRITICAL ladder. Read-only mounts (`ro` in
options) skip the alert in v4 (issue #3143); v5 keeps the alert
universal — operators can suppress via the show/hide filters.
**Conditional behaviour:**
- `--fs-free-space`: header shows `Free`, row value shows `auto_unit(free)`
instead of `auto_unit(used)`.
- Mountpoints whose alias / show / hide filters reject them are skipped.
**v5 renderer:** `glances/plugins/fs/render_curses_v5.py`
(Added in G4-fs. Default mode only — ``--fs-free-space`` toggle and
the optional ``(device)`` suffix on mountpoints are deferred to a
later phase pending CLI / max_width plumbing.)
---
## load
**Source:** `glances/plugins/load/__init__.py::msg_curse`

View File

@@ -56,7 +56,6 @@ logger = logging.getLogger(__name__)
# does not need to change.
KNOWN_V5_MISSING_PLUGINS: tuple[str, ...] = (
"processlist",
"fs",
"diskio",
)

View File

@@ -378,11 +378,12 @@ def test_attach_mcp_logs_known_v5_gaps(config_factory, store, caplog):
assert "not yet ported" in msgs
# The canonical missing v4 plugins must be named so operators can
# match the message against MCP client errors. Updated as plugins
# land in v5: memswap was ported in G4-memswap.
for missing in ("processlist", "fs", "diskio"):
# land in v5 (memswap → G4-memswap, fs → G4-fs).
for missing in ("processlist", "diskio"):
assert missing in msgs
# memswap is now ported — must NOT appear as missing.
# Already ported — must NOT appear as missing.
assert "memswap" not in msgs
assert "fs " not in msgs and "fs," not in msgs
def test_attach_mcp_logs_history_limitation(config_factory, store, caplog):