Sendmail: Remove pending emails
flipmode62
Posted messages
52
Status
Member
-
dubcek Posted messages 18627 Registration date Status Contributor Last intervention -
dubcek Posted messages 18627 Registration date Status Contributor Last intervention -
Hello,
I am working on a Linux server (Redhat), I have installed Nagios and Centreon.
I stopped Sendmail because Nagios was sending me a lot of emails (more than 2000) since my servers were not functioning. So I did a /etc/init.d/sendmail stop
The problem is that when I restart Sendmail, it sends me a lot of emails, including emails that are a week old (Sendmail has been stopped for a week but Nagios continued to run).
How can I delete the emails that need to be sent to avoid being spammed by emails that are several days old?
How can I delete all the emails that are pending and have not yet been sent?
Thank you for your help
Flipmode
I am working on a Linux server (Redhat), I have installed Nagios and Centreon.
I stopped Sendmail because Nagios was sending me a lot of emails (more than 2000) since my servers were not functioning. So I did a /etc/init.d/sendmail stop
The problem is that when I restart Sendmail, it sends me a lot of emails, including emails that are a week old (Sendmail has been stopped for a week but Nagios continued to run).
How can I delete the emails that need to be sent to avoid being spammed by emails that are several days old?
How can I delete all the emails that are pending and have not yet been sent?
Thank you for your help
Flipmode
Configuration: Linux Red Hat Firefox 1.5.0.12
29 answers
- 1
- 2
Next
-
if you run
grep -v "^H??To: nagios" /tmp/d*
you can check if an email is not addressed to nagios -
and there is nothing in /var/spool/mail?
the emails seem to be sent -
hello
go clean up /var/spool/mqueue -
I've already checked in /var/spool/mqueue and there's nothing there :(
ll /var/spool/mqueue/
total 0
Is there another directory or file that needs to be modified or deleted?
Thank you for your help
Flipmode -
that's where sendmail stores its queue. they might be in a Nagios queue?
or is the directory redefined in the sendmail config?
what does /usr/bin/mailq respond? -
Maybe there is a Nagios queue, but I have no idea where it is.
In the directory: /var/spool/mail/, there are different files corresponding to different users (and one of them is named Nagios. However, in: /var/spool/mqueue/ there are no files
Is the directory redefined in the sendmail configuration? In the file /etc/mail/sendmail.cf?
Thank you for your help. -
yes
in /var/spool/mail, it's the received emails -
So the emails that could not be sent by Nagios using Sendmail (because Sendmail was stopped) are where?
Thank you for your help -
Since there is nothing in /var/spool/mqueue, I don't know, try a search with find.
check in the nagios directory. -
I tried looking in the Nagios directory... and searching with find but I found nothing :(
I restarted Sendmail, and it's spamming me with emails from a week ago, so there must be a queue somewhere
Thanks for your help
Flipmode -
/usr/bin/mailq returns the mail queue status.
find / -name "*mqueue*" -print searches for directories or files with the name "mqueue" starting from the root directory.
-
/usr/bin/mailq
/var/spool/mqueue est vide
Requêtes totales : 0
Thank you for your help -
check where the emails come from, maybe when sendmail starts another server sends them.
-
sendmail is used to send and receive mail. Are the mails sent from this machine?
Check in /var/log/maillog
What does
find / -name "*mqueue*" -print
respond? -
Sendmail is used to send emails (just like Postfix). I am using the company's SMTP server.
/var/log/maillog
...
Dec 14 06:07:49 SNOYMON02 sendmail[28501]: mBE57nRu028501: to=prenom.nom@entreprise.fr, ctladdr=nagios (501/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30334, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Dec 14 06:08:01 SNOYMON02 sendmail[28888]: mBE581W7028888: from=nagios, size=387, class=0, nrcpts=1, msgid=<200812140508.mBE581W7028888@localhost.localdomain>, relay=nagios@localhost
Dec 14 06:08:01 SNOYMON02 sendmail[28886]: mBE581tD028886: from=nagios, size=372, class=0, nrcpts=1, msgid=<200812140508.mBE581tD028886@localhost.localdomain>, relay=nagios@localhost
Dec 14 06:08:01 SNOYMON02 sendmail[28888]: mBE581W7028888: to=nagios, ctladdr=nagios (501/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30387, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
...
find / -name "*mqueue*" -print
/usr/include/bits/mqueue.h
/usr/include/mqueue.h
/usr/share/man/man0p/mqueue.h.0p.gz
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/bits/mqueue.ph
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/mqueue.ph
/usr/src/kernels/2.6.9-67.EL-x86_64/include/config/posix/mqueue.h
/usr/src/kernels/2.6.9-67.EL-x86_64/include/linux/mqueue.h
/usr/src/kernels/2.6.9-67.EL-largesmp-x86_64/include/config/posix/mqueue.h
/usr/src/kernels/2.6.9-67.EL-largesmp-x86_64/include/linux/mqueue.h
/usr/src/kernels/2.6.9-67.EL-smp-x86_64/include/config/posix/mqueue.h
/usr/src/kernels/2.6.9-67.EL-smp-x86_64/include/linux/mqueue.h
/var/spool/clientmqueue
/var/spool/mqueue -
files there /var/spool/clientmqueue?
-
Yes, there are a lot of files in /var/spool/clientmqueue:
ls /var/spool/clientmqueue
dfmAIJTjGP017247 dfmASMYdhQ023415 dfmBAAwBnT004284 dfmB6E01Fg002779 dfmBDID18P021723 qfmAONl1dJ030111 qfmB2KstEq014086 qfmBA9ghuh007487 dfmAIJTkci017273 dfmASMYdhQ023427 dfmB6E01xR002784 dfmBDID1hF021725 qfmAONl1fZ030109 qfmB2Kstf4014157 qfmALDP1BP007872
Example of files:
<bold>vi dfmBAAwBnT004284
***** centreon Notification *****
Notification Type: RECOVERY
Service: EgoRadio7
Host: SLENEGO02 - SLENEGO02
Address: 172.17.42.157
State: OK
Date/Time: 10-12-2008 / 11:58:11 Additional Info : EgoRadioarvato20007: Started
vi qfmALDP1BP007872
V8
T1227273901
K1227273901
N1
P30387
MDeferred: Connection refused by [127.0.0.1]
Fbs
$_nagios@localhost
${daemon_flags}c u
Snagios
Anagios@localhost.localdomain
MDeferred: Connection refused by [127.0.0.1]
C:nagios
rRFC822; nagios@localhost.localdomain
RPFD:nagios
H?P?Return-Path: <g>
H??Received: (from nagios@localhost)
by localhost.localdomain (8.13.1/8.13.1/Submit) id mALDP1BP007872;
Fri, 21 Nov 2008 14:25:01 +0100
H?D?Date: Fri, 21 Nov 2008 14:25:01 +0100
H?x?Full-Name: CronDaemon
H?M?Message-Id: <200811211325.mALDP1BP007872@localhost.localdomain>
H??From: root (Cron Daemon)
H??To: nagios
H??Subject: Cron <nagios@SNOYMON02> /usr/local/centreon/cron/parsing_status.pl 2>&1 >> /usr/local/centreon/log/odsParsingStatus.log
H??X-Cron-Env: <SHELL=/bin/sh>
H??X-Cron-Env: <HOME=/home/nagios>
H??X-Cron-Env: <PATH=/usr/bin:/bin>
H??X-Cron-Env: <LOGNAME=nagios>
H??X-Cron-Env: <USER=nagios>
Should I delete it? -
yes or you move them to /tmp
-
it's a lot, indeed
-
Yes, it's much more than I thought and it takes several minutes to move!
- 1
- 2
Next