Linux - EnterpriseThis forum is for all items relating to using Linux in the Enterprise.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I need to find out how to have an email sent to another product (HP Openview) from our Linux system when it encounters a certain problem(s) dealing with a certain application.
If the email can be set up within a shell script I'd be happy, otherwise I'm looking to have the code reworked to include an "email beeblequix" as part of the error trapping/correcting logic.
How do you folks have your systems contact you when it has a problem? What could you tell me that would help me *get woke up at 02:36 am* if a problem happens? Thx.
You can just use the "mail" command within your script.
echo "The <whatever> just broke. You need to get up and fix it now." | mail -s "Alert from `hostname`" beeblequix@domain.com
The stuff in quotes after the echo is the email body. The stuff in quotes after the -s is the email subject. You of course put your own info in - the above is just an example. Of course you would substitute your real domain for domain.com.
The "mail" command is followed by he "-s <subject>" then by the list of users it should be sent to. You add additional users by separating with a space.
FYI: Most cell phone companies have a way to send text message to cell phone via email. Usually it is your phone number including area code @ some domain name. For example Cingular (was AT&T) would be something like 5554446666@mmode.com. You can use that same email address in your email.
Also - If your server has /etc/resolv.conf pointed to your DNS nameservers it should find the MX record for email automatically. However you may need to edit /etc/mail/sendmail.cf to specify the "Smart Relay" host as your mail server if it has security settings preventing unspecified relays.
In one fell swoop your post made me realize that even though we paid a truckload for HP Ovenview (and even added new jobs in the GWBush recession of 2001)(lol)(i'm an elephant) that in this situation it's not really that necessary. Hmmm. We'll still use though because it's integral to the vision of the company. Actually I guess the reason we want Openview involved is because then everyone around here can keep their eyes on the problem until it's resolved and makes a good place to centralize problems/fixes/response time/etc.
Coolness. I can have the script then email both office and cellphones:
me, the Bossman, my backup, the Openview system, the support staff elsewhere in the company, the support staff with the company we bought the software from or whoever I wish (cue "muhahahahahaha...").
The resolv.conf file has what you mentioned:
domain xxxxxxxxxxx.com
nameserver 2xx.xx.xxx.xxx
(the parts in 'x' are overtyped; the rest is exact). So it looks like it's pointed where it needs to be. Don't know anything about the security relays.
Hmph.....it doesn't have a folder "/etc/mail/" and thus no "sendmail.cf" file. Any other place that may be located or am I going to have to have the admin make major changes? (downtime is baaaad).
If the file is anywhere on your system that should find it. It may be in a different directory. Its possible you don't have sendmail installed but its usually there by default.
Openview or any other montoring utility has built in monitors that are typically more efficient users of system resources than your own scripts so its not really a waste of money. However to really use it you should have an Openview client for your Linux box that communicates with you Openview master. We use Nagios (free) here but I've used a lot of the HP components - Measurware and Glance are great utilities for system performance monitoring. Also have used Patrol at other sites. They all require you to do some configuration but also have a lot of builtins.
I'm able to send myself an email from that linux guest to my office email, but not my cell phone.
Tell me if my thinking is right here: I'm not getting my text messages to my cell phone because the mycellnumber@mmode.com is not part of the allowed policy....? Do I have to include the @mmode.com domain in that sendmail.cf file in order for me to get these text messages?
@mmode.com is for my Cinglular service that used to be AT&T. It is not for ALL cellphones.
You would have to ask your carrier what email address your phone has. Also it is possible you don't have text messaging service on your phone depending on your plan with your carrier. If you DO have text messaging you ought to be able to send FROM your phone to your real email address and then it will show you what address the mail came from.
I've got my script emailing a number of employees when certain critical problems arise. As far as paging my cell phone -- I'm handling that via Groupwise. I'll just have the original email show up in my Groupwise mailbox and then set up rules to search for specific emails from a specific user with a specific hard-coded subject....when it finds those parameters Groupwise will email my cellphone and I'll get the page. I'm double covered in another way -- one of the emails will go to an operator who has procedures to contact me with problems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.