Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Software
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Software Questions about use, installation, or configuration of software running on SUSE Linux

 
Page 2 of 2 1 2
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 18-Mar-2008, 07:40
badger_fruit
Guest
 
Posts: n/a
Default

Hello again
Sorry to revive this thread but I am having some real trouble getting an email sent automatically from Nagios - still!!

After my attempts above, I changed the command definition to pump "whoami" into a simple plain text file using

Code:
define command{
****command_name****notify-rp-by-email
****command_line****whoami >> /test.log
****}
whenever the command was called, sure enough, it dropped the result of whoami into /test.log no problem (the username was "nagios")

sending an email from the actual command line using

Code:
whoami | mailx -A mpl -s "Test subject" user.name@thedomain.com
works, an email is sent and user.name@thedomain.com gets an email. The "sender" address is correct as specified in the /home/nagios/.mailrc file. I changed the command_line in my nagios config file to this (exactly as tested in the shell) and saved it, restarted nagios and waited.

Code:
define command{
****command_name****notify-rp-by-email
****command_line****whoami | mailx -A mpl -s "Test email subject" user.name@mydomain.com
****}
Nothing received.
I then checked the /var/spool/mail/nagios file and saw it was stuffed with errors

Quote:
--B84C32C876.1205835312/uk-lds-nag-01.minorplanet.local
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host uk-lds-nag-01.thedomain.local.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

<user.name@thedomain.com>: host
exchange.thedomain.com[212.103.237.196] said: 450 4.1.8
<nagios@uk-lds-nag-01.thedomain.local>: Sender address rejected: Domain
not found (in reply to RCPT TO command)
[/b]
here is /home/nagios/.mailrc for those interested
Code:
account mpl {
set record=/home/nagios/+Sent
set from="nagios.admin@mydomain.com"
set smtp=192.168.100.2
}
I had the IT department set up the email address so should any user decide to reply to their automatic nagios email, it could be picked up by nagios admin (ie Me) at some point. I configured kmail to send/receive these emails and I have tested it and it works. I can only assume that the -A mpl is not being recognised when used from within nagios and therefore, it's trying to send email from nagios@uk-lds-nag-01.thedomain.local

nagios - the logged on username (eg returned from whoami)
@uk-lds-nag-01 - the computer's name
mydomain.local - the current domain (as entered in Yast2 > Hostname and Name Server configuration), although the computer is not actually a domain member

Any ideas please?
  #12 (permalink)  
Old 19-Mar-2008, 11:22
badger_fruit
Guest
 
Posts: n/a
Default

hmm, resolved .. adding a
Code:
-r "valid.sender@mydomain.com"
I now get emails from my Nagios machine
which is a shame, as it means i have no excuse to not do anything about the alerts
  #13 (permalink)  
Old 20-Mar-2008, 05:24
badger_fruit
Guest
 
Posts: n/a
Default

Hello, yes, me again.
Mailx mailx mailx.

So I am trying to get the following example output
Quote:
WIN - Drive Space C:
CRITICAL

c - total: 149.05 Gb - used: 96.94 Gb (65%) - free 52.11 Gb (35%)
[/b]
As you can see, the output I would like includes % signs and new-lines.
I have tried to use two different commands to dump the information into an email via mailx

printf
echo

printf - does not like % signs so half my output is missed
echo - does not like newline "\n" commands so in actually get "\n" in the output!!

Is there a command that will allow BOTH % and newlines?
  #14 (permalink)  
Old 20-Mar-2008, 06:10
badger_fruit
Guest
 
Posts: n/a
Default

Code:
echo -e "95% badger\5%hungry"
works
  #15 (permalink)  
Old 20-Mar-2008, 10:13
badger_fruit
Guest
 
Posts: n/a
Default

ok, ill keep this post in here as it's related; can you send HTML email with mailx? If not, can someone please suggest what I can use?
 
Page 2 of 2 1 2

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2