Any ideas on ways to monitor Qmail stats?
Ad Widget
Collapse
Ideas on how best to monitor Qmail stats
Collapse
X
-
Tags: None
-
My graphs are staying at zero becuase I think Zabbix is reading the last line of output, which is a zero. Any ideas how to pull each line of stats individually, i can't seem to make it happen yet.
I'm using this command line argument to base my graphs stats from
Here's what I'm trying to useCode:[root@server zabbix]# /var/qmail/bin/qmail-qstat messages in queue: 40 messages in queue but not yet preprocessed: 0
I think it's staying at zero because of the last line which is always zero.Code:[root@titan zabbix]# su - root -c /var/qmail/bin/qmail-qstat |cut -f2 -d":" 40 0
Comment
-
/var/qmail/bin/qmail-qstat |cut -f2 -d":"|head -1 is probably what you want.Comment
-
That works great! Thanks.
I've added this line to the server zabbix_agentd.conf
#
# Added to check the number of emails in queue
#
UserParameter=qmail[qmailstat],su - root -c "/var/qmail/bin/qmail-qstat |cut -f2 -d":"|head -1"
and then I setup an item in the mgmt gui with these parameters
Description: Messages in Queue
Host: hostname
Type: Zabbix Agent
Key: qmail[qmailstat]
Units: <empty>
Multiplier: <empty>
Update Interval: 60
Keep History: 7
Status: Monitored
Type Information: Numeric
Store Value: Delta
But I'm getting this error in the zabbix_agentd.log on the server i'm monitoring and the item in the mgmt gui changes to "Not Supported" so it's failing for some reason.
[root@server zabbix]# tail -f /tmp/zabbix_agentd.log
027700:20050506:093107 Got signal. Exiting ...
027701:20050506:093107 Got signal. Exiting ...
027699:20050506:093107 Got signal. Exiting ...
027697:20050506:093107 Got signal. Exiting ...
028065:20050506:093113 zabbix_agentd started
028066:20050506:093113 zabbix_agentd 28066 started
028067:20050506:093113 zabbix_agentd 28067 started
028068:20050506:093113 zabbix_agentd 28068 started
028069:20050506:093113 zabbix_agentd 28069 started
028070:20050506:093113 zabbix_agentd 28070 started
standard in must be a ttyLast edited by eWebtricity; 06-05-2005, 15:35.Comment
-
Looks like it's a permissions problem. Zabbix doesn't like it when i try to su to the qmail user and it complains when zabbix can't access the qmail directories. I'm not sure how to get around this. Latest error message
[root@server zabbix]# find: queue/mess/*: Permission deniedComment
-
Using this External Parameter in the zabbix_agentd.conf
UserParameter=qmail[qmailstat],/var/qmail/bin/zabbix-qmail
Getting this error message on the zabbix_agentd.log
Zabbix doesn't seem to like the use of sudo or su to execute the qmail-qstat script. Any suggestions?005314:20050510:190834 zabbix_agentd 5314 started
005315:20050510:190834 zabbix_agentd 5315 started
find: queue/mess/*: Permission denied
find: queue/mess/*: Permission deniedComment
-
Use cron job to output result to a file
what you could do is to create a cron job that runs this script and output the result to a file that zabbix has permissions to read. we do this for a number of services we monitor. it works but at the moment we are experiencing a problem whereby the UserParameter switches to Unsupported after a period of time. let me know if you experience this too.
regards
johnComment
-
I believe it happens because you're doing something like this:Originally posted by johnlit works but at the moment we are experiencing a problem whereby the UserParameter switches to Unsupported after a period of time. let me know if you experience this too.
1. command >file
2. UserParameter=qmail, cat file
This is wrong, because when 1. is executed the file becomes (for a 0.01 sec) empty, therefore ZABBIX sets status of the item to Unsupported.
Do this instead:
1. command >file.tmp
2. mv file.tmp file; rm file.tmp
3. UserParameter=qmail, cat fileComment
-
I don't know if this would be beneficial to anyone, and I haven't run it for very long, but here is how I'm doing this. I realize it might be a bit much, but I was trying to keep the code in the zabbix_agentd.conf 1 liners cleaner, and still get all 3 portions of the queue. The only thing I am trying to resolve is right this second I am seeing a bit of a discrepancy between qmailctl stat and qmqtool -s, but i'm not sure where it originates from. If I cant figure it out I may get add qmailctl stat's count just for the sake of finding out the nature of the discrepancy.
To view the stats I use qmqtool (which can be found at jeremy.kister.net), which is run by the following simple script as a cronjob (I do it every minute, but i'm a touch more paranoid for specific reasons). Below are the files, or excerpt
qmailstats.sh
and from zabbix_agentd.confCode:#!/bin/sh /use/local/qmqtool/qmqtool -s > /tmp/queue.tmp head -1 /tmp/queue.tmp | cut -f2 -d":" > /tmp/queue.local head -2 /tmp/queue.tmp | tail -1 | cut -f2 -d":" > /tmp/queue.remote tail -1 /tmp/queue.tmp | cut -f2 -d":" > /tmp/queue.todo
and add then add to crontab something like: (change the 1 to 5 for 5 minute increments.Code:### Monitoring qmail queue ### Accompanies /etc/cron.etc/qmailqueue UserParameter=qmail[qmaillocal],cat /tmp/queue.local UserParameter=qmail[qmailremote],cat /tmp/queue.remote UserParameter=qmail[qmailtodo],cat /tmp/queue.todo
Inside the web interface I did the following (i like keeping data extended periods):Code:*/1 * * * * root /etc/cron.etc/qmailqueue
Code:Description: Messages in qmail <whichever> queue Host: <box> Type: Zabbix agent Key: qmail[qmail<whichever>] Units: <none> Use multiplier: <none> Update interval (in sec): 60 Keep history (in days): 90 Keep trends (in days): 365 Status: Monitored Type of information: Numeric Store value: As is
Comment
-
I'm trying to set up qmail queue monitoring like this, but am not getting any data.
zabbix_agentd.log:
zabbix_agentd.conf:Code:025050:20070207:142008 Can't add user specifed key "qmail[qmailstat]". Incorrect key! 025052:20070207:142008 zabbix_agentd started. ZABBIX 1.1. 025053:20070207:142008 zabbix_agentd 25053 started 025055:20070207:142008 zabbix_agentd 25055 started 025056:20070207:142008 zabbix_agentd 25056 started 025057:20070207:142008 zabbix_agentd 25057 started 025058:20070207:142008 zabbix_agentd 25058 started 025055:20070207:142111 Timeout while answering request 025053:20070207:142608 Timeout while answering request 025053:20070207:142809 Timeout while answering request
qmailstat.sh (cronjob every 10 min):Code:# # Added to check the number of emails in queue # UserParameter=qmail[qmailstat],cat /home/zabbix/qmailstat
/home/zabbix/qmailstat:Code:#! /bin/bash /var/qmail/bin/qmail-qstat |cut -f2 -d":"|head -1 > /home/zabbix/qmailstat.tmp cp /home/zabbix/qmailstat.tmp /home/zabbix/qmailstat chown zabbix:zabbix /home/zabbix/qmailstat rm /home/zabbix/qmailstat.tmp
zabbix gui item config:Code:169
After a short time, Status for this item turns to Not Supported. Why?Code:Description Qmail Messages In Queue Type ZABBIX agent Key qmail[qmailstat] Type of information Numeric (64bit integer) Units blank Use multiplier Do Not Use Update interval (in sec) 60 Keep history (in days) 7 Keep trends (in days) 365 Status Active Store value As is Show value As is
Last edited by shalako; 08-02-2007, 00:22.Comment
-
Figured it out. Server and agent don't like the 'qmailstat' in brackets for UserParameter and Key, as in:
this worked:Code:UserParameter=qmail[qmailstat],cat /home/zabbix/qmailstat
I updated the key in the gui.Code:UserParameter=qmail,cat /home/zabbix/qmailstat
Comment
-
Code:UserParameter=qmail.qmaillocal,cat /tmp/queue.local UserParameter=qmail.qmailremote,cat /tmp/queue.remote UserParameter=qmail.qmailtodo,cat /tmp/queue.todo UserParameter=qmail.procs,ps aux | grep qmail | wc -l
my mailserver screen has x columns for x servers
and 3 rows each showing a custom queue graph with local/remote/todo items
a graph with running qmail processes (qmail.procs) and on the last row there is the output of a transaction script which sends (authentificated) email to a native autoresponder and checks if this email comes back (script availible here)
so i can see every problem related on the timeline to fix issues
a nice feature would be to grep qmail's different processes like qmailr, qmaild, qmaill, qmails (look at the qmail manual) and post them on a zabbix graphComment
Comment