diff --git a/check_bandwidth.py b/check_bandwidth.py index 682cf22..76a58f5 100755 --- a/check_bandwidth.py +++ b/check_bandwidth.py @@ -13,6 +13,7 @@ parser = argparse.ArgumentParser(description='Check network interface bandwidth 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.') args = parser.parse_args() @@ -61,7 +62,7 @@ def main(): else: ok.append(interface) data[i][2] = 'ok' - perf_data.append(f'{interface}={round(bandwidth_utilization, 2)}MB;{warn_value};{crit_value}; ') + perf_data.append(f'{interface}={round(bandwidth_utilization, 2)}MB;{warn_value};{crit_value};{f"0;{args.max};" if args.max else ""} ') if len(ok): print(f'OK: {", ".join(ok)}')