Sendmail: Supprimer les mails en attente
flipmode62
Messages postés
52
Statut
Membre
-
dubcek Messages postés 19033 Date d'inscription Statut Contributeur Dernière intervention -
dubcek Messages postés 19033 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
Je travaille sous un serveur Linux (Redhat), j'ai installé Nagios et Centreon
J'ai arrété Sendmail car Nagios m'envoyait beaucoup de mails (plus de 2000) car mes serveurs ne fonctionnaient pas. Donc j'ai fait un /etc/init.d/sendmail stop
Le probléme c'est que quand je redémarre Sendmail, il m'envoie pleins de mails, dont des mails qui datent d'une semaine (Sendmail est arrété depuis une semaine mais Nagios a continué à fonctionner)
Comment je peux supprimer les mails qui doivent etre envoyés afin d'éviter que je me fasse spammer par des mails qui datent de plusieurs jours ?
Comment je peux supprimer tous les mails qui sont en attente et qui n'ont pas encore été envoyés ?
Merci pour votre aide
Flipmode
Je travaille sous un serveur Linux (Redhat), j'ai installé Nagios et Centreon
J'ai arrété Sendmail car Nagios m'envoyait beaucoup de mails (plus de 2000) car mes serveurs ne fonctionnaient pas. Donc j'ai fait un /etc/init.d/sendmail stop
Le probléme c'est que quand je redémarre Sendmail, il m'envoie pleins de mails, dont des mails qui datent d'une semaine (Sendmail est arrété depuis une semaine mais Nagios a continué à fonctionner)
Comment je peux supprimer les mails qui doivent etre envoyés afin d'éviter que je me fasse spammer par des mails qui datent de plusieurs jours ?
Comment je peux supprimer tous les mails qui sont en attente et qui n'ont pas encore été envoyés ?
Merci pour votre aide
Flipmode
29 réponses
Mes fichiers sont toujours dans : /var/spool/clientmqueue/
grep -v "^H??To: nagios"/var/spool/clientmqueue/d*
bash: /bin/grep: Argument list too long
Donc je peux pas voir si un mail est destiné à nagios
grep -v "^H??To: nagios"/var/spool/clientmqueue/d*
bash: /bin/grep: Argument list too long
Donc je peux pas voir si un mail est destiné à nagios
salut,
j'ai suivi votre discussion (et j'apprends en même temps), je suis tombé sur ceci :
vider la file :
via le demon : sendmail -L sm-msp-queue -Ac -q15m
via cron : sendmail -L sm-msp-queue -Ac -q
source :http://sebastien.nameche.fr/
catégorie: Support de Cours
titre: Durcissement des MTA Sendmail et Postfix
page 9
si ça peut aider .....
j'ai suivi votre discussion (et j'apprends en même temps), je suis tombé sur ceci :
vider la file :
via le demon : sendmail -L sm-msp-queue -Ac -q15m
via cron : sendmail -L sm-msp-queue -Ac -q
source :http://sebastien.nameche.fr/
catégorie: Support de Cours
titre: Durcissement des MTA Sendmail et Postfix
page 9
si ça peut aider .....
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
J'ai supprimé tous les fichiers qui étaient dans la queue: /var/spool/clientmqueue
Et j'ai relancé Sendmail: /etc/init.d/sendmail start et j'ai fait: sendmail -L sm-msp-queue -Ac -q15m
Le probléme c'est que maintenant je ne reçois pu aucun mail de Nagios :(
Pourtant quand je fais:
sendmail xxxx@yy.com
From: nagios@localhost.localdomain
Subject: Test
...... contenu du message .....
Je reçois bien un mail de nagios@localhost.localdomain. Mais quand il y a une alerte Nagios, elle n'est pas envoyée par mail. Je n'ai rien dans la queue /var/spool/clientmqueue et dans la queue /var/spool/mqueue
Merci pour votre aide
Flipmode
Et j'ai relancé Sendmail: /etc/init.d/sendmail start et j'ai fait: sendmail -L sm-msp-queue -Ac -q15m
Le probléme c'est que maintenant je ne reçois pu aucun mail de Nagios :(
Pourtant quand je fais:
sendmail xxxx@yy.com
From: nagios@localhost.localdomain
Subject: Test
...... contenu du message .....
Je reçois bien un mail de nagios@localhost.localdomain. Mais quand il y a une alerte Nagios, elle n'est pas envoyée par mail. Je n'ai rien dans la queue /var/spool/clientmqueue et dans la queue /var/spool/mqueue
Merci pour votre aide
Flipmode
y a-t-il une trace dans les logs, syslog ou /var/log/maillog ?
remplacer localhost.localdomain par yy.com dans la conf nagios ?
remplacer localhost.localdomain par yy.com dans la conf nagios ?
tail -100 /usr/local/nagios/var/nagios.log
[1229525435] HOST ALERT: SNOYECH01;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 1.23 ms
[1229525435] HOST ALERT: SNOYMON02;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.04 ms
[1229525435] SERVICE ALERT: SLENBO02;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:3437.57 Mb - used: 538.18 Mb (16%) - free: 2899.40 Mb (84%)
[1229525435] SERVICE ALERT: SLENBO01;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:5475.58 Mb - used: 1055.20 Mb (19%) - free: 4420.38 Mb (81%)
[1229525435] SERVICE ALERT: SLENDC01;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:3947.59 Mb - used: 473.91 Mb (12%) - free: 3473.67 Mb (88%)
[1229525435] SERVICE ALERT: SLENCYB01;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:2473.51 Mb - used: 274.18 Mb (11%) - free: 2199.33 Mb (89%)
[1229525436] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525436] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525437] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525437] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525438] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525438] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525439] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525439] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
J'ai ajouté une redirection dans le fichier de commande, de la sortie standard et erreur vers un log pour la commande de notification.
commands.cfg:
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ >> /tmp/alerteservice.log 2>&1
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ >> /tmp/alertehost.log 2>&1
}
J'ai vérifié que les notifications sont activées dans Nagios.cfg (enable_notifications=1)
J'ai vérifié que mes hosts/services/templates contennaient des notifications
J'ai vérifié que mes contacts aient des adresses mails valides.
J'ai essayé, en ligne de commande, en tant que Nagios de lancer la commande de notification:
La commande suivante:
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: "NotifType"\nHost: 192.168.60.37\nState: CRITICAL\nAddress: 192.168.60.37\nInfo: ERREUR ALERTE NAGIOS ESPACE DISK FULL\n\nDate/Time: 24/10/2008\n" | /bin/mail -s "** CRITICAL Host Alert: AGGREGATE is DOWN **" nom.prenom@entreprise.com
me permet de recevoir ce mail ci dessous:
***** Nagios *****
Notification Type: NotifType
Host: 192.168.60.37
State: CRITICAL
Address: 192.168.60.37
Info: ERREUR ALERTE NAGIOS ESPACE DISK FULL
Date/Time: 24/10/2008
Merci pour votre aide
[1229525435] HOST ALERT: SNOYECH01;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 1.23 ms
[1229525435] HOST ALERT: SNOYMON02;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.04 ms
[1229525435] SERVICE ALERT: SLENBO02;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:3437.57 Mb - used: 538.18 Mb (16%) - free: 2899.40 Mb (84%)
[1229525435] SERVICE ALERT: SLENBO01;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:5475.58 Mb - used: 1055.20 Mb (19%) - free: 4420.38 Mb (81%)
[1229525435] SERVICE ALERT: SLENDC01;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:3947.59 Mb - used: 473.91 Mb (12%) - free: 3473.67 Mb (88%)
[1229525435] SERVICE ALERT: SLENCYB01;Windows-Ram-Usage;OK;HARD;1;Memory usage: total:2473.51 Mb - used: 274.18 Mb (11%) - free: 2199.33 Mb (89%)
[1229525436] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525436] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525437] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525437] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525438] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525438] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525439] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
[1229525439] Max concurrent service checks (20) has been reached. Delaying further checks until previous checks are complete...
J'ai ajouté une redirection dans le fichier de commande, de la sortie standard et erreur vers un log pour la commande de notification.
commands.cfg:
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ >> /tmp/alerteservice.log 2>&1
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ >> /tmp/alertehost.log 2>&1
}
J'ai vérifié que les notifications sont activées dans Nagios.cfg (enable_notifications=1)
J'ai vérifié que mes hosts/services/templates contennaient des notifications
J'ai vérifié que mes contacts aient des adresses mails valides.
J'ai essayé, en ligne de commande, en tant que Nagios de lancer la commande de notification:
La commande suivante:
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: "NotifType"\nHost: 192.168.60.37\nState: CRITICAL\nAddress: 192.168.60.37\nInfo: ERREUR ALERTE NAGIOS ESPACE DISK FULL\n\nDate/Time: 24/10/2008\n" | /bin/mail -s "** CRITICAL Host Alert: AGGREGATE is DOWN **" nom.prenom@entreprise.com
me permet de recevoir ce mail ci dessous:
***** Nagios *****
Notification Type: NotifType
Host: 192.168.60.37
State: CRITICAL
Address: 192.168.60.37
Info: ERREUR ALERTE NAGIOS ESPACE DISK FULL
Date/Time: 24/10/2008
Merci pour votre aide
y a-t-il une trace dans les logs, syslog ou /var/log/maillog ?
je parlais des logs sendmail pour voir il y a quelque chose venant de nagios
je parlais des logs sendmail pour voir il y a quelque chose venant de nagios
/var/log/maillog
.........................................................................................................................................................................................
Dec 17 16:12:01 localhost sendmail[9994]: mBHFC12f009994: from=nagios, size=387, class=0, nrcpts=1, msgid=<200812171512.mBHFC12f009994@SNOYMON02>, relay=nagios@localhost
Dec 17 16:12:01 localhost sendmail[9996]: mBHFC1cr009996: from=<nagios@SNOYMON02>, size=620, class=0, nrcpts=1, msgid=<200812171512.mBHFC12f009994@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:12:01 localhost sendmail[9995]: mBHFC11n009995: from=<nagios@SNOYMON02>, size=605, class=0, nrcpts=1, msgid=<200812171512.mBHFC1s4009992@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:12:01 localhost sendmail[9992]: mBHFC1s4009992: to=nagios, ctladdr=nagios (501/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30372, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mBHFC11n009995 Message accepted for delivery)
Dec 17 16:12:01 localhost sendmail[9994]: mBHFC12f009994: 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=2.0.0, stat=Sent (mBHFC1cr009996 Message accepted for delivery)
Dec 17 16:12:01 localhost sendmail[9997]: mBHFC11n009995: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30787, dsn=2.0.0, stat=Sent
Dec 17 16:12:01 localhost sendmail[9998]: mBHFC1cr009996: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30802, dsn=2.0.0, stat=Sent
Dec 17 16:13:01 localhost sendmail[11485]: mBHFD1pV011485: from=nagios, size=387, class=0, nrcpts=1, msgid=<200812171513.mBHFD1pV011485@SNOYMON02>, relay=nagios@localhost
Dec 17 16:13:01 localhost sendmail[11488]: mBHFD17J011488: from=nagios, size=372, class=0, nrcpts=1, msgid=<200812171513.mBHFD17J011488@SNOYMON02>, relay=nagios@localhost
Dec 17 16:13:01 localhost sendmail[11489]: mBHFD1kD011489: from=<nagios@SNOYMON02>, size=620, class=0, nrcpts=1, msgid=<200812171513.mBHFD1pV011485@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:13:01 localhost sendmail[11485]: mBHFD1pV011485: 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=2.0.0, stat=Sent (mBHFD1kD011489 Message accepted for delivery)
Dec 17 16:13:01 localhost sendmail[11490]: mBHFD1dt011490: from=<nagios@SNOYMON02>, size=605, class=0, nrcpts=1, msgid=<200812171513.mBHFD17J011488@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:13:01 localhost sendmail[11491]: mBHFD1kD011489: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30802, dsn=2.0.0, stat=Sent
Dec 17 16:13:01 localhost sendmail[11488]: mBHFD17J011488: to=nagios, ctladdr=nagios (501/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30372, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mBHFD1dt011490 Message accepted for delivery)
Dec 17 16:13:01 localhost sendmail[11493]: mBHFD1dt011490: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30787, dsn=2.0.0, stat=Sent
.........................................................................................................................................................................................
Merci pour votre aide
.........................................................................................................................................................................................
Dec 17 16:12:01 localhost sendmail[9994]: mBHFC12f009994: from=nagios, size=387, class=0, nrcpts=1, msgid=<200812171512.mBHFC12f009994@SNOYMON02>, relay=nagios@localhost
Dec 17 16:12:01 localhost sendmail[9996]: mBHFC1cr009996: from=<nagios@SNOYMON02>, size=620, class=0, nrcpts=1, msgid=<200812171512.mBHFC12f009994@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:12:01 localhost sendmail[9995]: mBHFC11n009995: from=<nagios@SNOYMON02>, size=605, class=0, nrcpts=1, msgid=<200812171512.mBHFC1s4009992@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:12:01 localhost sendmail[9992]: mBHFC1s4009992: to=nagios, ctladdr=nagios (501/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30372, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mBHFC11n009995 Message accepted for delivery)
Dec 17 16:12:01 localhost sendmail[9994]: mBHFC12f009994: 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=2.0.0, stat=Sent (mBHFC1cr009996 Message accepted for delivery)
Dec 17 16:12:01 localhost sendmail[9997]: mBHFC11n009995: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30787, dsn=2.0.0, stat=Sent
Dec 17 16:12:01 localhost sendmail[9998]: mBHFC1cr009996: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30802, dsn=2.0.0, stat=Sent
Dec 17 16:13:01 localhost sendmail[11485]: mBHFD1pV011485: from=nagios, size=387, class=0, nrcpts=1, msgid=<200812171513.mBHFD1pV011485@SNOYMON02>, relay=nagios@localhost
Dec 17 16:13:01 localhost sendmail[11488]: mBHFD17J011488: from=nagios, size=372, class=0, nrcpts=1, msgid=<200812171513.mBHFD17J011488@SNOYMON02>, relay=nagios@localhost
Dec 17 16:13:01 localhost sendmail[11489]: mBHFD1kD011489: from=<nagios@SNOYMON02>, size=620, class=0, nrcpts=1, msgid=<200812171513.mBHFD1pV011485@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:13:01 localhost sendmail[11485]: mBHFD1pV011485: 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=2.0.0, stat=Sent (mBHFD1kD011489 Message accepted for delivery)
Dec 17 16:13:01 localhost sendmail[11490]: mBHFD1dt011490: from=<nagios@SNOYMON02>, size=605, class=0, nrcpts=1, msgid=<200812171513.mBHFD17J011488@SNOYMON02>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 17 16:13:01 localhost sendmail[11491]: mBHFD1kD011489: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30802, dsn=2.0.0, stat=Sent
Dec 17 16:13:01 localhost sendmail[11488]: mBHFD17J011488: to=nagios, ctladdr=nagios (501/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30372, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mBHFD1dt011490 Message accepted for delivery)
Dec 17 16:13:01 localhost sendmail[11493]: mBHFD1dt011490: to=<nagios@SNOYMON02>, ctladdr=<nagios@SNOYMON02> (501/502), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30787, dsn=2.0.0, stat=Sent
.........................................................................................................................................................................................
Merci pour votre aide