Nagios Notification Configuration

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
nickyls
Posts: 3
Joined: Sat Mar 23, 2013 12:16 am

Nagios Notification Configuration

Post by nickyls »

hello all!

i have installed nagios3 on ubuntu platform. I have configured notification using postfix.
Now, in from mail address i want to remove "nagios@" prefix. How to do?
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Nagios Notification Configuration

Post by gshergill »

Hi nickyls,

There is a mailx option which lets you do this which is "-r".

Below is an example:

Code: Select all

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 -r newnagios@nagios.notify -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
Kind Regards,

Gary Shergill
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Notification Configuration

Post by scottwilkerson »

Again, Gary is correct, if you leave the -r off it is going to mail from nagios@machine_name
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
nickyls
Posts: 3
Joined: Sat Mar 23, 2013 12:16 am

Re: Nagios Notification Configuration

Post by nickyls »

Thank you for quick reply.
But in our instance if i add -r xxx@gmail.com the nagios didnt send any notification. The email id xxx@gmail.com is provided while configuring Postfix.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Nagios Notification Configuration

Post by gshergill »

Hi nickyls,

If it's no longer sending the notification after adding the "-r", there may be a mistake in your command definition.

Could you please paste the command definition you are using?

Also, just to confirm, are you using mailx?

Thank you.

Kind Regards,

Gary Shergill
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Notification Configuration

Post by abrist »

Any update on this nickyls?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked