I have about 120 CentOS 4 servers scattered all over the country. They are setup in master/slave pairs running mySQL with replication. I want the master to send me an email message when an error occurs.
Something like this…
sendmail –s “Company X STATUS” “bi...@uponthebox.com” < /tmp/status.txt
Most of my servers have static IPs…not that this should matter.
The last attempt I made at getting this to work was trying to setup sendmail to use a remote smtp server (i.e. smptout.secureserver.net). This is what /var/log/maillog reports after I send a message.
Mar 8 11:57:43 localhost sendmail[4640]: o28GSWVf003070: to=<bi...@uponthebox.com>, ctladdr=<ro...@localhost.localdomain> (0/0), delay=01:29:10, xdelay=00:00:00, mailer=relay, pri=485003, relay=smtpout.secureserver.net, dsn=4.0.0, stat=Deferred: Name server: smtpout.secureserver.net: host name lookup failure
Yes, I can ping the smtp server all day long and DNS resolves it.
Isn’t there an easy way to send an email from a stupid command line script that doesn’t involve all this sendmail configuration stuff?
Bill Turner
It's been a while since I've messed with this, but I'm pretty sure you
don't need to find an outside smtp server. Sendmail handles this for
you. As long as your sending server can get out on port 25 it will
look up the correct server to pass the message off to without needing
a middleman.
I've set this up with formmail scripts in php and cgi and unless your
server is on a restricted network or has a strange setup, you should
be ok.
If you're hosing with godaddy, they may have to make changes to allow
you to send mail. If you have shell access there, try to connect to
someone's smtp server:
donalddelp@donalddelp-cti:~$ telnet gmail-smtp-in.l.google.com. 25
Trying 209.85.211.76...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP 8si13013546ywh.11
If this works, you don't need to specify an smtp server for sendmail.
(Someone please correct me if I'm wrong)
http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html
As a side thought have you though of using curl or wgetpaste ( I'm
talking the principle here) to extract the mail by cron?
VP
> --
> You received this message because you are subscribed to the Google Groups
> "NLUG" group.
> To post to this group, send email to nlug...@googlegroups.com
> To unsubscribe from this group, send email to
> nlug-talk+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nlug-talk?hl=en
>
--
--
If there is a question to the validity of this email please phone for
validation. Proudly presented by Mutt, GNUPG, Vi/m and GNU/Linux via
CopyLeft. GNU/Linux is about Freedom to compute as you want and need
to, and share your work unencumbered and have others do the same with
you. Key : 0xD53A8E1
mail -s “Company X STATUS” bi...@uponthebox.com < /tmp/status.txt
It is also setup to receive mail from one user to another on the
machine itself, i.e. it operates only on the loopback unless you make
modifications to /etc/mail/sendmail.mc . Revert any changes you made
to that .mc file, run make, restart sendmail, and try the command
above.
Interesting discussion, Bill.
Don't know if we understand the underlying triggers that send these
notices to you. Is a monitoring system such as Nagios overkill for what
you are doing?? Nagios would offer a central server to monitor those
remotes and collect data for central management.
If not Sendmail then maybe Postfix to send your mail out. The latter is
far simpler to configure and is the default email engine on packages
such as Elastix and FreePBX.
Howard White
Bill Turner wrote:
I have about 120 CentOS 4 servers scattered all over the country. They are setup in master/slave pairs running mySQL with replication. I want the master to send me an email message when an error occurs.
Something like this…sendmail –s “Company X STATUS” “bi...@uponthebox.com <mailto:bi...@uponthebox.com>” < /tmp/status.txt
Most of my servers have static IPs…not that this should matter.
The last attempt I made at getting this to work was trying to setup sendmail to use a remote smtp server (i.e. smptout.secureserver.net <http://smptout.secureserver.net>). This is what /var/log/maillog reports after I send a message.
Mar 8 11:57:43 localhost sendmail[4640]: o28GSWVf003070: to=<bi...@uponthebox.com <mailto:bi...@uponthebox.com>>, ctladdr=<ro...@localhost.localdomain <mailto:ro...@localhost.localdomain>> (0/0), delay=01:29:10, xdelay=00:00:00, mailer=relay, pri=485003, relay=smtpout.secureserver.net <http://smtpout.secureserver.net>, dsn=4.0.0, stat=Deferred: Name server: smtpout.secureserver.net <http://smtpout.secureserver.net>: host name lookup failure
Yes, I can ping the smtp server all day long and DNS resolves it.
Isn’t there an easy way to send an email from a stupid command line script that doesn’t involve all this sendmail configuration stuff?
Bill Turner
Interesting discussion, Bill.
Don't know if we understand the underlying triggers that send these notices to you. Is a monitoring system such as Nagios overkill for what you are doing?? Nagios would offer a central server to monitor those remotes and collect data for central management.
If not Sendmail then maybe Postfix to send your mail out. The latter is far simpler to configure and is the default email engine on packages such as Elastix and FreePBX.
Howard White