unraid_notify 2.55 [01-01-2010]: Email notifications for unRAID status


Recommended Posts

Brainbone, A+ for effort and implementation into a consolidated sh based monitor.

 

My suggestion at this point would be to consider looking at nagios.

 

It has allot of what you planned as far as scheduling checks, and alerting.

What is needed is small plugin modules that could query the array or smart status and report back to Nagios.

 

I was thinking of compiling a static version of nagios with the embedded perl interpreter so that the community could write plugins in sh or very simple perl.

 

I do have a statically compiled miniperl interpreter if you were interested.

It does not have all of the files or plugs. Just a raw interpreter, but still contains all the functionality of sh/awk/sed & perl.

 

I was thinking of waiting until version 5 also, but with unRAID web or a mini http server that had CGI capability this could work now.

In fact I was also exploring a mini httpd that had the embeded mini perl interpreter also.

 

Thoughts?

Link to comment
  • Replies 235
  • Created
  • Last Reply

Top Posters In This Topic

On first thought, Nagios seems like killing an ant with a sledge hammer in respect to unRAID, but...

 

I've recently been working on switching over to Nagios (using the Nagios VMA) for monitoring my ESXi servers (business), but wanted to keep my unRAID server (home) self sufficient, and not dependent on a separate server for monitoring.   If Nagios could be run on unRAID.... hmmm....

 

I'm interested.  If you can get Nagios (http server and all) working on unRAID without much trouble, I say go for it!

Link to comment
  • 4 weeks later...

I have installed and started the unraid_notify script - but I don't get notifications.

 

activating debug mode shows "Timeout waiting for client input" - any hints or help?

 

THanks, Guzzi

 

root@TOWER:/boot/packages# unraid_notify -d

>

< 220 mailserver.domain.local Microsoft ESMTP MAIL Service ready at Wed, 16 Dec 2009 14:11:55 +0100

> EHLO TOWER

< 451 4.7.0 Timeout waiting for client input

451 4.7.0 Timeout waiting for client input

root@TOWER:/boot/packages#

 

Link to comment

I have installed and started the unraid_notify script - but I don't get notifications.

 

activating debug mode shows "Timeout waiting for client input" - any hints or help?

 

Try the attached 2.51 version.  Please let me know if it resolves the issue.

 

Edit:

Also, when debugging, try:  unraid_notify -f -d -e

This will force a notification to be sent (-f), show debug output of the smtp session (-d) and force an error level, sending email to those that receive only error reports (-e).

 

Edit2:

Attachment removed.  See top post for most recent stable version.

Link to comment

I have installed and started the unraid_notify script - but I don't get notifications.

 

activating debug mode shows "Timeout waiting for client input" - any hints or help?

 

Try the attached 2.51 version.  Please let me know if it resolves the issue.

 

Edit:

Also, when debugging, try:  unraid_notify -f -d -e

This will force a notification to be sent (-f), show debug output of the smtp session (-d) and force an error level, sending email to those that receive only error reports (-e).

 

 

THanks for the quick reply.

Installed the 2.51 version and used the debug options. This gives following details:

 

root@TOWER:~# unraid_notify -f -d -e

>

< 220 mail.domain.local Microsoft ESMTP MAIL Service ready at Wed, 16 Dec 2009 19:35:24 +0100

> EHLO TOWER

< 250 XRDST

> MAIL FROM: <[email protected]>

< 250 2.1.0 Sender OK

> RCPT TO: <[email protected]>

< 250 2.1.5 Recipient OK

> RCPT TO: <[email protected]>

< 250 2.1.5 Recipient OK

> RCPT TO: <[email protected]>

< 250 2.1.5 Recipient OK

> DATA

< 354 Start mail input; end with <CRLF>.<CRLF>

> .

< 451 4.7.0 Timeout waiting for client input

451 4.7.0 Timeout waiting for client input

root@TOWER:~#

 

Link to comment

Getting closer...

 

Please try the attached v2.52

 

 

Hi brainbone,

 

Thanks, yes, it's working now!

 

