bandwidth max

This commit is contained in:
Cyberes 2023-04-21 23:54:18 -06:00
parent e31918a949
commit aea52d15bf
1 changed files with 2 additions and 1 deletions

View File

@ -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)}')