Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I would like to send Nagios notifications using my gmail account.

I have already set up my hosts I want to monitor and services also.

What is the most simple way to accomplish this using NagWin on a Windows Server 2012 installation?

As far as I know I must change some of these configuration settings:

# 'notify-host-by-email' command definition
define command{
    command_name    notify-host-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/blat - -to $CONTACTEMAIL$ -f nagios@localhost -subject "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -server ???
    }

# '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" | /bin/blat - -to $CONTACTEMAIL$ -f nagios@localhost -subject "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -server ???
    }

What should I use for smtp server? Is it possible to directly send my notifications to the Gmail server?

share|improve this question

2 Answers 2

Do /usr/bin/printf and /bin/blat exist on your Windows box and does blat take an SMTP server parameter?

If not, you'll need an alternative set of commands -- maybe even your own custom script -- to generate the text output and send it to an SMTP server.

In any case, I'd probably point it at an IIS-based virtual mail server installed on the same Windows box, then configure the IIS vSMTP to send all mail to Gmail via the Smart Host feature. This will allow you to queue the mails locally, should a network outage mean you lose connectivity to the Gmail server. You could also use a third-party server like hMailServer

This Amazon blog article gives a good example on how you might set IIS up (substituting Amazon for Google, where appropriate)...

share|improve this answer

Yes, it is possible. You need to locate an smtp server. Check if Itefix FAQ can help. Nagwin has already blat included.

share|improve this answer
    
+1 for word-of-$DEITY –  jimbobmcgee Dec 9 '13 at 14:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.