Notes Macro disables alarms

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Erlington
Posts: 10
Joined: Thu Jan 30, 2014 10:15 am

Notes Macro disables alarms

Post 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
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Notes Macro disables alarms

Post 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).
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Erlington
Posts: 10
Joined: Thu Jan 30, 2014 10:15 am

Re: Notes Macro disables alarms

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Notes Macro disables alarms

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Erlington
Posts: 10
Joined: Thu Jan 30, 2014 10:15 am

Re: Notes Macro disables alarms

Post 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.
Locked