Notifications not coming through

Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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
# 2  
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.
# 3  
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  
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.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
No SMS notifications once ppp up
antc
Hi all, I have an Siemens IoT2020 with a Sim7000e cellular board that I connect via USB to the board and connect to Telstra Cat-M1 network. I can send and receive SMS and do so using Node-Red but can also do with Minicom etc. When connected I get : root@iot2000:~# dmesg | grep USB ACPI:...... UNIX for Beginners Questions & Answers
0
UNIX for Beginners Questions & Answers
Cut down notifications from Nagios
Jethro
Hello, I am currently monitoring about 40 hosts using NsClient. Each host has between 5-8 services running on each of them. I was trying to find a way to get less notifications because I'm currently getting about 200 a week. Is there anyway for if one service goes down on a host to make nagios...... Infrastructure Monitoring
5
Infrastructure Monitoring
Expiring password notifications
Nvizn
I have a Solaris 10 server that notified one of my users/database administrators of another users account expiring within X amount of days. It attempted to email the user@ server.com, which failed and was forwarded from the mailer-daemon@ server.com, to the DBA. She's not listed as an alias for...... Solaris
2
Solaris
Solaris E-Mail Notifications ?!
ArabOracle.com
Hi , I need to have a monitoring system also I wanna have E-Mail Notification .or SMS notification to be on touch with my System : ) ... Regards Adel... Solaris
1
Solaris