N
NightMan
Guest
Hi
I have created/modified a following script to monitor the qmail queue. it is working fine on our servers. it will mail you, when the amount of mails in local or remote queue execeeding the limit you set in the script.
note: you need to install the qmHandle in the server to use this script.
create a file in the server called e.g mailcheck.sh then chmod it to 755.
modify the script as you wish and save the file. then add it to the cron to run every hour.
#!/bin/bash
qlimit_local=100;
qlimit_remote=1000;
[email protected];
servername='YOURSERVER.COM';
count_remote=`./qmHandle -s | grep "remote queue" | awk -F ":" '{print $2}' | sed 's/ //g'`;
count_local=`./qmHandle -s | grep "local queue" | awk -F ":" '{print $2}' | sed 's/ //g'`;
if [ $count_remote -ge $qlimit_remote ] | [ $count_local -ge $qlimit_local ]; then
mail $notifyemail -s 'Mailqueue limit exceeding - '$servername<<EOF
Dear Server admin,
We have $count_local in local mailqueue.
We have $count_remote in remote mailqueue.
EOF
fi
#-------- SCRIPT END HERE ------------
I have created/modified a following script to monitor the qmail queue. it is working fine on our servers. it will mail you, when the amount of mails in local or remote queue execeeding the limit you set in the script.
note: you need to install the qmHandle in the server to use this script.
create a file in the server called e.g mailcheck.sh then chmod it to 755.
modify the script as you wish and save the file. then add it to the cron to run every hour.
#!/bin/bash
qlimit_local=100;
qlimit_remote=1000;
[email protected];
servername='YOURSERVER.COM';
count_remote=`./qmHandle -s | grep "remote queue" | awk -F ":" '{print $2}' | sed 's/ //g'`;
count_local=`./qmHandle -s | grep "local queue" | awk -F ":" '{print $2}' | sed 's/ //g'`;
if [ $count_remote -ge $qlimit_remote ] | [ $count_local -ge $qlimit_local ]; then
mail $notifyemail -s 'Mailqueue limit exceeding - '$servername<<EOF
Dear Server admin,
We have $count_local in local mailqueue.
We have $count_remote in remote mailqueue.
EOF
fi
#-------- SCRIPT END HERE ------------