contacts.cfg is not working properly
Re: contacts.cfg is not working properly
Can you post the command definition for notify-service-by-email from commands.cfg?
What is the output of the command which mail
Now I'm curious because you were unable to manually send an email, but you said that you are getting them for warnings.
What is the output of the command which mail
Now I'm curious because you were unable to manually send an email, but you said that you are getting them for warnings.
Former Nagios Employee.
me.
me.
Re: contacts.cfg is not working properly
Code: Select all
# '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 "** WSA $NOTIFICATIONTYPE$ Servi
ce Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}Code: Select all
ubuntu@nagios-2015:/usr/local/nagios/etc$ which mail
/usr/bin/mail
Re: contacts.cfg is not working properly
It sounds to me like there is something going on with the email address you are sending your critical emails to. You can attempt to add warnings to the email address that you are having issues with, to see if it is critical only. You may want to look in /var/log/mail or /var/log/mail.info for clues as to what is happening here. I've been going through your configurations for awhile, and had another set of eyes who is a lot more experienced with Nagios Core than I am look at these configs, and he can't find anything wrong either. Are the different email addresses with different providers? To me it looks like Nagios is doing everything that it should be at this point.
Former Nagios Employee.
me.
me.
Re: contacts.cfg is not working properly
what ever i add under alerts911 email, nothing is coming up like warning or host down.
both emails are from same website.
if i send manually a test mail to 911email from email then i get it. but nothing from nagios.
From
tail /var/log/mail.log
both emails are from same website.
if i send manually a test mail to 911email from email then i get it. but nothing from nagios.
From
tail /var/log/mail.log
Code: Select all
Oct 7 20:18:26 nagios-2015 postfix/qmgr[1306]: 78F02457E8: removed
Oct 7 20:23:26 nagios-2015 postfix/pickup[23833]: 70605457D3: uid=106 from=<nagios>
Oct 7 20:23:26 nagios-2015 postfix/cleanup[32520]: 70605457D3: message-id=<20151007202326.70605457D3@ip-10-0-10-149>
Oct 7 20:23:26 nagios-2015 postfix/qmgr[1306]: 70605457D3: from=<nagios@ip-10-0-10-149>, size=492, nrcpt=1 (queue active)
Oct 7 20:23:26 nagios-2015 postfix/smtp[32522]: 70605457D3: to=<root@ip-10-0-10-149>, orig_to=<root>, relay=none, delay=0.02, delays=0.01/0/0/0, dsn=5.4.4, status=boun
ced (Host or domain name not found. Name service error for name=ip-10-0-10-149 type=AAAA: Host not found)
Oct 7 20:23:26 nagios-2015 postfix/cleanup[32520]: 74879457E8: message-id=<20151007202326.74879457E8@ip-10-0-10-149>
Oct 7 20:23:26 nagios-2015 postfix/qmgr[1306]: 74879457E8: from=<>, size=2423, nrcpt=1 (queue active)
Oct 7 20:23:26 nagios-2015 postfix/bounce[32523]: 70605457D3: sender non-delivery notification: 74879457E8
Oct 7 20:23:26 nagios-2015 postfix/qmgr[1306]: 70605457D3: removed
Oct 7 20:23:26 nagios-2015 postfix/smtp[32522]: 74879457E8: to=<nagios@ip-10-0-10-149>, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.4.4, status=bounced (Host or doma
in name not found. Name service error for name=ip-10-0-10-149 type=AAAA: Host not found)
Oct 7 20:23:26 nagios-2015 postfix/qmgr[1306]: 74879457E8: removed
Last edited by sinkak on Wed Oct 07, 2015 3:40 pm, edited 2 times in total.
Re: contacts.cfg is not working properly
sinkak wrote:I did this with out user nagios
Code: Select all
ubuntu@nagios-2015:/usr/local/nagios/etc$ /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: test\n\nService: test\nHost: test\nAddress: test\nState: test\n\nDate/Time: test\n\nAdditional Info:\n\test\n" | /usr/bin/mail -s "** test Service Alert: test/test is test **" "[email protected]" ubuntu@nagios-2015:/usr/local/nagios/etc$none of them worked.Code: Select all
ubuntu@nagios-2015:/usr/local/nagios/etc$ /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: test\n\nService: test\nHost: test\nAddress: test\nState: test\n\nDate/Time: test\n\nAdditional Info:\n\test\n" | /usr/bin/mail -s "** test Service Alert: test/test is test **" "[email protected]"
When you say you send 'manually a test mail', how are you doing this?sinkak wrote:what ever i add under alerts911 email, nothing is coming up like warning or host down.
both emails are from same website.
if i send manually a test mail to 911email from email then i get it. but nothing from nagios.
Former Nagios Employee.
me.
me.
Re: contacts.cfg is not working properly
i meant from gmail account to 911email. it receives .
not from command line.
i am not able to find difference between two services.
i am doing same thing for warning email and 911 email.
but nagios is sending only to warning email.
not from command line.
i am not able to find difference between two services.
i am doing same thing for warning email and 911 email.
but nagios is sending only to warning email.
Last edited by sinkak on Wed Oct 07, 2015 3:41 pm, edited 1 time in total.
Re: contacts.cfg is not working properly
We need it to be receiving mail sent from the command line. Right now the problem isn't related to Nagios. If that mail command is not sending email to that email address, that is where the problem resides. What is this email hosted on? Is it something internal, or something external?
Former Nagios Employee.
me.
me.
Re: contacts.cfg is not working properly
command line send mail didnt work for both emails.
where as nagios is not wokring for 911email alone
where as nagios is not wokring for 911email alone
Re: contacts.cfg is not working properly
Can you post your commands.cfg for review? Also, you need to get logged in as the user 'nagios' to try to use that mail command. If you are unable to get logged in as this user, your Linux administrator should be able to help you get in. If you need to set a password for the nagios user, the command to do that would be passwd nagios, from there you would be able to log in to the account.
Former Nagios Employee.
me.
me.
Re: contacts.cfg is not working properly
Code: Select all
# '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 "** WSA $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: $HOSTAD
DRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** WSA $NOTIFICATIONTYPE$ Service Alert: $HOSTA
LIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
define command {
command_name notify-service-by-sms-only-once
command_line /sbin/mail_once.sh "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$" [email protected],[email protected],fg4
[email protected] "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$"
# command_line /sbin/mail_once.sh "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$" [email protected] "$NOTIFICATIONTYPE$ $HOSTALIAS
$/$SERVICEDESC$: $SERVICEOUTPUT$"
# command_line /sbin/mail_once.sh "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$" [email protected] "$NOTIFICATIONTYPE$ $HOSTALIAS$/
$SERVICEDESC$: $SERVICEOUTPUT$"
}
define command {
command_name notify-host-by-sms-only-once
command_line /sbin/mail_once.sh "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$" [email protected],[email protected],fg4
[email protected] "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$"
# command_line /sbin/mail_once.sh "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$" [email protected] "$NOTIFICATIONTYPE$ $HOSTALIAS
$/$SERVICEDESC$: $SERVICEOUTPUT$"
# command_line /sbin/mail_once.sh "$NOTIFICATIONTYPE$ $HOSTALIAS$/$SERVICEDESC$: $SERVICEOUTPUT$" [email protected] "$NOTIFICATIONTYPE$ $HOSTALIAS$/
$SERVICEDESC$: $SERVICEOUTPUT$"
}