LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2013, 09:34 AM   #1
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Rep: Reputation: Disabled
mdadm Email Notification


I have been trying to get mdadm to send me notifications about my RAID on my ubuntu server with no success for a while now. Out of all the methods this one seems to be the easiest.

http://www.novell.com/support/kb/doc.php?id=7001034


I have tried both ways without success. The method involving the config file seems the best. I am able to get mdadm to write the RAID information to the mdadm.conf and then I add
"MAILADDR myemail@gmail.com" to the end of the file and "DEVICE partitions" to the top.

I execute the command "mdadm --monitor --scan --daemonize" and then it gives me a random number such as "1661".

Lastly, I try to test the email by typing in "mdadm --monitor --scan --test" but it just returns "mdadm: Only one autorebuild process allowed in scan mode, aborting".

I do not have a "/var/log/mail*" but I do have a /var/log/mail.log" which has logs from previous attempts back in April but none more recent than that.

Any idea why this is happening? Or better suggestions on setting this up?

I have tried a few other methods of setting up email notification, could these perhaps have caused conflicts?
 
Old 07-07-2013, 09:29 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
Quote:
Originally Posted by SamSlam023 View Post
I execute the command "mdadm --monitor --scan --daemonize" and then it gives me a random number such as "1661".
That would be the process number of mdadm, shown as it forks into the background as instructed by the "--daemonize" parameter.

Quote:
Originally Posted by SamSlam023 View Post
Lastly, I try to test the email by typing in "mdadm --monitor --scan --test" but it just returns "mdadm: Only one autorebuild process allowed in scan mode, aborting".
You will need to kill the background process first (killall mdadm should do the trick). You can't run a test while another instance of mdadm is running.

Quote:
Originally Posted by SamSlam023 View Post
I do not have a "/var/log/mail*" but I do have a /var/log/mail.log" which has logs from previous attempts back in April but none more recent than that.
That is to be expected if none of your arrays have experienced trouble and you've been unable to run a test.
 
1 members found this post helpful.
Old 07-10-2013, 08:25 PM   #3
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thank you, I now have a better understanding of what is going on here.

Sorry about my delayed response but I have been away for the holidays and only just got back.

When I kill the process and try to initiate the test the cli goes to the next line and is just blank and stays there. Nothing happens. I left it for a few minutes and still nothing.

Should I have left it longer? Or should we try something else?
 
Old 07-10-2013, 08:31 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
What's the exact syntax of the mdadm command you used?
 
Old 07-10-2013, 08:42 PM   #5
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
first I used

killall mdadm

Then

mdadm --monitor --scan --test

This is where it gets stuck
 
Old 07-10-2013, 08:53 PM   #6
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
It will be "stuck" for a while due to the "--scan" parameter. I'm not sure why it takes so long, but I'm seeing the same here.

For a quicker test, specify an md device on the command line, like this:
Code:
mdadm --monitor /dev/mdX --test
...where X is the number of an active md device, obviously.
 
1 members found this post helpful.
Old 07-10-2013, 09:11 PM   #7
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
This might be a bit irrelevant but is it strange that in my fdisk list the active md device is "md127p1"?

In /dev/ there is only "md", "md127" and "md127p1". "md" is a folder with "ubuntu:0" and "ubuntu:0p1"

I tried

"mdadm --monitor /dev/md0 --test"

"mdadm --monitor /dev/md127 --test"

"mdadm --monitor /dev/md127p1 --test"

Each time it returned this message

"mdadm: Monitor using email address "myemail@gmail.com" from config file" after executing "killall mdadm"

"mdadm: Monitor using email address "myemail@gmail.com" from config file
mdadm: Warning: One autorebuild process already running." With mdadm process still running.


and then it got stuck again...
 
Old 07-10-2013, 10:12 PM   #8
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
Here's what happens on my system. I run this command:
Code:
mdadm --monitor /dev/md0 --test
...and the system responds with this:
Code:
mdadm: Monitor using email address "my.email.address@somewhere.com" from config file
Then nothing seems to happen, as the mdadm executable now "monitors" my array. After a minute or two, I receive an email or two about the status of the array. At that point, I cancel the monitoring with Ctrl+C.

If several minutes go by and you don't receive an email, check the mail queue with mailq. You can also test the local MTA's ability to deliver mail with the mail command:
Code:
echo This is a test | mail -s Test your.email.address@gmail.com
 
1 members found this post helpful.
Old 07-10-2013, 10:22 PM   #9
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
I entered this command and received no email.

Code:
echo This is a test | mail -s Test your.email.address@gmail.com
Was I supposed to do any setup for the local MTA? I'm not even sure if that is installed on my server...
 
Old 07-10-2013, 11:07 PM   #10
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
You're using Ubuntu, right? Then your MTA is Postfix.

The default MTA settings for most distributions is to deliver mail using DNS. This means that for every mail, Postfix performs a DNS lookup to find the MX record for the recipient's domain, which points to the responsible mail server(s) for that domain.

Unfortunately, mail from a mail server behind a dynamic IP address on a residential DSL or cable modem connection is likely to be rejected as spam. You need to tell Postfix to send all outgoing mail via your ISP's "smart host", a SMTP relay server that will perform the final delivery on your behalf.

You will need to find the name of your ISP's mail relay. Then you'll have to edit /etc/postfix/main.cf and find the line
Code:
relayhost =
and change it to
Code:
relayhost = [smtp.relay.host]
And yes, the name is supposed to be inside square brackets. You can edit the file with any text editor, but you'll probebly have to start it as root, with sudo. Alternatively, you can use postconf:
Code:
sudo postconf -e 'relayhost = [smtp.relayhost]'
Once you've done this, restart Postfix with
Code:
sudo /etc/init.d/postfix restart
Should you find that postconf isn't a recognized command and there's no sign of /etc/postfix/main.cf, you'll have to install postfix with
Code:
sudo apt-get install postfix
I believe this will start a configuration wizard where, amongst other things, you can enter the name of the relay host.
 
Old 07-11-2013, 02:15 AM   #11
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
I thought that guide was missing something. No wonder I found it the easiest guide to follow :P

I'll give that a go.

Thanks!
 
Old 07-13-2013, 04:05 PM   #12
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
I tried changing the relay host and the email still didn't come through so I reinstalled postfix to get the wizard going.
These are the options I chose:

Internet with smarthost

system mail name: bigpond.net.au
(I was not sure of this, what exactly am I supposed to put in here?)

SMTP relay host: mail.bigpond.com
 
Old 07-14-2013, 06:23 PM   #13
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
Just realized I didn't say the results or asked any questions...

These settings did not work. What am I supposed to put as the system mail name? I tried looking it up but found no clear answers.
 
Old 07-14-2013, 06:39 PM   #14
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
The system name isn't all that important, but the name of the relay host is.

If you're absolutely sure you've entered the correct name for the relay host, try sending a mail from the command line and then watch the mail queue and examine the logs. On Ubuntu I believe the logs are called /var/log/mail.log and /var/log/mail.err. You could even try watching the logs in real time with tail -f in a different terminal window as you're sending a mail.

Also, try telneting port 25 on the relay host (telnet mail.bigpond.com 25). It should respond with a 220 message.
 
Old 07-19-2013, 06:38 AM   #15
SamSlam023
LQ Newbie
 
Registered: Mar 2013
Posts: 22

Original Poster
Rep: Reputation: Disabled
Sorry I have been away for so long again but I recently found out I have type 1 diabetes 0.o

The log says:

Jul 19 19:55:40 ubuntu postfix/master[1221]: daemon started -- version 2.9.6, configuration /etc/postfix
Jul 19 19:58:35 ubuntu postfix/pickup[1226]: E800528C08C9: uid=0 from=<root>
Jul 19 19:58:36 ubuntu postfix/cleanup[1692]: E800528C08C9: message-id=<20130719095835.E800528C08C9@ubuntu>
Jul 19 19:58:36 ubuntu postfix/qmgr[1227]: E800528C08C9: from=<root@bigpond.net.au>, size=419, nrcpt=1 (queue active)
Jul 19 19:58:36 ubuntu postfix/smtp[1694]: E800528C08C9: to=<MYEMAIL@gmail.com>, relay=mail.bigpond.com[61.9.168.249]:25, delay=0.51, delays=0.19/0.03/0.21/0.07, dsn=5.1.0, status=bounced (host mail.bigpond.com[61.9.168.249] said: 550 5.1.0 <root@bigpond.net.au> sender rejected OB505b (in reply to MAIL FROM command))
Jul 19 19:58:36 ubuntu postfix/cleanup[1692]: 8007428C08DA: message-id=<20130719095836.8007428C08DA@ubuntu>
Jul 19 19:58:36 ubuntu postfix/bounce[1695]: E800528C08C9: sender non-delivery notification: 8007428C08DA

and when I telnet the relay host I get this:


root@ubuntu:/var/log# telnet mail.bigpond.com 25
Trying 61.9.168.249...
Connected to mail.bigpond.com.
Escape character is '^]'.
220 nskntcmgw07p BigPond Outbound ESMTP server ready

No message is received.
 
  


Reply

Tags
email, mdadm, notification, raid


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Email notification (new email) for Screen status bar? Xeratul Linux - General 1 03-16-2012 06:26 PM
Nagios - email notification - How to receive alert email? kumaran1983 Linux - Newbie 4 10-20-2011 07:12 AM
Email Notification ezra143 LQ Suggestions & Feedback 6 01-12-2004 11:17 AM
Email notification jeremy LQ Suggestions & Feedback 6 11-07-2002 02:16 PM
email notification elainepearl Linux - General 1 01-14-2002 06:58 AM


All times are GMT -5. The time now is 07:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration