fix(prometheus, syslog): a target or pattern pauses with a Pause/Resume button, not an "on" tick box in its form (#6419)
Monitors, schedules and maintenance plans already pause with a Pause/Resume button and say "Paused" where they're listed. Prometheus targets and syslog patterns only had a tick box inside the edit form, so a target refused by its endpoint couldn't be stopped from its page. - Both get a Pause/Resume button (target page and list; patterns list) posting to /toggle, recorded in the audit log, and a Paused badge. - The forms lose the tick box. A new one starts running; an edit keeps whether it is paused. - A target's "off" state is now "paused", in its pages and MCP tools. A resumed target reads "not scraped yet" until its next scrape, and its counter rates start over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,12 +11,12 @@ from plugins.syslog.patterns import PRESETS, PatternError, Tally, key_for, match
|
||||
|
||||
def test_a_form_reads_into_a_pattern():
|
||||
v = parse_form(MultiDict({"name": " NFS ", "phrases": "nfsd:\n\n lockd: \n", "max_severity": "3",
|
||||
"source_id": "", "window_minutes": "60", "enabled": "on"}))
|
||||
"source_id": "", "window_minutes": "60"}))
|
||||
assert v == {"name": "NFS", "phrases": ["nfsd:", "lockd:"], "max_severity": 3, "source_id": None,
|
||||
"window_minutes": 60, "enabled": True}
|
||||
"window_minutes": 60} # paused or not is the toggle's, not the form's (#6419)
|
||||
# A window or severity not offered falls back rather than failing.
|
||||
v = parse_form(MultiDict({"name": "x", "phrases": "a", "max_severity": "9", "window_minutes": "7"}))
|
||||
assert (v["max_severity"], v["window_minutes"], v["enabled"]) == (None, 15, False)
|
||||
assert (v["max_severity"], v["window_minutes"]) == (None, 15)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("form, says", [
|
||||
|
||||
Reference in New Issue
Block a user