diff --git a/check_linux_memory.py b/check_linux_memory.py index 6798530..af1add6 100755 --- a/check_linux_memory.py +++ b/check_linux_memory.py @@ -2,6 +2,21 @@ import sys +important_lables = [ + 'MemTotal', # RAM total + 'OverallUsed', + 'MemUsed', + 'SwapTotal', # swap total + 'SwapUsed', # swap used + 'Buffers', # RH6: temporary storage for raw disk blocks. + 'Cached', # RH6: physical RAM used as cache memory. + 'SwapCached', # RH6: memory that has once been moved into swap, then back into the main memory, but still also remains in the swapfile. This saves I/O, because the memory does not need to be moved into swap again. + 'Active', # RH6: buffer or page cache memory that is in active use. This is memory that has been recently used and is usually not reclaimed for other purposes. + 'Inactive', # RH6: buffer or page cache memory that are free and and available. This is memory that has not been recently used and can be reclaimed for other purposes. + 'Dirty', # RH6: waiting to be written back to the disk. + 'Writeback', # RH6: actively being written back to the disk. + ] + with open('/proc/meminfo', 'r') as f: lines = f.read().splitlines() @@ -28,11 +43,11 @@ else: exitstr = 'OK' multiout = [] -for label in ['MemTotal', 'OverallUsed', 'MemUsed', 'SwapTotal', 'SwapUsed']: +for label in important_lables: multiout.append('%s: %.4fGB' % (label, float(mem[label])/1024.0/1024.0)) perfdata = [] -for label in ['MemTotal', 'OverallUsed', 'MemUsed', 'SwapTotal', 'SwapUsed']: +for label in important_lables: perfdata.append('%s=%dB;;;;' % (label, mem[label]*1024) )