Nagios Mail / Postfix
Nagios Mail / Postfix
hi, i have install postfix for send mail alerte nagios in mailbox Gmail.
yeserday all work my test mail send ok and i see it on gmail.
" echo "le message 2" | mail -s "Sujet2" expertisexxxxx@gmail.com "
but TODAY i install mrtg for nagios i looking for switch bandwidth i understand mrtg make log file every 5mn and nagios look this file. but now every time i write code in terminal i have "new mail in var/mail/root" and my test mail doesnt send now ....
what i break ???
yeserday all work my test mail send ok and i see it on gmail.
" echo "le message 2" | mail -s "Sujet2" expertisexxxxx@gmail.com "
but TODAY i install mrtg for nagios i looking for switch bandwidth i understand mrtg make log file every 5mn and nagios look this file. but now every time i write code in terminal i have "new mail in var/mail/root" and my test mail doesnt send now ....
what i break ???
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Nagios Mail / Postfix
What are the contents of the new mails? It's going to be impossible to troubleshoot unless you know the source and contents of the emails.
You can use the mail program to look at them.
You can use the mail program to look at them.
Re: Nagios Mail / Postfix
i find it, now i received mail in root and if i make new aliases its send on my mail box
root: expertisexxx@gmail.com
and i received a mail every 5mn of MRGT :
why now its in my root, then yesterday echo mail work perfectly ?
root: expertisexxx@gmail.com
and i received a mail every 5mn of MRGT :
Code: Select all
This is the mail system at host expertise2-VirtualBox.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<expertisexxx@gmail.com> (expanded from <root>): host
smtp.orange.fr[80.12.242.10] said: 501 5.1.0 Emetteur invalide. Invalid
Sender. OFR203_405 [405] (in reply to MAIL FROM command)
Final-Recipient: rfc822; expertisexxx@gmail.com
Original-Recipient: rfc822; root
Action: failed
Status: 5.1.0
Remote-MTA: dns; smtp.orange.fr
Diagnostic-Code: smtp; 501 5.1.0 Emetteur invalide. Invalid Sender. OFR203_405
[405]
---------- Message transféré ----------
From: Cron Daemon <root@expertise2-virtualbox>
To: root@expertise2-virtualbox
Cc:
Date: Tue, 28 Apr 2015 17:50:01 +0200 (CEST)
Subject: Cron <root@expertise2-VirtualBox> root env LANG=C /usr/bin/mrtg /var/www/mrtg/mrtg.cfg
/bin/sh: 1: root: not found
Re: Nagios Mail / Postfix
i dont know what's happend in the screen yesterday when i work my mail have right mail "moi = expertisexxx@gmail.com" but now if i create aliases "root : expertisexxx@gmail.com" my mail are send but wrong adress "to = Mail Delivery System <MAILER-DAEMON@expertise2-virtualbox> ".
do you have any idear why now my mail stock in root ??
do you thinking to reinstall postfix beacause its works before ??
do you have any idear why now my mail stock in root ??
do you thinking to reinstall postfix beacause its works before ??
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Nagios Mail / Postfix
Something has changed, Google's mail servers would never accept an E-mail from your non-fqdn address:
Code: Select all
root@expertise2-virtualbox
Re: Nagios Mail / Postfix
voila mon postconf -n
i dont change anything, or if mrtg change it without my permission.
and the last line " i have new mail in /var/mail/root " how to desable this, my mail sending doesnt work since i have this line ....
Code: Select all
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = expertise2-VirtualBox, localhost.localdomain, localhost
myhostname = expertise2-VirtualBox
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost = [smtp.orange.fr]:25
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
Vous avez du nouveau courrier dans /var/mail/root
and the last line " i have new mail in /var/mail/root " how to desable this, my mail sending doesnt work since i have this line ....
Re: Nagios Mail / Postfix
The email that you are receiving is caused by an error in the crontab settings or the script that cron is running for the MRTG.
That should fix the "You have New Mail" on your screen when you are logged in.
To debug the sending of emails, can you run the following while you try to send an email and post the output here?
That should fix the "You have New Mail" on your screen when you are logged in.
To debug the sending of emails, can you run the following while you try to send an email and post the output here?
Code: Select all
tail -f /var/log/maillog
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Nagios Mail / Postfix
yes i remember use contrab -e in install of MRTG :
i don't remeber exactly, i think it's that,
" contrab -e */5 * * * * <mrtg-bin>/mrtg <path to mrtg-cfg>/mrtg.cfg \
--logging /var/log/mrtg.log "
and script for start mrtg and i create too a symbolic link with 'S'xxxscriptMRTG name:
i don't remeber exactly, i think it's that,
" contrab -e */5 * * * * <mrtg-bin>/mrtg <path to mrtg-cfg>/mrtg.cfg \
--logging /var/log/mrtg.log "
and script for start mrtg and i create too a symbolic link with 'S'xxxscriptMRTG name:
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: mrtg
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mrtg init script
# Description: This file is used to start, stop, restart,
# and determined status of the mrtg daemon.
### END INIT INFO
### START OF SCRIPT
set -e
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="mrtg"
NAME=mrtg
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="/etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log"
PIDFILE=/etc/mrtg/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the mrtg package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Function that starts the mrtg daemon
start()
{
env LANG=C start-stop-daemon --start --quiet \
--exec $DAEMON -- $DAEMON_ARGS
}
# Function that stops the mrtg daemon
stop()
{
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile $PIDFILE
}
case "$1" in
start)
log_daemon_msg "Starting $DESC"
start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC"
stop
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;;
esac
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC"
stop
case "$?" in
0|1)
start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;;
esac
;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME"
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}"
;;
esac
exit 0
### END OF SCRIPT
Re: Nagios Mail / Postfix
I send mail with :
"echo "le message 4" | mail -s "Sujet4" expertisexxx@gmail.com "
and my result of mail.log
"echo "le message 4" | mail -s "Sujet4" expertisexxx@gmail.com "
and my result of mail.log
Code: Select all
Apr 30 12:15:01 expertise2-VirtualBox postfix/pickup[9034]: E01B733A97: uid=0 from=<root>
Apr 30 12:15:01 expertise2-VirtualBox postfix/cleanup[9505]: E01B733A97: message-id=<20150430101501.E01B733A97@expertise2-VirtualBox>
Apr 30 12:15:01 expertise2-VirtualBox postfix/qmgr[28873]: E01B733A97: from=<root@expertise2-VirtualBox>, size=601, nrcpt=1 (queue active)
Apr 30 12:15:01 expertise2-VirtualBox postfix/local[9507]: E01B733A97: to=<root@expertise2-VirtualBox>, orig_to=<root>, relay=local, delay=0.04, delays=0.01/0/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
Apr 30 12:15:01 expertise2-VirtualBox postfix/qmgr[28873]: E01B733A97: removed
Apr 30 12:15:41 expertise2-VirtualBox postfix/pickup[9034]: 9E46333A97: uid=1001 from=<nagios@expertise2-VirtualBox>
Apr 30 12:15:41 expertise2-VirtualBox postfix/cleanup[9505]: 9E46333A97: message-id=<20150430101541.9E46333A97@expertise2-VirtualBox>
Apr 30 12:15:41 expertise2-VirtualBox postfix/qmgr[28873]: 9E46333A97: from=<nagios@expertise2-VirtualBox>, size=656, nrcpt=1 (queue active)
Apr 30 12:15:42 expertise2-VirtualBox postfix/smtp[9530]: 9E46333A97: to=<expertisexxx@gmail.com>, relay=smtp.orange.fr[193.252.22.64]:25, delay=1.3, delays=0.01/0.01/0.18/1.1, dsn=5.1.0, status=bounced (host smtp.orange.fr[193.252.22.64] said: 501 5.1.0 Emetteur invalide. Invalid Sender. OFR203_405 [405] (in reply to MAIL FROM command))
Apr 30 12:15:42 expertise2-VirtualBox postfix/cleanup[9505]: E7E8433A99: message-id=<20150430101542.E7E8433A99@expertise2-VirtualBox>
Apr 30 12:15:42 expertise2-VirtualBox postfix/qmgr[28873]: E7E8433A99: from=<>, size=2682, nrcpt=1 (queue active)
Apr 30 12:15:42 expertise2-VirtualBox postfix/bounce[9531]: 9E46333A97: sender non-delivery notification: E7E8433A99
Apr 30 12:15:42 expertise2-VirtualBox postfix/local[9507]: E7E8433A99: to=<nagios@expertise2-VirtualBox>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Apr 30 12:15:42 expertise2-VirtualBox postfix/qmgr[28873]: E7E8433A99: removed
Apr 30 12:15:42 expertise2-VirtualBox postfix/qmgr[28873]: 9E46333A97: removed
Apr 30 12:15:52 expertise2-VirtualBox postfix/pickup[9034]: 427C933A97: uid=0 from=<root@expertise2-VirtualBox>
Apr 30 12:15:52 expertise2-VirtualBox postfix/cleanup[9505]: 427C933A97: message-id=<20150430101552.427C933A97@expertise2-VirtualBox>
Apr 30 12:15:52 expertise2-VirtualBox postfix/qmgr[28873]: 427C933A97: from=<root@expertise2-VirtualBox>, size=381, nrcpt=1 (queue active)
Apr 30 12:15:53 expertise2-VirtualBox postfix/smtp[9530]: 427C933A97: to=<expertisexxx@gmail.com>, relay=smtp.orange.fr[80.12.242.10]:25, delay=1.2, delays=0.01/0/0.14/1.1, dsn=5.1.0, status=bounced (host smtp.orange.fr[80.12.242.10] said: 501 5.1.0 Emetteur invalide. Invalid Sender. OFR203_405 [405] (in reply to MAIL FROM command))
Apr 30 12:15:53 expertise2-VirtualBox postfix/cleanup[9505]: 8643D33A99: message-id=<20150430101553.8643D33A99@expertise2-VirtualBox>
Apr 30 12:15:53 expertise2-VirtualBox postfix/qmgr[28873]: 8643D33A99: from=<>, size=2400, nrcpt=1 (queue active)
Apr 30 12:15:53 expertise2-VirtualBox postfix/bounce[9531]: 427C933A97: sender non-delivery notification: 8643D33A99
Apr 30 12:15:53 expertise2-VirtualBox postfix/qmgr[28873]: 427C933A97: removed
Apr 30 12:15:53 expertise2-VirtualBox postfix/local[9507]: 8643D33A99: to=<root@expertise2-VirtualBox>, relay=local, delay=0.07, delays=0.04/0/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
Apr 30 12:15:53 expertise2-VirtualBox postfix/qmgr[28873]: 8643D33A99: removed
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Nagios Mail / Postfix
Using the mail command will not work unless you specify a valid from address. You can use the -r flag - although some MTAs don't honor that.
Code: Select all
echo "This is a test E-mail" | mail -r mickey-mouse@example.net -s Subject user@domain.com
- Attachments
-
- Clipboard01.jpg (5.09 KiB) Viewed 6009 times