Prepare for more flexible checks
This commit is contained in:
parent
12f77e76eb
commit
80c64b67db
|
@ -2,6 +2,21 @@
|
||||||
|
|
||||||
import sys
|
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:
|
with open('/proc/meminfo', 'r') as f:
|
||||||
lines = f.read().splitlines()
|
lines = f.read().splitlines()
|
||||||
|
|
||||||
|
@ -28,11 +43,11 @@ else:
|
||||||
exitstr = 'OK'
|
exitstr = 'OK'
|
||||||
|
|
||||||
multiout = []
|
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))
|
multiout.append('%s: %.4fGB' % (label, float(mem[label])/1024.0/1024.0))
|
||||||
|
|
||||||
perfdata = []
|
perfdata = []
|
||||||
for label in ['MemTotal', 'OverallUsed', 'MemUsed', 'SwapTotal', 'SwapUsed']:
|
for label in important_lables:
|
||||||
perfdata.append('%s=%dB;;;;' % (label, mem[label]*1024) )
|
perfdata.append('%s=%dB;;;;' % (label, mem[label]*1024) )
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue