Page 1 of 1

Nagios Core

Posted: Fri Aug 10, 2018 11:24 am
by bshiers
I'm upgrading Nagios for a client from Version 1.2 up to Nagios Core 4.3.4 . I have everything working but the notifications properly. I'm not getting any INFO or the Date/Time in my notifications.

Here's what an old notification from the old system looks like:

Code: Select all

** Nagios Riverton **
Notification Type: PROBLEM
Host: Site
Name: Site2
State: DOWN
Address: x.x.x.x
Info: PING CRITICAL - Packet loss = 100%
Date/Time: Fri Aug 10 06:29:08 MDT 2018


Here’s what I’m getting from the new system (different host):

Code: Select all

** Nagios Riverton **
Notification Type: PROBLEM
Host: Site2
Name: Site3
State: DOWN
Address: y.y.y.y
Info: $
Date/Time: $
As you can see I'm not getting anything for Info and Date/Time.

Here is my notification command config:

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: $LO
NGHOSTOUTPUT$\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
	cmmand_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nSt
ate: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$LONGSERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$
is $SERVICESTATE$ **" $CONTACTEMAIL$
	}
I think I'm missing something very simple but I can't find it. Anything thoughts?

Re: Nagios Core

Posted: Fri Aug 10, 2018 3:36 pm
by npolovenko
Hello, @bshiers. I don't think your hosts/services are using the commands you included. The very first line in the notification message says:
** Nagios Riverton **
But according to the commands, it should be:
***** Nagios *****
Can you take a look at the contacts.cfg file and make sure that contacts are using the correct notification command?

Re: Nagios Core

Posted: Fri Aug 10, 2018 3:52 pm
by bshiers
I did find a command that referenced the Nagios Riverton in

/var/objects.precache, but that's the only spot.

I've removed the cache and retention files and that's the only place it keeps coming back. Where next as I'm sure that's my issue. The contacts were not using the right notification but it's like the one from the old server is getting cached somewhere.

Re: Nagios Core

Posted: Fri Aug 10, 2018 4:18 pm
by scottwilkerson
you could have muliple parent processes

Code: Select all

ps -ef|grep nagios.cfg
If there are multiple parents run the following:

Code: Select all

service nagios stop
killall -9 nagios
service nagios start

Re: Nagios Core

Posted: Fri Aug 10, 2018 5:01 pm
by bshiers
I think I found the issue. The old config was using the miscommands.cfg file and not commands.cfg. I'm doing some testing now but I believe I have this fixed up.

Re: Nagios Core

Posted: Fri Aug 10, 2018 5:22 pm
by bshiers
Issue is fixed. Thanks all for your help. Overlooked this for awhile.

Re: Nagios Core

Posted: Mon Aug 13, 2018 7:12 am
by scottwilkerson
bshiers wrote:Issue is fixed. Thanks all for your help. Overlooked this for awhile.
Great Locking