From 488270282c20e7830ecad4245560867d24ac9158 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Wed, 26 Apr 2023 13:20:10 -0600 Subject: [PATCH] check_bandwidth: ignore interface option --- check_bandwidth.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/check_bandwidth.py b/check_bandwidth.py index b75df5f..6064135 100755 --- a/check_bandwidth.py +++ b/check_bandwidth.py @@ -14,6 +14,7 @@ parser.add_argument('--bandwidth', type=float, required=True, help='Bandwidth sp parser.add_argument('--critical', type=int, default=75, help='Critical if percent of bandwidth usage is greater than or equal to this.') parser.add_argument('--warn', type=int, default=50, help='Warning if percent of bandwidth usage is greater than or equal to this.') parser.add_argument('--max', type=int, default=None, help='Set the max value the bandwidth can be. Useful for graphs and whatever.') +parser.add_argument('--ignore', nargs='*', default=[], help='Interface names to ignore.') args = parser.parse_args() @@ -27,6 +28,8 @@ def main(): # Calculate bandwidth utilization for each interface for interface, stats in net_io_counters.items(): + if interface in args.ignore: + continue # Get the number of bytes sent and received bytes_sent = stats.bytes_sent bytes_recv = stats.bytes_recv