LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-16-2013, 06:16 PM   #1
praveen.ks
LQ Newbie
 
Registered: Aug 2013
Posts: 8

Rep: Reputation: Disabled
Nagios Core 3.4 Issue in notification


I configured nagios core 3.4 in ubuntu 12.04, it's working fine and I installed postfix for mail notification

when am typing in terminal
root@ns:~# mail praveen.ks@xx.com
________________am getting mail____________

but, in nagios am not getting notification. In command.cfg file i given like this

'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

In contacts.cfg file i given like this

define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email praveen.ks@xx.com ; CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

Can anyone please check and tell me, how to resolve the issue
 
Old 08-17-2013, 07:18 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by praveen.ks View Post
I configured nagios core 3.4 in ubuntu 12.04, it's working fine and I installed postfix for mail notification
when am typing in terminal
root@ns:~# mail praveen.ks@xx.com

am getting mail but, in nagios am not getting notification. In command.cfg file i given like this

command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

Can anyone please check and tell me, how to resolve the issue
You first need to make sure that the mail program is actually located at /usr/bin/mail, so type in "which mail" and "which printf". If the paths don't match, modify them.

Then, you need to test the command from a terminal, to see what error(s)/message(s) you get. So, using what you have above:
Code:
/usr/bin/printf "This is some test text" | /usr/bin/mail -s "**this is a test subject" user@domain.com
If that works from the command line, then you have other issues we can help with. If it DOESN'T, then you have identified an issue. And do you see anything in your logs when you try to send an alert?
 
Old 08-17-2013, 02:54 PM   #3
praveen.ks
LQ Newbie
 
Registered: Aug 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
mail in /usr/bin/mail and printf in /usr/bin/printf only, when am sending mail in terminal it's working, but when host is down am not getting any notification
 
Old 08-17-2013, 03:05 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by praveen.ks View Post
mail in /usr/bin/mail and printf in /usr/bin/printf only, when am sending mail in terminal it's working, but when host is down am not getting any notification
Right...so did you try pasting the ENTIRE command line onto a terminal prompt as suggested? Did it work??
 
Old 08-17-2013, 03:41 PM   #5
praveen.ks
LQ Newbie
 
Registered: Aug 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Yes, it's working
 
Old 08-17-2013, 03:45 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by praveen.ks View Post
Yes, it's working
Ok...what exactly did you put in??? Guessing isn't fun...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios Email Notification zoomzatag Linux - Newbie 4 07-20-2011 04:23 AM
Nagios Notification Not workig ankitsagwekar Linux - Software 2 05-04-2011 12:07 AM
Few questions about Nagios - reboot notification, value=x notification. marccmile Linux - Software 5 06-04-2009 06:44 PM
NAGIOS notification ny101880 Linux - Newbie 14 01-04-2009 01:10 AM
help in nagios notification packets Linux - Software 2 10-10-2008 01:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration