check_pve_guest_metrics: adjust input data
This commit is contained in:
parent
6c5c6ea7cb
commit
3d6742384f
|
@ -55,6 +55,15 @@ def main():
|
|||
print('UNKNOWN: Failed to parse --levels JSON:', e)
|
||||
sys.exit(nagios.UNKNOWN)
|
||||
|
||||
for k, v in metrics_levels.items():
|
||||
metrics_levels[k]['min'] = metrics_levels[k].get('min')
|
||||
if isinstance(metrics_levels[k]['min'], float):
|
||||
metrics_levels[k]['min'] = int(metrics_levels[k]['min'])
|
||||
if isinstance(metrics_levels[k]['warn'], float):
|
||||
metrics_levels[k]['warn'] = int(metrics_levels[k]['warn'])
|
||||
if isinstance(metrics_levels[k]['crit'], float):
|
||||
metrics_levels[k]['crit'] = int(metrics_levels[k]['crit'])
|
||||
|
||||
try:
|
||||
args.node = json.loads(args.node)
|
||||
pve_node = args.node[0]
|
||||
|
@ -171,7 +180,10 @@ def main():
|
|||
for metric, data in check_data.items():
|
||||
output_str = output_str + f"{metric} {data['value_str']}, "
|
||||
if not check_data[metric]['nan']:
|
||||
perf_data.append(f"'{metric}'={data['value']};{metrics_levels[metric]['warn']};{metrics_levels[metric]['crit']};;")
|
||||
if metrics_levels[metric]['min'] is None:
|
||||
perf_data.append(f"'{metric}'={data['value']};{metrics_levels[metric]['warn']};{metrics_levels[metric]['crit']};;")
|
||||
else:
|
||||
perf_data.append(f"'{metric}'={data['value']};{metrics_levels[metric]['warn']};{metrics_levels[metric]['crit']};{metrics_levels[metric]['min']};")
|
||||
|
||||
print(output_str.strip(', ').strip(), end=('\n' if args.table else ''))
|
||||
|
||||
|
|
Loading…
Reference in New Issue