How can I get notified by e-mail in Nagwin ?

 

  • Nagwin has blat smtp mailer included. The first step is to let blat save your smtp server settings for later use:

bin/blat -SaveSettings -f from-address -server your.smtp.server [ -u login -pw password ]

 

  • You need also to specify your e-mail address for the contact nagiosadmin in etc/nagios/nagwin/contacts.cfg:

define contact{
        contact_name   nagiosadmin ; .....
        use generic-contact ; .....
        alias  Nagios Admin ; .....

        email ******@******    ; << CHANGE THIS TO YOUR EMAIL ADDRESS
}

 

  • As a last step, You need to update smtp server information in two notification commands etc/nagios/nagwin/commands.cfg:

# '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$ -subject "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -server smtp.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$ -subject "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -server smtp.server
    }

Replace smtp.server by name/ip of your smtp server (your Exchange server for example). Make sure that your smtp server is configured to accept smtp requests from Nagwin machine.

  • Restart the Nagwin_Nagios service to apply changes.

 

You can issue the command below to test if your mail notification works:

echo "Test message" | bin\blat - -to mail@address -f from@address -subject "Test mail" -server smtp.server