Skip to content

[show][config] Add CLI support for configurable drop monitor feature#3756

Merged
vmittal-msft merged 4 commits intosonic-net:masterfrom
arista-hpandya:conf-drop-monitor-cli
Sep 3, 2025
Merged

[show][config] Add CLI support for configurable drop monitor feature#3756
vmittal-msft merged 4 commits intosonic-net:masterfrom
arista-hpandya:conf-drop-monitor-cli

Conversation

@arista-hpandya
Copy link
Contributor

@arista-hpandya arista-hpandya commented Feb 7, 2025

This PR enables users to proactively monitor and identify persistent packet drops in their SONiC environment, improving network stability and troubleshooting capabilities.

Fixes #3757

What I did

  • Implements commands to configure persistent drop monitor thresholds.
  • Adds support for setting monitoring window size, drop count threshold, and incident count threshold.
  • Includes show dropcounters persistent-drops command to display persistent drop alerts.
  • Provides config dropcounters enable-monitor/disbale-monitor command to enable/disable the feature.
  • Adds unit tests to cover the new CLI functionality.
Key Features:
  • Configurable monitoring window: Users can specify the time window (in seconds) for detecting persistent drops.
  • Adjustable thresholds: Users can set the minimum number of drops required to trigger an incident and the minimum number of incidents to trigger a persistent drop alert.
  • Per dropcounter configuration: The drop monitor can be enabled/disabled per drop counter
  • Global feature toggle: The feature can be enabled/disabled globally.

How I did it

  • Modified the existing dropconfig script
  • Modified show and config scripts

How to verify it

  • Added unit tests to cover the new CLI functionality.
  • Manual testing performed on a SONiC device to verify configuration

Previous command output (if the output of a command-line utility has changed)

NA

New command output (if the output of a command-line utility has changed)

Snapshots from an Arista switch running SONiC.

Per Drop Counter Configuration

root@up322:~# config dropcounters enable-monitor -c DEBUG_0 -w 120 -dct 5 -ict 2
Drop counter monitor is enabled for counter DEBUG_0
root@up322:~# show dropcounters configuration
Counter    Alias      Group    Type                Reasons         Description              Drop Monitor      Window    Drop Count Threshold    Incident Count Threshold
---------  ---------  -------  ------------------  --------------  -----------------------  --------------  --------  ----------------------  --------------------------
DEBUG_0    BAD_DROPS  BAD      PORT_INGRESS_DROPS  SIP_LINK_LOCAL  More port ingress drops  enabled              120                       5                           2
root@up322:~# config dropcounters disable-monitor -c DEBUG_0
Drop counter monitor is disabled for counter DEBUG_0
root@up322:~# show dropcounters configuration
Counter    Alias      Group    Type                Reasons         Description              Drop Monitor      Window    Drop Count Threshold    Incident Count Threshold
---------  ---------  -------  ------------------  --------------  -----------------------  --------------  --------  ----------------------  --------------------------
DEBUG_0    BAD_DROPS  BAD      PORT_INGRESS_DROPS  SIP_LINK_LOCAL  More port ingress drops  disabled             120                       5                           2

Global configuration

root@up322:~# config dropcounters disable-monitor
Drop counter monitor is globally disabled.
root@up322:~# config dropcounters enable-monitor
Drop counter monitor is globally enabled.

Show commands

root@up322:~# show dropcounters configuration
Counter    Alias      Group    Type                Reasons         Description              Drop Monitor      Window    Drop Count Threshold    Incident Count Threshold
---------  ---------  -------  ------------------  --------------  -----------------------  --------------  --------  ----------------------  --------------------------
DEBUG_0    BAD_DROPS  BAD      PORT_INGRESS_DROPS  SIP_LINK_LOCAL  More port ingress drops  enabled              300                       5                           1
root@up322:~# show dropcounters persistent-drops DEBUG_0
The persistent drops recorded on DEBUG_0 are:
2025-05-14 15:56:58: Persistent packet drops detected on Ethernet0

Documentation

Details are discussed in the HLD: sonic-net/SONiC#1912

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

*   Implements commands to configure persistent drop monitor thresholds.
*   Adds support for setting monitoring window size, drop count threshold, and incident count threshold.
*   Includes `show dropcounters persistent_drops` command to display persistent drop alerts.
*   Provides `config dropcounters enable_monitor/disbale_monitor` command to enable/disable the feature.
*   Adds unit tests to cover the new CLI functionality.
@arista-hpandya arista-hpandya force-pushed the conf-drop-monitor-cli branch from f7dde2d to 5d8a671 Compare May 12, 2025 22:57
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arista-hpandya arista-hpandya marked this pull request as ready for review May 12, 2025 22:57
@arista-hpandya arista-hpandya marked this pull request as draft May 13, 2025 17:15
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arista-hpandya arista-hpandya force-pushed the conf-drop-monitor-cli branch from 95b259e to 0f99e0f Compare May 13, 2025 22:31
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arista-hpandya arista-hpandya force-pushed the conf-drop-monitor-cli branch from 0f99e0f to f2e7558 Compare May 13, 2025 23:29
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arista-hpandya arista-hpandya force-pushed the conf-drop-monitor-cli branch from f2e7558 to d76c878 Compare May 14, 2025 20:31
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arista-hpandya arista-hpandya marked this pull request as ready for review May 14, 2025 21:05
@vmittal-msft vmittal-msft self-requested a review June 24, 2025 17:47
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@arista-hpandya
Copy link
Contributor Author

Hi @vmittal-msft could I get a review on this PR? All changes that we have discussed have been made.

@vmittal-msft
Copy link
Contributor

@arista-hpandya Sure. Will work on it this week.

@arista-hpandya
Copy link
Contributor Author

Hi @vmittal-msft did you get a chance to go over the changes? Let me know if there are any clarifications you need from my end. Thank you!

@vmittal-msft
Copy link
Contributor

@arista-hpandya changes look ok to me. few comments -

  1. Can we add syslog whenever a debug counter hit configured threshold so it will be easy to enable alerting for us ?
  2. Also, Can we add a command to list available debug/drop counters user can monitor as part of this feature ?

Copy link
Contributor

@vmittal-msft vmittal-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comment.

Copy link
Contributor

@vmittal-msft vmittal-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

@vmittal-msft vmittal-msft merged commit d1c9d1a into sonic-net:master Sep 3, 2025
7 checks passed
YairRaviv pushed a commit to YairRaviv/sonic-utilities that referenced this pull request Jan 12, 2026
…onic-net#3756)

* [show][config] Add CLI support for configurable drop monitor feature

*   Implements commands to configure persistent drop monitor thresholds.
*   Adds support for setting monitoring window size, drop count threshold, and incident count threshold.
*   Includes `show dropcounters persistent_drops` command to display persistent drop alerts.
*   Provides `config dropcounters enable_monitor/disbale_monitor` command to enable/disable the feature.
*   Adds unit tests to cover the new CLI functionality.

* Fix test failures and minor edits

* Add more testcases for coverage

* Update CLI to reflect changes in HLD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature] Add CLI support for configuring persistent drop monitor

3 participants