Help - how to use own email server?

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
jp.thiago
Posts: 3
Joined: Mon Sep 21, 2020 8:17 am

Help - how to use own email server?

Post by jp.thiago »

I have been using nagios for notification for a few years.

I use the default /usr/bin/mail, but my IP to be blocked by Spamhaus

I would like to continue using /usr/bin/mail, I would like to try using my email provider for this.

I changed the resource.cgf file including the lines below

$USER3$=xxx@xxx.com.br
$USER4$=xxxxxx (password)
$USER5$=smtp.xxxx.com.br:587

still using default account nagios@localhost.localdomain

I don't have much knowledge of linux (use centos os) I wanted to change it as simple as possible.

could they help?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Help - how to use own email server?

Post by mcapra »

Here's the manpage for mail:
https://linux.die.net/man/1/mail

Usually the hangup is with SMTP servers that have actual security features ...

There's a wide variety of CLI utilities you can use to interact in a secure fashion to send emails via a remote SMTP server:
* sendEmail (tutorial on integration with Nagios Core)
* sSMTP (Nagios Core tutorial)
* eMail

That list is far from exhaustive.
Former Nagios employee
https://www.mcapra.com/
jp.thiago
Posts: 3
Joined: Mon Sep 21, 2020 8:17 am

Re: Help - how to use own email server?

Post by jp.thiago »

sendmail configuration after installing sendmail package

$USER5$=email@gmail.com
$USER7$=smtp.gmail.com:587
$USER9$=email
$USER10$=password

---------------

is there any tutorial integrating mail and nagios? for a simple change like sendmail?

at this moment I changed the contact email @hotmail to @gmail

if you continue including on the blacklist I will test the integration with sendmail with nagios.

thank you so much!
jp.thiago
Posts: 3
Joined: Mon Sep 21, 2020 8:17 am

Re: Help - how to use own email server?

Post by jp.thiago »

What is the direct link from sendmail? the sendmail on the download site is customized.

I did the installations but shows SSL error using gmail.

the nagios code below is to be sent the email without ssl or tls authentication?

there is an error in the ssl.pm file on line 444

run run or lower test without problems

sendEmail -v -f $username -s $host -xu $username -xp $password -t $recipient -o tls=yes -u $subject -m $content

-------------------------------------------------------------------------

# '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" | /usr/local/bin/sendEmail -s $USER7$ -xu $USER9$ -xp $USER10$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"
}

# '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$" | /usr/local/bin/sendEmail -s $USER7$ -xu $USER9$ -xp $USER10$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"
Locked