Page 1 of 1

email id of Gmail for sending nagios core email alerts

Posted: Sat Jun 02, 2018 12:18 am
by cssp
Hi Team,

Sorry for posting again.

I configured Nagios Core and its working as expected but unable to configure Email alerts with my Gmail account like ([email protected]).

I tried to search for configuring Email ID of Gmail for sending Email alerts in Nagios Core but unable to understands and do it.
Hence requesting you to help me Step by Step Guideline for the same.

Thank you for advanced.

Regards
Somnath Pandey

Re: email id of Gmail for sending nagios core email alerts

Posted: Sun Jun 03, 2018 8:10 pm
by eloyd
Not sure what you mean. You need to define a contact with an email address of [email protected] and then set alerts to send notifications to that user. Gmail email addresses are just like any other.

Re: email id of Gmail for sending nagios core email alerts

Posted: Mon Jun 04, 2018 9:40 am
by tmcdonald
Thanks for the assist, @eloyd! OP, please let us know if you need further assistance.

Re: email id of Gmail for sending nagios core email alerts

Posted: Mon Jun 04, 2018 1:10 pm
by cssp
Thanks for your reply.

I have to two system, In one installed Nagios Core and other is Windows Server 2012 R2. I want to get alerts from Nagios Server through Gmail ID(like [email protected]) if something goes wrong in Windows Server 2012 R2 to other EMAIL ID(like [email protected]).

Here is my some cfg files please check and help me.

Contacts.cfg:
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_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options d,u,r ; 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
}

Re: email id of Gmail for sending nagios core email alerts

Posted: Mon Jun 04, 2018 1:28 pm
by cssp
Here is the windows.cfg file

define host{
use windows-server ; Inherit default values from a template
host_name DC-2012 ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.0.125 ; IP address of the host
}

There are many services but all are like the same type configured which is defined below,

define service{
use generic-service
host_name DC-2012
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}

Please let me know, what to do next. :?:

Re: email id of Gmail for sending nagios core email alerts

Posted: Mon Jun 04, 2018 3:08 pm
by scottwilkerson
So you would need to add the following to each of the hosts and services you want to be alerted for when they go into a non-OK state

Code: Select all

contacts			nagiosadmin
So your host example would change to:

Code: Select all

define host{
use windows-server ; Inherit default values from a template
host_name DC-2012 ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.0.125 ; IP address of the host
contacts			nagiosadmin
}
Once you have all the changes made, you will need to restart the nagios service and you should start getting alerts when hosts/services go in to HARD non-OK states

Re: email id of Gmail for sending nagios core email alerts

Posted: Tue Jun 05, 2018 11:45 am
by cssp
Hi scottwilkerson,

I configured same as you told in the trial post. After that, I stop the service (World Wide Web Publishing Service) in Windows Server 2012 R2. As the service is stopped so the W3SVC goes Critical and I wait more than an hour but I did not get any notification from Nagios Core Server.

define host{
use windows-server ; Inherit default values from a template
host_name DC-2012 ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.0.125 ; IP address of the host
contacts nagiosadmin
}

define service{
use generic-service
host_name DC-2012
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
contacts nagisoadmin
}

Please help me on the same.

Can you please let me know, I configured my Email ID ([email protected]) in contacts.cfg in which we receive the notification. Let us suppose If I received then "What is the sender Mail ID" :?:

Sorry in advance if it is the foolish question but I want to learn for my future.

Re: email id of Gmail for sending nagios core email alerts

Posted: Tue Jun 05, 2018 12:50 pm
by scottwilkerson
cssp wrote:Can you please let me know, I configured my Email ID ([email protected]) in contacts.cfg in which we receive the notification.
It should once it has been down for about 5 minutes based on a default configuration.

The from address will depend on what you have setup in the mail program on your server, may be sendmail or postfix

Re: email id of Gmail for sending nagios core email alerts

Posted: Tue Jun 05, 2018 2:40 pm
by cssp
Thank you so much for your help. :D

Now I receiving the notification if something non-OK or Critical on the server after configuring Postfix Relay through Gmail. :D

You can lock the post. Really I am very happy with your everything (Like..Product/Service/Support ). :D

Re: email id of Gmail for sending nagios core email alerts

Posted: Tue Jun 05, 2018 2:42 pm
by eloyd
Glad we could help you out!