Page 1 of 1

Notes Macro disables alarms

Posted: Mon Aug 04, 2014 1:15 pm
by Erlington
Hello people, im little concern about this.

I modified the command of sending alarm messages by email and it worked awesome. Here is how it looks:

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** NOC *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nID Circuit: $HOSTNOTES$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s " NOC ** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
The thing is if I configure a host without set notes parameter, immediately I stop receiving alarms to the email. So, is there any way to tell Nagios that if a host doesnt have notes parameter just ignored it?

Thanks in Advance

Re: Notes Macro disables alarms

Posted: Mon Aug 04, 2014 6:56 pm
by eloyd
$HOSTNOTES$ should always be defined. If it's not, I would say something else is going on. Can we see your hosts.cfg file? And for fun, change $HOSTNOTES$ to $HOSTNOTESURL$ and see if you still have the same problem (I know you're not using HOSTNOTESURL, this is just a test).

Re: Notes Macro disables alarms

Posted: Tue Aug 05, 2014 3:47 pm
by Erlington
eloyd wrote:$HOSTNOTES$ should always be defined. If it's not, I would say something else is going on. Can we see your hosts.cfg file? And for fun, change $HOSTNOTES$ to $HOSTNOTESURL$ and see if you still have the same problem (I know you're not using HOSTNOTESURL, this is just a test).
It didn't worked out even with $HOSTNOTESURL$ when the command checks a host without the parameter, it stucks and stop. By the way, I don't have a hosts.cfg... I create all the host in the objects folder and then add them to nagios.cfg file.

Re: Notes Macro disables alarms

Posted: Thu Aug 07, 2014 1:12 pm
by lmiltchev
I wasn't able to recreate the issue. I added "ID Circuit: $HOSTNOTES$" to the 'notify-host-by-email' command definition, didn't add any notes, but I still received the alert.

Code: Select all

Notification Type: CUSTOM
Host: localhost
State: UP
Address: 127.0.0.1
ID Circuit:
Info: OK - 127.0.0.1: rta 0.027ms, lost 0%

Date/Time: Thu Aug 7 13:05:09 CDT 2014
Can you send custom host notification, then search the mail log?

Code: Select all

tail -50 /var/log/maillog
Was the custom alert sent?

Re: Notes Macro disables alarms

Posted: Thu Sep 25, 2014 1:23 pm
by Erlington
Well I gave up. I realized that it's not possible. I'd better configure for each host a NOTE parameter and alerts and sent softly. Thanks for your time guys. Solved.