Message Subject - PROBLEM Service Alert: <hostname> is UP (fixed)

Terry Carmen terry at cnysupport.com
Fri May 13 17:59:49 CEST 2011


Quoting Terry Carmen <terry at cnysupport.com>:

> I've been receiving a continuous stream of these messages and can't
> seem to figure out why or make them stop.
>
> Nagios is sending repeated notifications that various hosts are "up"
> even though they have never been down.
>
> I've googled a number of similar problems, but unfortunately no
> applicable solutions.
>
> Does anybody have any ideas what I could check?

Here's an update:

I found a seemingly unrelated problem. I had duplicated the  
notify-host-by-email command into the notify-service-by-email command.

While this accounted for the inappropriate message content, fixing it  
seems to have also fixed the repeating notifications (haven't received  
any in a while).

No idea why fixing the invalid message text would also fix the  
repeating notifications, but it seems OK now.

I'm posting the answer here in case anybody else runs into this problem.

The lines below are working nicely on a system that uses postfix as  
the mailer.

This also takes care of postix's sendmail not respecting the -s  
(subject) command line option. The macros below add the subject to the  
message.

////////////////////////// from commands.cfg ///////////////////////

# 'notify-host-by-email' command definition
define command{
	command_name	notify-host-by-email
	command_line	/usr/bin/printf "%b" "Subject: ** $NOTIFICATIONTYPE$  
Host Alert: $HOSTNAME$ is $HOSTSTATE$ **\n\n***** Nagios  
*****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost:  
$HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:  
$HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nService:  
$SERVICECHECKCOMMAND$Host Output: [$HOSTOUTPUT$]\n\nHost Output  
(Long): $LONGHOSTOUTPUT$\n\nPerformance Data: $HOSTPERFDATA$\n\n" |  
/usr/sbin/sendmail -f nagios at example.com $CONTACTEMAIL$
	}

# 'notify-service-by-email' command definition
define command{
	command_name	notify-service-by-email
	command_line	/usr/bin/printf "%b" "Subject: ** $NOTIFICATIONTYPE$  
alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\n\n***** Nagios  
@VERSION@ *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:  
$SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:  
$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nService Output:  
$SERVICEOUTPUT$\n\nLong Service Output:  
$LONGSERVICEOUTPUT$\n\nAdditional Info:\n\n$OUTPUT$" |  
/usr/sbin/sendmail -f nagios at example.com $CONTACTEMAIL$
	}


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list