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


Recommended Posts

  • Replies 235
  • Created
  • Last Reply

Top Posters In This Topic

I added support for apcupsd back around here:

http://lime-technology.com/forum/index.php?topic=2470.msg45069#msg45069

 

The APC program uses the "mail" command to send alerts to "root".  unraid doesn't have a "mail" command built in, but unraid_notify does.  By default, the "mail" command in unraid_notify now changes mail destined for "root" to the notification mailbox defined in your unraid_notify.cfg.

 

Link to comment

I suppose a script that checks if all drives have less than X available for free space would be simple enough, but where it gets complicated is user shares that don't use all drives, or for that matter, those that don't use user shares at all.  It may be OK to have some drives filled up, but not others.

 

Add to that unraid 5, and the probability that this will all need to be re-written for it, if the functionality isn't included out-of-the-box...

 

Thoughts?

 

Link to comment

Actually and initially I only meant to monitor physical disks, not the array itself or user shares.

(would be useful for example if due to not properly configured user shares you unexpectedly run out of space. Like in my case when I included multiple disks but forgot to set the split level).

 

But you are right, this might be also useful for monitoring user shares.

In fact, monitoring the total available space on all drives together not make so much sense in my opinion.

Link to comment
  • 1 month later...

I think i'm going to install unraid_notify and give that a try, all i want to do is be able to send a file via shell script and it looks like unraid_notify will do that.  I've been running unraid for 2 weeks and so far it has performed flawlessly.  I'm really impressed with the product, its extensibility, and support here in the forum.  I'm upgrading to plus this weekend!  Thanks so much for a great product!

Link to comment

So, where do I get the latest build of this and install instrucitons?  I want to try it out on my UnRaid Pro 16 drive array.

 

Look at the first post in this thread.

 

all i want to do is be able to send a file via shell script and it looks like unraid_notify will do that. 

 

If you mean send a plain text file, yes.  If you mean send an attachment -- no.

 

Link to comment

My compliments to Brainbone et. al.

 

Took me 10 minutes to get it installed and working.  A little trial and error with "unraid-notify -d" and I figured out just which cfg options I needed.

 

The only issue (and it is a small one) is a missing crlf when printing out the temp and the health

 

Disk Temperature Status

-----------------------------------------------------------------

Parity Disk [sdb]: Spun-Down (DiskId: Hitachi_HDS72202_JK1174YAHLP75W) Disk 1 [sdc]: Spun-Down (DiskId: Hitachi_HDS72202_JK1174YAHLP94W)

 

Disk SMART Health Status

-----------------------------------------------------------------

Parity Disk Spun-Down (DiskId: Hitachi_HDS72202_JK1174YAHLP75W) Disk 1 Spun-Down (DiskId: Hitachi_HDS72202_JK1174YAHLP94W)

 

IMHO it would look a better and easier to read if each disks information were on a separate line.

 

 

Thanks again for an excellent and easy to install piece of work.

Link to comment

Ditto - was really easy to setup thanks to the great instructions in this thread.

 

I also was wondering about the formatting in the status messages, but it turns out Outlook was removing the extra line breaks from the messages. I found an option in Outlook under Tools, Options, Preferences, Email Options, 'Remove extra line breaks in plain text messages' which fixed the formatting.

 

Cheers,

James

Link to comment

James,  Thank you for that pointer.  I have removed the check mark.  I thought it was something other than the package as the package is too well written to allow such an obvious to slip by.

 

Strange, I thought that outlook option was to eliminate multiple blank lines and a single crlf would not be removed, and multiple crlf's would be reduced to one.  Oh well. . .

Link to comment

brainbone,

 

I really appreciate your unraid-notify package and would like to request an additional feature.  I would like to be able to send a tcpip string to a host:port where something is listening at that port. I know from reading this forum that bash can do that. My listener is part of my home automation system and can send vocal anouncements to the house's audio anouncement system.  I would like to be able to at least send such an anouncement when there is an unraid problem similar to how unraid-notify sends email. My system does that today for callers (callerid) or severe weather warnings.

 

As a configuration set I would like to see host name or IP, Port, Format (TCP, UDP or http), and message.

 

If TCP or UDP is the format then the message is just sent as a string after the connection is opened and then the connection is closed. If the format is http then it gets a little more involved, but I am only interested in TCP.

 

I would be willing to try to do that myself but I do not know where to put the hooks to get the unraid status, or how to use cron to periodically check the status, but I do prefer such things to be event driven.

 

 

Your comments and suggestions would be appreciated.

Link to comment

I've recently installed unMenu and this package through it.  Everything seems to work fine, I get an email at the right time saying everything is ok.  But I also have unexpected entries in my syslog.  If I uninstall unraid_notify, the messages do not occur.  Here is a sample, the entire log is attached.

 

Apr 28 12:47:01 Tower kernel: usb 1-2: reset full speed USB device using uhci_hcd and address 2
Apr 28 13:47:01 Tower last message repeated 2 times
Apr 28 14:47:01 Tower last message repeated 2 times
Apr 28 15:47:02 Tower last message repeated 2 times
Apr 28 16:47:01 Tower last message repeated 2 times
Apr 28 17:47:01 Tower last message repeated 2 times
Apr 28 18:47:01 Tower last message repeated 2 times
Apr 28 19:47:01 Tower last message repeated 2 times
Apr 28 20:47:02 Tower last message repeated 2 times
Apr 28 20:47:02 Tower kernel: usb 1-2: reset full speed USB device using uhci_hcd and address 2
Apr 28 20:47:02 Tower sSMTP[18136]: Creating SSL connection to host
Apr 28 20:47:03 Tower sSMTP[18136]: SSL connection using AES256-SHA
Apr 28 20:47:03 Tower sSMTP[18136]: Sent mail for root@localhost (221 sunny.cirtexhosting.com closing connection)
Apr 28 21:47:02 Tower kernel: usb 1-2: reset full speed USB device using uhci_hcd and address 2
Apr 28 22:47:01 Tower last message repeated 2 times
Apr 28 23:47:01 Tower last message repeated 2 times
Apr 29 00:47:01 Tower last message repeated 2 times
Apr 29 01:47:01 Tower last message repeated 2 times
Apr 29 02:47:02 Tower last message repeated 2 times
Apr 29 03:47:01 Tower last message repeated 2 times
Apr 29 04:47:01 Tower last message repeated 2 times
Apr 29 05:47:01 Tower last message repeated 2 times
Apr 29 06:47:01 Tower last message repeated 2 times
Apr 29 06:47:02 Tower kernel: usb 1-2: reset full speed USB device using uhci_hcd and address 2

 

 

 

Thanks!

 

Link to comment

Ok. I installed "unRAID Status Alert" from package manager.  I guess unraid_notify is based on that, but is newer.  I'll try unraid_notify and see if I get the same syslog entries.

unRAID status alert simply sends mail to root.  It you had initially installed unraid_notify, it would have installed a mail command for the status alert to use.

 

I'm guessing the hdparm -C command issued to your flash drive is resulting in the message to your syslog.

Do you have more than one flash drive installed?  (Or rather, more than one drive connected via USB?)

 

I'm sure I can modify the command to not attempt to get the "spinning status" of the flash drive, but I'd like to know a bit more about the devices on your server.

 

Can you type this command (exactly as shown, with the square brackets and the trailing question mark) and post the result?

ls -l /dev/[hs]d?

 

Then, do the same with

ls -l /dev/disk/by-id

and

ls -l /dev/disk/by-label

 

Your help is appreciated and will make it better for everybody.

 

Joe L.

Link to comment

Well then, I'm really confused.  Here is what I've done:

 

1. Upgraded to unRaid 4.5.3

2. Installed unMenu 1.3

3. Installed mail and ssmtp from unMenu - unRaid Status Alert says it needs a 'mail' command, I figured this is it

4. Installed unRaid Status Alert from unMenu

 

It works, but I get those entries in the syslog posted earlier.

 

Now, I have uninstalled unRaid Status Alert and installed unraid_notify.  It works and I don't get the entries in my syslog.

 

One question I have is, do I need unMenu to auto-install the 'mail and ssmtp' package or is that included when unraid_notify is installed?

 

 

To answer your questions, I only have 1 flash drive.  The only other thing connected via USB is an APC UPS.

Here is the output you wanted:

root@Tower:~# ls -l /dev/[hs]d?
brw-rw---- 1 root disk     3,  0 Apr 29 07:49 /dev/hda
brw-rw---- 1 root disk    33,  0 Apr 29 07:49 /dev/hde
brw-rw---- 1 root disk    33, 64 Apr 29 07:49 /dev/hdf
brw-rw---- 1 root disk     8,  0 Apr 29 07:49 /dev/sda
brw-rw---- 1 root disk     8, 16 Apr 29 07:49 /dev/sdb
brw-rw---- 1 root disk     8, 32 Apr 29 07:49 /dev/sdc
brw-rw---- 1 root plugdev  8, 48 Apr 29 07:49 /dev/sdd


