# rrds/memory - memory usage on unix boxen
# I know what fremem is, but what exactly is swapmem?  Amount of swap memory
# available?  In use?  Tell me if you know.
source		unix-status
step		300
data		freemem GAUGE:600:0:U	vmstat
data		swapmem GAUGE:600:0:U	vmstat
data		scanrate COUNTER:600:0:U vmstat
alert		scanrate < 1 2
archives	day-avg week-avg month-avg 3month-avg year-avg day-min week-min month-min 3month-min year-min
times		day yesterday week 3month year

graph		memory desc="Free memory can be quite low with no adverse effects.  Look at the scanrate graphs for swapping problems."
		--title '##HOST## - Memory (##GRAPHTIME##)'
		--lower-limit 0
		--vertical-label 'bytes'
		DEF:kfreemem=##DB##:freemem:AVERAGE
		DEF:kswapmem=##DB##:swapmem:AVERAGE
		CDEF:freemem=kfreemem,1024,*
		CDEF:swapmem=kswapmem,1024,*
		'LINE2:freemem###COLOR1##:Free Memory'
		'LINE2:swapmem###COLOR2##:Swap Memory'
		'GPRINT:freemem:LAST:free=%.0lf%s'
		'GPRINT:freemem:MIN:min=%.0lf%s'

graph		scanrate desc="The scanrate is zero except when the system needs more memory and can't find enough by paging-out inactive pages.  If it's non-zero, then active processes had to be swapped out.  If it's happening on a regular basis, then you need more memory (or fewer/smaller programs)."
		--title '##HOST## - Scanrate (##GRAPHTIME##)'
		--lower-limit 0
		DEF:scanrate=##DB##:scanrate:AVERAGE
		'AREA:scanrate###PROBLEMCOLOR##:Scan Rate'
		'GPRINT:scanrate:MAX:max=%.0lf%s'

