Page 3 of 4

Re: set up email alerts using mailx

PostPosted: Tue Jan 15, 2019 12:45 pm
by nib01
Do you mean copy the Contact information from contact.cfg file to linuxhosts.cfg file where rancid host is?

Re: set up email alerts using mailx

PostPosted: Tue Jan 15, 2019 4:16 pm
by tgriep
No, edit the Contact Group called admin, add the contact to it in the member list.
Save and restart Nagios to apply the change.
That is much easier to do as you only have to add the contact to one place, the Contact Group.

Take a look at this link for descriptions of the Objects and how they are formatted.
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectdefinitions.html

Re: set up email alerts using mailx

PostPosted: Wed Jan 16, 2019 5:41 am
by mayuril
This is an all-in-one command that sends email to $TO_EMAIL_ADDRESS . You need to also replace these $FROM_EMAIL_ADDRESS and $FRIENDLY_NAME variables with your email and name.

$ mailx -v -s "$EMAIL_SUBJECT" \
-S smtp=smtp://smtp.ust.hk \
-S from="$FROM_EMAIL_ADDRESS($FRIENDLY_NAME)" \
$TO_EMAIL_ADDRESS
mailx will read the email content from STDIN. Type in the email main content and input “Ctrl+d” to tell mailx you have finished the content. The mail will be sent out. You can also use pipes like:

Re: set up email alerts using mailx

PostPosted: Wed Jan 16, 2019 3:56 pm
by tgriep
Thanks @mayuril for the help.

Re: set up email alerts using mailx

PostPosted: Tue Jan 22, 2019 5:08 pm
by nib01
mayuril wrote:This is an all-in-one command that sends email to $TO_EMAIL_ADDRESS . You need to also replace these $FROM_EMAIL_ADDRESS and $FRIENDLY_NAME variables with your email and name.

$ mailx -v -s "$EMAIL_SUBJECT" \
-S smtp=smtp://smtp.ust.hk \
-S from="$FROM_EMAIL_ADDRESS($FRIENDLY_NAME)" \
$TO_EMAIL_ADDRESS
mailx will read the email content from STDIN. Type in the email main content and input “Ctrl+d” to tell mailx you have finished the content. The mail will be sent out. You can also use pipes like:


Ive tried above command to send email, see screenshot photo, and it works fine without any error.

The problem that Im facing right now is the client within linuxhosts.cfg file, I did some testing by shutting down one of the host (rancid) I expect to send an email notification to the email Ive setup within commands.cfg, but it didnt work.

Re: set up email alerts using mailx

PostPosted: Wed Jan 23, 2019 10:26 am
by tgriep
Can you post all of the Nagios config files so we can view the settings to verify that the settings for the contact, host, services, groups are setup correctly?

Re: set up email alerts using mailx

PostPosted: Wed Jan 23, 2019 12:52 pm
by nib01
Please see attached nagios config files. For the Services and Groups config file, these two config files are combined with the hosts to be monitored. Please let me know if you need additional information.

Re: set up email alerts using mailx

PostPosted: Wed Jan 23, 2019 5:54 pm
by tgriep
Can you post the config file that contains the generic-contact template and the linux-server template?
Typically, the templates have the Host and Service Notifications enabled and also the contact template but I would have to see them for sure to verify that they are set.

Another thing, can you go to the Notification Report and see if you can find the host there and is so, post the entry?

Re: set up email alerts using mailx

PostPosted: Thu Jan 24, 2019 12:56 pm
by nib01
See attached generic-contact template and lnux-server template config. As far as I can see Host and Service Notifications are both enabled.

Also, Id like to verify if this free version of Nagios able to support VM instances because all of the servers that we have to monitor are mostly VMs (ProxMox VMs and VMware ESXi VMs) beside Network switch, router and firewall.

Re: set up email alerts using mailx

PostPosted: Thu Jan 24, 2019 5:34 pm
by tgriep
Check the nagios.cfg file and make sure notifications are enabled. Check this setting.
Code: Select all
enable_notifications=1


Then restart the nagios service and test to see if the Notifications are working.

Can you go to the Notification Report and see if you can find the host there and post what it look like?orking.