root@Tower:~# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0A282A -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0A282A-part1 -> ../../sda1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0PYS6B -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0PYS6B-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Maxtor_6Y250P0_Y635VEXE -> ../../hde
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Maxtor_6Y250P0_Y635VEXE-part1 -> ../../hde1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Maxtor_6Y250P0_Y6362MRE -> ../../hda
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Maxtor_6Y250P0_Y6362MRE-part1 -> ../../hda1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-ST31000528AS_5VP3RE9M -> ../../sdc
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-ST31000528AS_5VP3RE9M-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-ST3300622A_4NF28H39 -> ../../hdf
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-ST3300622A_4NF28H39-part1 -> ../../hdf1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0A282A -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0A282A-part1 -> ../../sda1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0PYS6B -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0PYS6B-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 scsi-SATA_ST31000528AS_5VP3RE9M -> ../../sdc
lrwxrwxrwx 1 root root 10 Apr 29 07:49 scsi-SATA_ST31000528AS_5VP3RE9M-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 usb-LEXAR_JD_FIREFLY_106A6612171756081106-0:0 -> ../../sdd
lrwxrwxrwx 1 root root 10 Apr 29 07:49 usb-LEXAR_JD_FIREFLY_106A6612171756081106-0:0-part1 -> ../../sdd1


root@Tower:~# ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 10 Apr 29 07:49 UNRAID -> ../../sdd1

 

So, which of these scripts should I be using?  Right now, unraid_notify wins since it doesn't add to my syslog.  But, if it is older and not being updated, I'll use unRaid Status Alert if it gets fixed.

 

Thanks for your help.

 

Link to comment

Well then, I'm really confused.  Here is what I've done:

 

1. Upgraded to unRaid 4.5.3

2. Installed unMenu 1.3

3. Installed mail and ssmtp from unMenu - unRaid Status Alert says it needs a 'mail' command, I figured this is it

4. Installed unRaid Status Alert from unMenu

 

It works, but I get those entries in the syslog posted earlier.

 

Now, I have uninstalled unRaid Status Alert and installed unraid_notify.  It works and I don't get the entries in my syslog.

 

One question I have is, do I need unMenu to auto-install the 'mail and ssmtp' package or is that included when unraid_notify is installed?

unraid_notify installs its own version of "mail" written as a shell script in combination with "socat" if you need encrypted connections to your mail provider.

 

unMENU installs ssmtp. It is more complete and able to do more than unraid_notify.  However, for our needs, they both do exactly the same thing.  

 

unMENU installs the "mailx" program to use to compose a mail message.  It, in turn is able to by use by programs expecting a full mail command to exist, one that is not a shell script.  Specifically, the "at" command and the "cron" command send their status e-mail via "mail" and they do not work with the shell script versions.  They expect the "mail" command to be a binary executable.

 

It is for that reason I use the mailx package unMENU installs.  I wish to get all the mail various programs send me, not just the one from the hourly notifications.  I use ssmtp because in the past unraid_notify was unable to establish connections to some mail hosts.  The author has continued to make changes to it so it can, and has enlisted feedback from people like yourself, just as I did.  It is not being updated only because it is basically working.  As far as I know, the author is still an active member of this forum.

To answer your questions, I only have 1 flash drive.  The only other thing connected via USB is an APC UPS.

Here is the output you wanted:

root@Tower:~# ls -l /dev/[hs]d?
brw-rw---- 1 root disk     3,  0 Apr 29 07:49 /dev/hda
brw-rw---- 1 root disk    33,  0 Apr 29 07:49 /dev/hde
brw-rw---- 1 root disk    33, 64 Apr 29 07:49 /dev/hdf
brw-rw---- 1 root disk     8,  0 Apr 29 07:49 /dev/sda
brw-rw---- 1 root disk     8, 16 Apr 29 07:49 /dev/sdb
brw-rw---- 1 root disk     8, 32 Apr 29 07:49 /dev/sdc
brw-rw---- 1 root plugdev  8, 48 Apr 29 07:49 /dev/sdd


