Improve output

This commit is contained in:
Sven Velt 2020-12-26 23:04:20 +01:00
parent 7323d8844d
commit 482b2a0edf

View file

@ -21,7 +21,7 @@ ratio = float(mem['OverallUsed']) / float(mem['MemTotal']) * 100.0
#print('MemUsed: %8.2f MB' % (mem['MemUsed']/1024) ) #print('MemUsed: %8.2f MB' % (mem['MemUsed']/1024) )
#print('SwapUsed: %8.2f MB' % (mem['SwapUsed']/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: if ratio > 150.0:
exitcode = 2 exitcode = 2
@ -42,7 +42,7 @@ for label in ['MemTotal', 'OverallUsed', 'MemUsed', 'SwapTotal', 'SwapUsed']:
perfdata.append('%s=%dB;;;;' % (label, mem[label]*1024) ) perfdata.append('%s=%dB;;;;' % (label, mem[label]*1024) )
print(exitstr + ' ' + out + '|' + ' '.join(perfdata)) print(exitstr + ' - ' + out + '|' + ' '.join(perfdata))
print('\n'.join(multiout)) print('\n'.join(multiout))
sys.exit(exitcode) sys.exit(exitcode)