WeeboTech Posted November 20, 2009 Share Posted November 20, 2009 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? Quote Link to comment
brainbone Posted November 21, 2009 Author Share Posted November 21, 2009 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! Quote Link to comment
Guzzi Posted December 16, 2009 Share Posted December 16, 2009 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# Quote Link to comment
brainbone Posted December 16, 2009 Author Share Posted December 16, 2009 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. Quote Link to comment
Guzzi Posted December 16, 2009 Share Posted December 16, 2009 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:~# Quote Link to comment
brainbone Posted December 16, 2009 Author Share Posted December 16, 2009 Getting closer... Please try the attached v2.52 Edit: Attachment removed. see top post for current version. Quote Link to comment
Guzzi Posted December 16, 2009 Share Posted December 16, 2009 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 Quote Link to comment
brainbone Posted December 16, 2009 Author Share Posted December 16, 2009 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. Quote Link to comment
JarDo Posted December 17, 2009 Share Posted December 17, 2009 Currently, I am installing mail-0.20-noarch-unRAID.tgz along with unraid_notify on every boot. Is this no longer needed. It appears that mail v0.20 is also packaged in unraid_notify-2.52-noarch-unRAID.tgz Quote Link to comment
Guzzi Posted December 17, 2009 Share Posted December 17, 2009 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. Quote Link to comment
brainbone Posted December 17, 2009 Author Share Posted December 17, 2009 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. Quote Link to comment
brainbone Posted December 17, 2009 Author Share Posted December 17, 2009 Currently, I am installing mail-0.20-noarch-unRAID.tgz along with unraid_notify on every boot. Is this no longer needed. It appears that mail v0.20 is also packaged in unraid_notify-2.52-noarch-unRAID.tgz Yes. "mail" is packaged with unraid_notify since v2.50. Quote Link to comment
brainbone Posted December 17, 2009 Author Share Posted December 17, 2009 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. Quote Link to comment
Guzzi Posted December 17, 2009 Share Posted December 17, 2009 Yes. The setting is ignored. Hi Brainbone, maybe it's worth sometimes to remove it from the delivered default config file, because it might confuse new users (like me ;-)). Thanks again for your help, Guzzi Quote Link to comment
peter_sm Posted December 17, 2009 Share Posted December 17, 2009 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 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 Quote Link to comment
brainbone Posted December 17, 2009 Author Share Posted December 17, 2009 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? Quote Link to comment
Joe L. Posted December 17, 2009 Share Posted December 17, 2009 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. Quote Link to comment
brainbone Posted December 17, 2009 Author Share Posted December 17, 2009 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. Quote Link to comment
peter_sm Posted December 17, 2009 Share Posted December 17, 2009 Thanks, going to try this Quote Link to comment
peter_sm Posted December 17, 2009 Share Posted December 17, 2009 Thanks, going to try this And ... it's WORKS Quote Link to comment
brainbone Posted December 17, 2009 Author Share Posted December 17, 2009 Thanks, going to try this And ... it's WORKS Glad to hear! Quote Link to comment
peter_sm Posted December 17, 2009 Share Posted December 17, 2009 Also tested to execute the 2 script at the /etc/apcupsd : offbattery & onbattery And I got mail also from those Quote Link to comment
peter_sm Posted December 22, 2009 Share Posted December 22, 2009 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) Quote Link to comment
brainbone Posted December 24, 2009 Author Share Posted December 24, 2009 I'll look into further this after the holidays. Does the same thing happen if you send to/through a gmail account, or a non-MS server? I don't see this behavior on my end, so I'm having trouble isolating it. Quote Link to comment
Darts Posted December 28, 2009 Share Posted December 28, 2009 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? Quote Link to comment
Recommended Posts
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.