root@Tower:~# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0A282A -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0A282A-part1 -> ../../sda1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0PYS6B -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Hitachi_HDT721010SLA360_STF604MH0PYS6B-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Maxtor_6Y250P0_Y635VEXE -> ../../hde
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Maxtor_6Y250P0_Y635VEXE-part1 -> ../../hde1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-Maxtor_6Y250P0_Y6362MRE -> ../../hda
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-Maxtor_6Y250P0_Y6362MRE-part1 -> ../../hda1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-ST31000528AS_5VP3RE9M -> ../../sdc
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-ST31000528AS_5VP3RE9M-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 ata-ST3300622A_4NF28H39 -> ../../hdf
lrwxrwxrwx 1 root root 10 Apr 29 07:49 ata-ST3300622A_4NF28H39-part1 -> ../../hdf1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0A282A -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0A282A-part1 -> ../../sda1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0PYS6B -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 29 07:49 scsi-SATA_Hitachi_HDT7210_STF604MH0PYS6B-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 scsi-SATA_ST31000528AS_5VP3RE9M -> ../../sdc
lrwxrwxrwx 1 root root 10 Apr 29 07:49 scsi-SATA_ST31000528AS_5VP3RE9M-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Apr 29 07:49 usb-LEXAR_JD_FIREFLY_106A6612171756081106-0:0 -> ../../sdd
lrwxrwxrwx 1 root root 10 Apr 29 07:49 usb-LEXAR_JD_FIREFLY_106A6612171756081106-0:0-part1 -> ../../sdd1


root@Tower:~# ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 10 Apr 29 07:49 UNRAID -> ../../sdd1

 

So, which of these scripts should I be using?  Right now, unraid_notify wins since it doesn't add to my syslog.  But, if it is older and not being updated, I'll use unRaid Status Alert if it gets fixed.

 

Thanks for your help.

 

I can almost guarantee that the hdparm command is the culprit.  

 

Since /dev/sdd is your flash drive, I'll bet that issuing the following command will result in the error message in the syslog you are seeing:

hdparm -C /dev/sdd

 

The command is used to determine the spinning/sleeping state of a hard disk.   Obviously, it has no meaning to a USB drive.

 

While you perform that test, I can fix the script installed by unMENU to ignore the USB flash drive and not try to get its temperature.

 

Joe L.

Link to comment

Since /dev/sdd is your flash drive, I'll bet that issuing the following command will result in the error message in the syslog you are seeing:

hdparm -C /dec/sdd

 

I think you meant /dev, not /dec (Hey! I'm learning linux!)

 

After doing that, syslog has:

 

Apr 29 16:59:05 Tower kernel: usb 1-2: reset full speed USB device using uhci_hcd and address 2

 

Hope that helps!

Link to comment

Since /dev/sdd is your flash drive, I'll bet that issuing the following command will result in the error message in the syslog you are seeing:

hdparm -C /dec/sdd

 

I think you meant /dev, not /dec (Hey! I'm learning linux!)

 

After doing that, syslog has:

 

Apr 29 16:59:05 Tower kernel: usb 1-2: reset full speed USB device using uhci_hcd and address 2

 

Hope that helps!

Yup... That's it.  (I made a typo)

 

Thanks

 

Link to comment

I can fix the script installed by unMENU to ignore the USB flash drive and not try to get its temperature.

 

Joe L.

I modified the unMENU email notification script to not attempt to get the temperature of the flash drive and other usb drives.

 

You can use the Check-for-updates button on the user-scripts page to update your version.

 

You'll probably need to first run the following command to remove the existing script before it will let you install the new.

rm /etc/cron.hourly/smtp_status.sh

 

Note: this does not affect unraid_notify.sh  It is unchanged.

 

Joe L.

Link to comment
  • 7 months later...

Hello I was curious if you were planning any new additions to the unraid_notify script for monitoring other smart values.

 

I had a loose cable or something last weekend on unRaid 4.6 final ...

 

When I realized something was wrong I tried shutting down the array but was kind of panicing and forgot to grab a syslog first (too used to powerdown doing it for me)

 

I grabbed the top screen and the unRaid main page while trying to shut down and also attached a recent shot of mymain's smart data page

 

the output of load averages in top went as high as 75,75 and 50 and the computer had to be eventually turned off at the switch

 

my load cycle count went through the roof on a few/several drives under two years old

 

Now I'm curious if I should be replacing all of the affected drives or just get two or three drives and move the important data to those using the others as free space until I can replace those too

 

Thanks for your time,

Bobby

Clipboard02a.jpg.f2f47bf33d669bc381b07a0c51e44090.jpg

Clipboard01a.jpg.b82aa7127d3556a9e2a995910e049e94.jpg

Clipboard03a.jpg.fd5f43df7640b3be76a890792c290ad5.jpg

Link to comment
  • 2 weeks later...

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.