But I now get 2 mails - one directly and one with an attached mail with the infos.

 

Debug shows:

root@TOWER:~# unraid_notify -f -d -e

>

< 220 mail.domain.local Microsoft ESMTP MAIL Service ready at Wed, 16 Dec 2009 21:35:50 +0100

> EHLO TOWER

< 250 XRDST

> MAIL FROM: <[email protected]>

< 250 2.1.0 Sender OK

> RCPT TO: <[email protected]>

< 250 2.1.5 Recipient OK

> RCPT TO: <[email protected]>

< 250 2.1.5 Recipient OK

> RCPT TO: <[email protected]>

< 250 2.1.5 Recipient OK

> DATA

< 354 Start mail input; end with <CRLF>.<CRLF>

> .

< 250 2.6.0 <[email protected]> Queued mail for delivery

> QUIT

< 221 2.0.0 Service closing transmission channel

 

 

Link to comment

The emails should be the same.

 

It looks like you may be getting two because you have repeated them in "RcptTo" and "ErrorRcptTo"?

 

"RcptTo" will get a notification every "NotifyDelay" min., or if the error status changes.

"ErrorRcptTo" will get a notification only if the error status changes.

 

If an error occurs and you have the same address in both ErrorRcptTo and RcptTo, the address will receive the same email twice.

 

Link to comment

The emails should be the same.

 

It looks like you may be getting two because you have repeated them in "RcptTo" and "ErrorRcptTo"?

 

"RcptTo" will get a notification every "NotifyDelay" min., or if the error status changes.

"ErrorRcptTo" will get a notification only if the error status changes.

 

If an error occurs and you have the same address in both ErrorRcptTo and RcptTo, the address will receive the same email twice.

 

 

hmmm, in fact I get two mails because I have two mailadresses configured. I will have to check, why I get both mails for user1 and user2, being user2 (that's also the reason why one mail contains the content directly and the other as attachment).

For the time I just changed the unraidconfiguration to just send it to one mailaccount.

One final question: There is still settings for spindown in the config - but according to changehistory it's no more used, right? (Avoiding conflicts with latest 4.5 implementation of spindown)

 

Thanks for your help, I will now deploy it to my two "prod-servers" and see if all is fine.

Link to comment
One final question: There is still settings for spindown in the config - but according to changehistory it's no more used, right? (Avoiding conflicts with latest 4.5 implementation of spindown)

 

Thanks for your help, I will now deploy it to my two "prod-servers" and see if all is fine.

 

Yes. The setting is ignored.

 

Link to comment

unraid_notify has been updated to version 2.52.

 

In versions prior to 2.52, bashmail incorrectly used LF for SMTP line termination.  Because many SMTP servers also incorrectly accept LF for line termination, I didn't catch this error until Guzzi pointed out that communication with Microsoft SMTP server is not working.

 

Bashmail (along with unraid_notify and mail as a result) now correctly uses CRLF for SMTP line termination.

 

If you were unable to send notifications before, give v2.52 a try.

 

See top post for v2.52 download.

 

Link to comment
The apcupsd command just sends mail to root.  It is up to you to configure a mail command to forward it onward.

 

The mail command should be able to tested as follows:

echo "this is a test of mail" | mail -s "this is a test" [email protected]

If that works, then try

echo "this is a test of root mail" | mail -s "this is a second test" root

 

if neither works the UPS daemon program will never be able to send mail until you install a working mail command.   If the first one one does, but the second does not, you've got to forward "root" e-mail.  (more configuration you need to perform)

 

 

 

I'm, taking up the mail function again.... , installed unraid_notify 2.52

 

When doing this...

echo "this is a test of mail" | mail -s "this is a test" [email protected]

 

This is OK i got mail to my personal mail  ;D

 

Doing this ...

echo "this is a test of mail" | mail -s "this is a new test" root

 

This is not working  :'(

 

I have done this  ...  echo "[email protected]" >/root/.forward

 

Is it something I have missed ? I like to see if it possible to get all root mail to may personal mailbox  ;)

 

//Peter

 

 

 

 

Link to comment

The "mail" command sends directly through the smtp server configured in unraid_notify.cfg.

 

If you set "root" as a recipient, your SMTP server needs to know who "root" is.

 

About the only work-around I can think of is if I modify mail to ignore "root", not allowing it to override the RcptTo line in unraid_notify.cfg.

 

Anyone see a problem with this approach?

 

Link to comment

The "mail" command sends directly through the smtp server configured in unraid_notify.cfg.

 

If you set "root" as a recipient, your SMTP server needs to know who "root" is.

 

About the only work-around I can think of is if I modify mail to ignore "root", not allowing it to override the RcptTo line in unraid_notify.cfg.

 

Anyone see a problem with this approach?

 

Most linux/unix mail programs use "sendmail" and will look in the home directory of a local user for a ".forward" file.  if one exists, and if it contains a valid e-mail address, it is used.

 

http://www.feep.net/sendmail/tutorial/intro/forward.html

 

Now, the "sendmail" version can handle multiple lines, and piping to programs, but if you just add a little logic, your mail command can also forward based on .forward lines.

 

I stopped using shell scripts to send mail as I was unable to get mail from cron or "at" to use a shell script as a mail program... They expected a true binary execuitable.  I now just install mailx and ssmtp.  (I do not need a full sendmail running, and do not want the bloat, or security issues it brings)

 

Joe L.

Link to comment

Now, the "sendmail" version can handle multiple lines, and piping to programs, but if you just add a little logic, your mail command can also forward based on .forward lines.

 

I was afraid someone would say that.

 

Attached is v2.53

 

I added simple support for ".forward" to mail.   Simple in that it will only look for "/root/.forward", and only when root is passed as a rcpt.

 

Edit:

Attachment removed.  See top post for most recent version.

Link to comment

This is what I got for output(mail) when added a new disk... after disk6 there is not a "new line" so disk7 is on the same line ....

 

Is it possible to fix  ;)

 

Disk Temperature Status
-----------------------------------------------------------------
Parity Disk [sdg]: 21°C (DiskId: ata-WDC_WD15EADS-00S2B0_WD-WCAVY0802799)
Disk 1 [sdd]: 21°C (DiskId: ata-WDC_WD10EADS-00L5B1_WD-WCAU4D312833)
Disk 2 [sde]: 20°C (DiskId: ata-WDC_WD10EAVS-00D7B0_WD-WCAU40258662)
Disk 3 [sdf]: 13°C (DiskId: ata-SAMSUNG_HD103UJ_S13PJ1KQ612827)
Disk 4 [sdh]: 28°C (DiskId: ata-WDC_WD15EADS-00R6B0_WD-WCAVY0164770)
Disk 5 [sdc]: 19°C (DiskId: ata-WDC_WD10EACS-00ZJB0_WD-WCASJ1110243)
Disk 6 [hdb]: 23°C (DiskId: ata-Maxtor_6Y160P0_Y41LJMXE) Disk 7 [sdb]: 34°C (DiskId: ata-ST3500630AS_9QG0V4HA)

EDIT

 

Added a new disk, and the result is this. it's looks like there is a bug with more than 6 disk ....

 

Disk SMART Health Status
-----------------------------------------------------------------
Parity Disk PASSED (DiskId: ata-WDC_WD15EADS-00S2B0_WD-WCAVY0802799)
Disk 1 PASSED (DiskId: ata-WDC_WD10EADS-00L5B1_WD-WCAU4D312833)
Disk 2 PASSED (DiskId: ata-WDC_WD10EAVS-00D7B0_WD-WCAU40258662)
Disk 3 PASSED (DiskId: ata-SAMSUNG_HD103UJ_S13PJ1KQ612827)
Disk 4 PASSED (DiskId: ata-WDC_WD15EADS-00R6B0_WD-WCAVY0164770)
Disk 5 PASSED (DiskId: ata-WDC_WD10EACS-00ZJB0_WD-WCASJ1110243)
Disk 6 PASSED (DiskId: ata-Maxtor_6Y160P0_Y41LJMXE) Disk 7 PASSED (DiskId: ata-ST3500630AS_9QG0V4HA) Disk 8 PASSED (DiskId: ata-WDC_WD15EADS-00P8B0_WD-WMAVU0799207)

 

Link to comment

Hello!

I took the opportunity this holiday to make some IT adjustments and upgrades at home and unraid_notify is one of them.

brainbone, thanks a lot by the way for what looks like a great script :)

 

I say "looks like" as I have some troubles to get it working with gmail.

I get the following error message when checking with "unraid_notify -d"

2009/12/28 11:05:24 socat[6857] E getaddrinfo("smtp.gmail.com", "(null)", {1,0,1,6}, {}): Name or service not known

I followed the procedure for gmail, adding the socat package and the associated line in the go script, everything looks fine at boot, packages installed successfully, just a warning about the package not being created with a specific program but I think this could be ignored.

 

Anyway, in my unraid_notify.cfg I have indicated the following parameters :

[Email]

# Name of SMTP server to use for sending notifications
SmtpServer = smtp.gmail.com

# SMTP server port
# Common ports used for SMTP: 25, 2525, 587 (or port 465 for SSL)
SmtpServerPort = 465

# User name to use in SMTP authentication (prob. your email address) 
# (leave blank for no authentication)
Username = [email protected]

# Password to use in SMTP authentication (prob. your POP3 password)
# (leave blank for no authentication)
Password = mypassword

# Use SSL / SMTPS / Secure SMTP when comunicating with smtp server?
# (smtp.gmail.com, for example, requires SSL)
# Set to "True" to enable ssl.  
# You will also need to change SmtpServerPort to 465
#
# NOTE:  This requires the installation of of the following package:
# http://repository.slacky.eu/slackware-12.1/utilities/socat/1.6.0.1/socat-1.6.0.1-i486-2bj.tgz
#
# UseSSL = True
UseSSL = True

# Subject of notification email
Subject = unRAID Status

# Append abbreviated status to subject
AppendStatus = True

# Recipient(s) of status notification emails and error notification emails
# (An hourly status will be sent to these addresses, regardless of the status)
# Separate multiple recipients with a space
RcptTo = [email protected]

# Recipient(s) of only error notification emails
# (no email will be sent to these addresses, unless there is a problem with unRAID)
ErrorRcptTo = [email protected]

# Mail from address
# (Who the message you recive will be "from")
MailFrom = [email protected]

# Set email header with high importance if there is a problem with unRaid?
# (standard status notification, if sent, will not be marked high importance)
SetEmailPriority = True

# Choose whether to include the contents of /proc/mdcmd in your status
# notifications (Setting this value to anything but "True" is the same
# as setting it to "False")
IncludeMdcmd = True

[Options]

# Choose the maximum temp. (in celsius) a disk may get before an error will message will be sent.
MaxDiskTemp = 55

# Choose the critical disk temp. (in celsius) that will cause unraid_notify to execute an external 
# command (like powerdown - see: http://lime-technology.com/wiki/index.php?title=Powerdown_script )
#CriticalDiskTemp = 65
#CriticalDiskCommand = powerdown

# Should display of temp be converted to Fahrenheit? ( conversion is: F=((C*9)/5)+32 )
DisplayFahrenheit = False

# How often, in minutes, to send a notification
# (Note: changes in error status will result in an immediate notification, with a maximum delay of 
# "RescanDelay" (see below))
NotifyDelay = 60

# How long, in seconds, should unraid_notify wait between status checks?
# (Note: if you set this below 10 seconds, the value will be defaulted to 10 seconds)
RescanDelay = 60

# How long, in seconds, to wait for the unRAID server to have been up before running status checks
# and sending notifications. (gives time for system to fully loaded before checking status)
StartScanDelay = 60

# If set to "True", notifications will not be sent if all disks are spun down.
NoReportIfAllSpunDown = False 

 

 

Obviously the mail in "MailFrom = [email protected]" is not valid, would that be an issue?

 

The username, does it need to be mymail@gmail.com or just mymail?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.