Adding contacts and contact groups

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.
madhurima12
Posts: 15
Joined: Wed Sep 25, 2019 4:05 pm

Re: Adding contacts and contact groups

Post by madhurima12 »

But if I run a simple echo hello | mailx email@something.com in the terminal, it does send the email. That must mean postfix is running.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Adding contacts and contact groups

Post by scottwilkerson »

ok, notice you said mailx that is not part of the command you are having nagios use...

Run (from inside the container)

Code: Select all

which mailx
then replace /usr/bin/mail in your commands

restart nagios

But also, are you running that from inside the container?

This is a bit out of our scope as we don't manage containers here....
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
madhurima12
Posts: 15
Joined: Wed Sep 25, 2019 4:05 pm

Re: Adding contacts and contact groups

Post by madhurima12 »

Yes, the terminal runs in the container itself.
Yeah I understand that and that is part of the reason why it is so hard to setup a simple contact group cause I cannot find any reference material anywhere. The best bet was to ask you guys.
On running which mailx, the path is /usr/bin/mailx
Where do I have to replace this ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Adding contacts and contact groups

Post by scottwilkerson »

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/mailx -s "** $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: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked