Repository navigation
fix(connections): alert on the tracked percentage, not on 0 - #3683
Merged
nicolargo merged 1 commit intoAug 26, 2026
Merged
Conversation
update_views called get_alert(header='nf_conntrack_percent') without a value,
so it measured get_alert's default current=0 on every refresh. The tracked
connection percentage was drawn OK at any fill level, and the thresholds
conf/glances.conf ships for it -- careful 70, warning 80, critical 90 -- could
never fire. A conntrack table close to nf_conntrack_max drops new connections,
which is exactly what those thresholds exist to warn about.
Both interfaces read this one decoration (the WebUI through
getDecoration('nf_conntrack_percent')), so both were silent.
Owner
|
Thanks for the PR @ntdatt812 Merged into develop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
connections/__init__.pybuilds the conntrack decoration like this:No value is passed, so
get_alertuses its own default —current=0— and computesvalue = 0 * 100 / 100. Zero is below every threshold, so the result isOKon every refresh regardless of how full the table is.The thresholds are real and documented.
conf/glances.confships them:and
docs/aoa/connections.rstdocuments the same three. None of them could ever fire.That matters more than a missing colour: once
nf_conntrack_countreachesnf_conntrack_maxthe kernel starts dropping new connections, which is precisely the condition acritical=90threshold is there to warn about before it happens.nf_conntrack_percentis already computed correctly inupdate_for_nf_conntrack_method, so the number on screen was right the whole time — only its colour was decided from 0.Both interfaces read this one decoration — the WebUI through
getDecoration('nf_conntrack_percent')inplugin-connections.vue— so both were silent, and both are fixed by the one change.Tests
Added to
tests/test_connections_states.py, reusing that file's plugin fixture.update_viewsruns over injected stats and the decoration is read back:CRITICAL, 85% →WARNING, 75% →CAREFULOKThe limits are set on the fixture to the values
conf/glances.confships, since the fixture builds the plugin withconfig=None.Mutation-checked — restoring
get_alert(header='nf_conntrack_percent')fails exactly one test, on the first assertion:The
10% → OKcase deliberately does not catch that mutation: it pins the low end, which readsOKeither way. It is there so a future change cannot fix the high end by colouring everything.No WebUI rebuild is needed — the change is Python only, and the bundle already reads the decoration the plugin publishes.