diff --git a/check_bandwidth.py b/check_bandwidth.py index 6064135..5f716f0 100755 --- a/check_bandwidth.py +++ b/check_bandwidth.py @@ -8,15 +8,15 @@ import psutil import checker.nagios as nagios from checker.markdown import list_to_markdown_table -# Parse the bandwidth limit argument parser = argparse.ArgumentParser(description='Check network interface bandwidth utilization.') parser.add_argument('--bandwidth', type=float, required=True, help='Bandwidth speed in Mbps.') 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.') +parser.add_argument('--ignore', default=None, help='Interface names to ignore.') args = parser.parse_args() +ignore_interfaces = args.ignore.split(',') if args.ignore else [] def main(): data = [] @@ -28,7 +28,7 @@ def main(): # Calculate bandwidth utilization for each interface for interface, stats in net_io_counters.items(): - if interface in args.ignore: + if interface in ignore_interfaces: continue # Get the number of bytes sent and received bytes_sent = stats.bytes_sent