how to configure nagios sendmail after installing nagios

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.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

how to configure nagios sendmail after installing nagios

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: how to configure nagios sendmail after installing nagios

Post 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
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios mail after installing nagios

Post 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$
        }

rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to configure nagios sendmail after installing nagios

Post 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.
Former Nagios Employee
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to configure nagios sendmail after installing nagios

Post by rkennedy »

It is the source path that you're looking to link your sendmail from to the /usr/bin/mail.
Former Nagios Employee
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post by sinkak »

i am not using send mail. i am using /usr/bin/mail in commands.cfg
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to configure nagios sendmail after installing nagios

Post by rkennedy »

Where is your sendmail configured at on your system?
Former Nagios Employee
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to configure nagios sendmail after installing nagios

Post by rkennedy »

Can you run the command and post the output -
/usr/bin/mail -V
Former Nagios Employee
Locked