Unix/Linux Go Back    


Infrastructure Monitoring Forum for Nagios, Zabbix and other network monitoring and management tools.

Notifications not coming through

Infrastructure Monitoring


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-12-2017
rgouette's Unix or Linux Image
rgouette rgouette is offline
Registered User
 
Join Date: Sep 2006
Last Activity: 22 May 2017, 9:00 AM EDT
Location: Maine
Posts: 10
Thanks: 1
Thanked 2 Times in 1 Post
Notifications not coming through

Issue: I'm not receiving notifications

I can succesfully receive an e-mail if I do this on the command line:

Code:
/usr/bin/mail -s "NAGIOS HOST ALERT on $HOSTNAME$" rgouette@butlerbros.com

but, my command.cfg configuration below, refuses to send an e-mail when I set a service to a critical condition, and perform a force check:


Code:
# '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 "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

I even tried my explicit e-mail address instead of the MACRO, and still no e-mail sent.

Here is the debug log output for the force check(using my explicit e-mail addy):

Code:
[pid=19321] Processing: '/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 "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" rgouette@butlerbros.com'
[1494614719.490217] [2048.1] [pid=19321]   Done.  Final output: '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: CUSTOM\n\nService: C:\ Drive Space\nHost: IT-APP01\nAddress: 10.0.0.53\nState: CRITICAL\n\nDate/Time: Fri May 12 14:45:19 EDT 2017\n\nAdditional Info:\n\nc:\ - total: 59.90 Gb - used: 51.10 Gb (85%) - free 8.80 Gb (15%)\n" | /usr/bin/mail -s "** CUSTOM Service Alert: IT-APP01/C:\ Drive Space is CRITICAL **" rgouette@butlerbros.com'

the $CONTACTEMAIL$ macro does expand into my address when I use that..

Here's the hosts .cfg section for that service:

Code:
define service{
	use			generic-service
	host_name		IT-APP01
	service_description	C:\ Drive Space
	check_command		check_nt!USEDDISKSPACE!-l c -w 9 -c 10
	servicegroups		C_DRIVE_SPACE
	}

and here's the generic service, as defined in services.cfg:

Code:
# Generic service definition template - This is NOT a real service, just a template!

 define service{
         name                            generic-service 	; The 'name' of this service template
         active_checks_enabled           1       		; Active service checks are enabled
         passive_checks_enabled          1    		   	; Passive service checks are enabled/accepted
         parallelize_check               1       		; Active service checks should be parallelized (disabling this can lead to major performance problems)
         obsess_over_service             1       		; We should obsess over this service (if necessary)
         check_freshness                 0       		; Default is to NOT check service 'freshness'
         notifications_enabled           1       		; Service notifications are enabled
         event_handler_enabled           1       		; Service event handler is enabled
         flap_detection_enabled          1       		; Flap detection is enabled
         process_perf_data               1       		; Process performance data
         retain_status_information       1       		; Retain status information across program restarts
         retain_nonstatus_information    1       		; Retain non-status information across program restarts
         is_volatile                     0       		; The service is not volatile
         check_period                    24x7			; The service can be checked at any time of the day
         max_check_attempts              3			; Re-check the service up to 3 times in order to determine its final (hard) state
         normal_check_interval           10			; Check the service every 10 minutes under normal conditions
         retry_check_interval            2			; Re-check the service every two minutes until a hard state can be determined
         contact_groups                  admins			; Notifications get sent out to everyone in the 'admins' group
 	 notification_options		 c,r		; Send notifications about warning, unknown, critical, and recovery events
         notification_interval           60			; Re-notify about service problems every hour
         notification_period             24x7			; Notifications can be sent out at any time
         register                        0       		; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
         }

nagios.cfg seems to be in order as far as references...


Nagios version: Nagios® Core™ 4.2.0
running Postfix

I'm just at a loss for where a misconfiguration might exists..

Thanks,
rich
Sponsored Links
    #2  
Old Unix and Linux 05-12-2017
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 26 June 2017, 11:41 AM EDT
Location: NM
Posts: 11,095
Thanks: 536
Thanked 1,067 Times in 989 Posts
Can I posit that that you need to thoroughly check the postfix logs? I know postfix logs by default go to
Code:
 /var/log/mail*

I think your problem is not in the service, rather it is with postfix seeing something as garbage that is not. You may have to tweak the service, but something is not right with mail. IMO, a priori.
Sponsored Links
    #3  
Old Unix and Linux 05-15-2017
rgouette's Unix or Linux Image
rgouette rgouette is offline
Registered User
 
Join Date: Sep 2006
Last Activity: 22 May 2017, 9:00 AM EDT
Location: Maine
Posts: 10
Thanks: 1
Thanked 2 Times in 1 Post
ok, thanks Jim.
I think I was spacing out in not examining those as well..

Rich

---------- Post updated at 11:32 AM ---------- Previous update was at 11:30 AM ----------

oh, interesting..
I just received a RECOVERY e-mail, from a down Windows server, but only because
I FORCED a check..
Any ideas are welcome..

I'll dig in more..
R
    #4  
Old Unix and Linux 05-15-2017
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 26 June 2017, 11:41 AM EDT
Location: NM
Posts: 11,095
Thanks: 536
Thanked 1,067 Times in 989 Posts
Is that windows server the primary mail outbound server? This whole thing really sounds more like email is having issues. Larger sites have a single mail server (or two).

What does the environment variable mailhost on the problem postfix box say? You might have to su to the postfix process owner first. What is in resolv.conf (guessing linux) assuming that exists.... I have seen mailhost defined in there as well.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cut down notifications from Nagios Jethro Infrastructure Monitoring 5 01-07-2013 05:30 AM
Expiring password notifications Nvizn Solaris 2 01-04-2013 10:24 AM
Servers, email notifications drl Post Here to Contact Site Administrators and Moderators 1 09-15-2007 04:40 PM
Solaris E-Mail Notifications ?! ArabOracle.com Solaris 1 02-27-2006 02:32 AM
trying to turn email notifications off oombera Post Here to Contact Site Administrators and Moderators 2 05-21-2003 03:54 PM



All times are GMT -4. The time now is 06:22 AM.