email id of Gmail for sending nagios core email alerts

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
cssp
Posts: 21
Joined: Thu May 17, 2018 10:31 pm

email id of Gmail for sending nagios core email alerts

Post 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 (abc.def123@gmail.com).

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
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

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

Post by eloyd »

Not sure what you mean. You need to define a contact with an email address of user@gmail.com and then set alerts to send notifications to that user. Gmail email addresses are just like any other.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post by tmcdonald »

Thanks for the assist, @eloyd! OP, please let us know if you need further assistance.
Former Nagios employee
cssp
Posts: 21
Joined: Thu May 17, 2018 10:31 pm

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

Post 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 abc@gmail.com) if something goes wrong in Windows Server 2012 R2 to other EMAIL ID(like def@gmail.com).

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 abc@gmail.com ; <<***** 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
}
cssp
Posts: 21
Joined: Thu May 17, 2018 10:31 pm

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

Post 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. :?:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
cssp
Posts: 21
Joined: Thu May 17, 2018 10:31 pm

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

Post 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 (abc@gmail.com) 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post by scottwilkerson »

cssp wrote:Can you please let me know, I configured my Email ID (abc@gmail.com) 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
cssp
Posts: 21
Joined: Thu May 17, 2018 10:31 pm

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

Post 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
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

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

Post by eloyd »

Glad we could help you out!
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
Locked