research(cli): clear counters asks before it clears - the two prompt lines, the syslog receipt, and Last clearing #2430

Merged
jaylouisw merged 1 commit from rev/1121-1342 into main 2026-11-21 14:39:36 +00:00
Owner

Question. When an IOS-like box is asked clear counters (bare and with one interface named), what does it print before it acts, what must the operator answer, what does it print after, and what does show interfaces then say about when the counters were last cleared?

Verdict. The command prompts first and the prompt is the command's output: Clear "show interface" counters on all interfaces [confirm] or Clear "show interface" counters on this interface [confirm], accepted with Enter or y. Afterwards there is no success sentence, only %CLEAR-5-COUNTERS: Clear counter on all interfaces by console (or ... on interface gigabitEthernet0/0). show interfaces then carries Last clearing of "show interface" counters <age> - never until the first clear since reload, then 00:05:52, 2d22h, 6w1d (older images 0:00:06). The prompt is printed even when the counters are already zero; traffic is not interrupted; SNMP counters, load/reliability and the rate averages are not cleared.

Sources. IOS XE 3850 interface command reference (user/privileged EXEC, syntax, the not-cleared note); Cisco T1 PRI note 8131 (byte-exact bare transcript + receipt); GGSG 15.4(3)T chapter (named form + on interface receipt); IOS XR CRS/ASR9k/NCS refs (confirm semantics, Enter or y); Ansible cisco.ios.ios_command (both prompt strings as regexes, y and \r answers); 2960-XR EEM sample (prompt repeats on every clear); Cat9k output-drops, 4500 and 12.0 show interfaces captures for the age formats; Cisco 12027 for the field's definition.

Changed. research/clear-counters-wording.md (new, 170 lines) and a pointer from docs/plans/counter-reset.md step 2. No engine code: clear counters is % Unrecognized command today and adding it is that plan's step 2 (new surface), so the note settles the words instead. The note also records that the vendor line comes before the clear and must be answered - the one thing the one-line CliSession.run() cannot do yet.

Unresolved (in the note). The 3850 book's port-channel example prints the all interfaces wording where every other source prints this interface (treated as a doc copy error, not averaged); whether the command is accepted at > (the 3850 book says user EXEC, the switch guides' tables say privileged); what a bad interface name does; whether Last clearing is per-interface; whether no logging console hides the receipt.

Gates. node scripts/syntax-check.js 535 files OK; node scripts/check-control-bytes.js clean; npm test 455 suites, 15,449 assertions, 0 failed.

**Question.** When an IOS-like box is asked `clear counters` (bare and with one interface named), what does it print before it acts, what must the operator answer, what does it print after, and what does `show interfaces` then say about when the counters were last cleared? **Verdict.** The command prompts first and the prompt is the command's output: `Clear "show interface" counters on all interfaces [confirm]` or `Clear "show interface" counters on this interface [confirm]`, accepted with Enter or `y`. Afterwards there is no success sentence, only `%CLEAR-5-COUNTERS: Clear counter on all interfaces by console` (or `... on interface gigabitEthernet0/0`). `show interfaces` then carries `Last clearing of "show interface" counters <age>` - `never` until the first clear since reload, then `00:05:52`, `2d22h`, `6w1d` (older images `0:00:06`). The prompt is printed even when the counters are already zero; traffic is not interrupted; SNMP counters, load/reliability and the rate averages are not cleared. **Sources.** IOS XE 3850 interface command reference (user/privileged EXEC, syntax, the not-cleared note); Cisco T1 PRI note 8131 (byte-exact bare transcript + receipt); GGSG 15.4(3)T chapter (named form + `on interface` receipt); IOS XR CRS/ASR9k/NCS refs (confirm semantics, Enter or `y`); Ansible `cisco.ios.ios_command` (both prompt strings as regexes, `y` and `\r` answers); 2960-XR EEM sample (prompt repeats on every clear); Cat9k output-drops, 4500 and 12.0 `show interfaces` captures for the age formats; Cisco 12027 for the field's definition. **Changed.** `research/clear-counters-wording.md` (new, 170 lines) and a pointer from `docs/plans/counter-reset.md` step 2. No engine code: `clear counters` is `% Unrecognized command` today and adding it is that plan's step 2 (new surface), so the note settles the words instead. The note also records that the vendor line comes before the clear and must be answered - the one thing the one-line `CliSession.run()` cannot do yet. **Unresolved (in the note).** The 3850 book's port-channel example prints the *all interfaces* wording where every other source prints *this interface* (treated as a doc copy error, not averaged); whether the command is accepted at `>` (the 3850 book says user EXEC, the switch guides' tables say privileged); what a bad interface name does; whether `Last clearing` is per-interface; whether `no logging console` hides the receipt. **Gates.** `node scripts/syntax-check.js` 535 files OK; `node scripts/check-control-bytes.js` clean; `npm test` 455 suites, 15,449 assertions, 0 failed.
research(cli): clear counters asks before it clears, in one line and a syslog receipt
All checks were successful
CI / Server smoke and Docker build (pull_request) Successful in 30s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 7s
CI / Test (Node 20) (pull_request) Successful in 1m2s
CI / Test (Node 18) (pull_request) Successful in 1m3s
CI / Test (Node 22) (pull_request) Successful in 1m2s
CI / Arm auto-merge (pull_request) Successful in 3s
fae45dfe91
A switch does not zero its counters when `clear counters` is parsed: it prints
`Clear "show interface" counters on all interfaces [confirm]` (or `... on this
interface [confirm]`), waits for Enter or `y`, and then writes only
`%CLEAR-5-COUNTERS: Clear counter on all interfaces by console`. `show
interfaces` dates the clear afterwards with `Last clearing of "show interface"
counters <age>`, `never` until the first clear since reload, then `00:05:52`,
`2d22h` or `6w1d`. The prompt is printed even when the counters are already
zero, traffic is not interrupted, and SNMP counters, load/reliability and the
rate averages are not touched.

Sources: the IOS XE 3850 interface command reference (mode, syntax, what a
clear does not clear), the T1 PRI note's byte-exact transcript, the GGSG
chapter for the named form's receipt, the IOS XR references for the confirm
semantics, Ansible's `cisco.ios.ios_command` prompt regex for both strings,
the 2960-XR EEM sample for repeatability, and Cat9k/4500/12.0 captures for the
`Last clearing` formats. Where Cisco's own book contradicts the captures (the
3850 port-channel example prints the all-interfaces wording) that is recorded
as unresolved rather than averaged.

No engine code: the command is the counter-reset plan's step 2, i.e. new
surface. The plan now points at the note for the two strings and for the one
thing a one-line `CliSession.run()` cannot do - answer the question.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-21 13:54:56 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!2430
No description provided.