# rrds/qmailq - size of qmail's queue
# It shows the state of qmail's queue.  Backlog is the messages which 
# haven't been pre-processed yet.  Qsite is a those messages which match 
# the OURSITEEMAIL pattern, taken out of qremote. (TODO)
#
source		unix-status
step		300
data		backlog=qmail_qbacklog GAUGE:600:0:U	qmailq
data		qlocal=qmail_qlocal GAUGE:600:0:U	qmailq
data		qsite=qmail_qsite GAUGE:600:0:U		qmailq
data		qremote=qmail_qremote GAUGE:600:0:U	qmailq
alert		backlog < 2 5 10
alert		qlocal < 2 5 100
alert		qsite < 10 20 100
alert		qremote < 100 200 1000
archives	day-avg week-avg month-avg 3month-avg year-avg day-min week-min month-min 3month-min year-min day-max week-max month-max 3month-max year-max
times		day yesterday week 3month year

graph		qmailq desc="This is the number of messages in various parts of the qmail queue.  The backlog is the number of unprocessed messages in the queue and should usually be zero.  Local is messages queued for this machine and should also be zero; non-zero implies local delivery problems.  Site is mail queued for this site and is usually zero; non-zero means that one of our machines isn't accepting mail.  Remote is usually 10 or 20 here and can be ignored unless you see a sharp increase."
		--title '##HOST## - QMail Queue (##GRAPHTIME##)'
		--lower-limit 0
		--vertical-label 'messages'
		DEF:qlocal=##DB##:qlocal:AVERAGE
		DEF:qsite=##DB##:qsite:AVERAGE
		DEF:qremote=##DB##:qremote:AVERAGE
		DEF:backlog=##DB##:backlog:AVERAGE
		'LINE2:qlocal###COLOR1##:local'
		'LINE2:qsite###COLOR2##:site'
		'LINE2:qremote###COLOR3##:remote'
		'LINE2:backlog###PROBLEMCOLOR##:backlog'
		'GPRINT:qlocal:AVERAGE:local (avg,max,cur)=(%.0lf,\g'
		'GPRINT:qlocal:MAX:%.0lf,\g'
		'GPRINT:qlocal:LAST:%.0lf)'
		'GPRINT:qsite:AVERAGE:site (avg,max,cur)=(%.0lf,\g'
		'GPRINT:qsite:MAX:%.0lf,\g'
		'GPRINT:qsite:LAST:%.0lf)'
		'GPRINT:qremote:AVERAGE:remote (avg,max,cur)=(%.0lf,\g'
		'GPRINT:qremote:MAX:%.0lf,\g'
		'GPRINT:qremote:LAST:%.0lf)'

