Page 1 of 3

how to configure nagios sendmail after installing nagios

Posted: Tue Nov 17, 2015 11:48 am
by sinkak
if i did this step

Code: Select all

./configure --with-nagios-group=nagios --with-command-group=nagcmd 
and missed to add this at the end

Code: Select all

-–with-mail=/usr/sbin/sendmail
is there any way to configure with out re-compile and re-installing everything again.

Re: how to configure nagios sendmail after installing nagios

Posted: Tue Nov 17, 2015 6:13 pm
by ssax
I suppose you could always make /usr/sbin/sendmail a symbolic link to somewhere else.

Code: Select all

mv /usr/sbin/sendmail /usr/sbin/sendmail.old
ln -s /your/other/path /usr/sbin/sendmail

Re: how to configure nagios mail after installing nagios

Posted: Wed Nov 18, 2015 11:36 am
by sinkak
In the initial step of nagios configuration.
./configure --with-nagios-group=nagios --with-command-group=nagcmd and missed to add this at the end -–with-mail=/usr/bin/mail or -–with-mail=/usr/sbin/sendmail
I forgot to add mail option to it before i did make install step.
how creating new symbolic link will connect mail to nagios?
i have this in commands.cfg

Code: Select all

# '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/bin/mail -s "** WSA $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# '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: $HOSTAD
DRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** WSA $NOTIFICATIONTYPE$ Service Alert: $HOSTA
LIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }


Re: how to configure nagios sendmail after installing nagios

Posted: Wed Nov 18, 2015 1:25 pm
by rkennedy
The command @ssax posted above should work, what this will do is have Nagios look for your sendmail in the proper location that Nagios defaults to.

Re: how to configure nagios sendmail after installing nagios

Posted: Wed Nov 18, 2015 1:56 pm
by sinkak
i am using /usr/bin/mail in commands.cfg

in these steps.

Code: Select all

mv  /usr/bin/mail  /usr/bin/mail.old
ln -s /your/other/path  /usr/bin/mail
what is /your/other/path

Re: how to configure nagios sendmail after installing nagios

Posted: Wed Nov 18, 2015 2:15 pm
by rkennedy
It is the source path that you're looking to link your sendmail from to the /usr/bin/mail.

Re: how to configure nagios sendmail after installing nagios

Posted: Wed Nov 18, 2015 2:23 pm
by sinkak
i am not using send mail. i am using /usr/bin/mail in commands.cfg

Re: how to configure nagios sendmail after installing nagios

Posted: Wed Nov 18, 2015 2:27 pm
by rkennedy
Where is your sendmail configured at on your system?

Re: how to configure nagios sendmail after installing nagios

Posted: Wed Nov 18, 2015 2:39 pm
by sinkak
i have not configured sendMail on my nagios server.
i am using only /usr/bin/mail. which i forgot to add in the nagios configuration step.
i just used it as an example to ask if i forgot to add sendmail or mail in configuration step before make install. how do you configure it later.

Re: how to configure nagios sendmail after installing nagios

Posted: Thu Nov 19, 2015 10:56 am
by rkennedy
Can you run the command and post the output -
/usr/bin/mail -V