Unable to get e-mail to send

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
mijretrop
Posts: 4
Joined: Fri Jun 07, 2019 8:40 pm

Unable to get e-mail to send

Post by mijretrop »

Hi All,

I'm fairly new to Ubuntu and way new to Nagios. I've done some digging and cant seem to find consistent answers on getting this set up.

I finally got to the point where I was able to send an email from the command line :

Code: Select all

echo "Subject: This Works" | sendmail -v [email protected] -f [email protected] -F "Service Events"
I use office365 cloud as my mail client and the -f with the -F was the only way I could get the e-mail to get past the outlook send from filter.

so I assumed once I got that fixed I could just paste that in the command line like :

Code: Select all

# 'notify-host-by-email' command definition
define command{
	command_name	notify-host-by-email
	command_line echo "Subject: Broke Stuff" | sendmail -v [email protected] -f [email protected] -F "Service Events"
	}

# 'notify-service-by-email' command definition
define command{
	command_name	notify-service-by-email
	command_line echo "Subject: Broke Stuff" | sendmail -v [email protected] -f [email protected] -F "Service Events"
	}
Here is my contacts.cfg file

Code: Select all

define contact{
        contact_name                    nagiosadmin		; Short name of user
	use				generic-contact		; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin		; Full name of user
        email                         [email protected]	; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
	service_notifications_enabled	1
	host_notifications_enabled	1
        service_notification_options    w,u,c,r,f,s		; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f,s		; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-email	; send service notifications via email
        host_notification_commands      notify-host-by-email	; send host notifications via email
        register                        10       		
       	service_notification_period	24x7
	host_notification_period	24x7
     }



###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }
I don't need to be able to check e-mail on this system, I just need a "Hey, check me out" email.

Let me know which log files you may need, I'll be happy to provide them

Thanks for any help you can give.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unable to get e-mail to send

Post by cdienger »

Try using the full path. Something like:

Code: Select all

# 'notify-host-by-email' command definition
define command{
   command_name   notify-host-by-email
   command_line echo "Subject: Broke Stuff" | /usr/sbin/sendmail -v [email protected] -f [email protected] -F "Service Events"
   }

# 'notify-service-by-email' command definition
define command{
   command_name   notify-service-by-email
   command_line echo "Subject: Broke Stuff" | /usr/sbin/sendmail -v [email protected] -f [email protected] -F "Service Events"
   }
Verify the location and permissions with "ll `which sendmail`".
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mijretrop
Posts: 4
Joined: Fri Jun 07, 2019 8:40 pm

Re: Unable to get e-mail to send

Post by mijretrop »

That did it!!!!
Thank you so much, I'd buy you a beer if were here.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unable to get e-mail to send

Post by cdienger »

Glad to hear!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked