From 482b2a0edfcdad6a178a9fa93295c8b1915d923b Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Sat, 26 Dec 2020 23:04:20 +0100 Subject: [PATCH] Improve output --- check_linux_memory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_linux_memory.py b/check_linux_memory.py index 9d5b489..669452c 100755 --- a/check_linux_memory.py +++ b/check_linux_memory.py @@ -21,7 +21,7 @@ ratio = float(mem['OverallUsed']) / float(mem['MemTotal']) * 100.0 #print('MemUsed: %8.2f MB' % (mem['MemUsed']/1024) ) #print('SwapUsed: %8.2f MB' % (mem['SwapUsed']/1024) ) -out = 'MemRatio: %.1f%% of %.1fGB RAM (%.1fGB Swap)' % ( ratio, (mem['MemTotal']/1024.0/1024.0), (mem['SwapTotal']/1024.0/1024.0) ) +out = 'MemRatio: %.1f%%/%.1fGB of %.1fGB RAM (and %.1fGB Swap) used' % ( ratio, (mem['OverallUsed']/1024.0/1024.0), (mem['MemTotal']/1024.0/1024.0), (mem['SwapTotal']/1024.0/1024.0) ) if ratio > 150.0: exitcode = 2 @@ -42,7 +42,7 @@ for label in ['MemTotal', 'OverallUsed', 'MemUsed', 'SwapTotal', 'SwapUsed']: perfdata.append('%s=%dB;;;;' % (label, mem[label]*1024) ) -print(exitstr + ' ' + out + '|' + ' '.join(perfdata)) +print(exitstr + ' - ' + out + '|' + ' '.join(perfdata)) print('\n'.join(multiout)) sys.exit(exitcode)