how to change the default sender of nagios mail notification

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
gyang27
Posts: 3
Joined: Mon Sep 23, 2013 4:52 am

how to change the default sender of nagios mail notification

Post by gyang27 »

Hi,

I want to change the default sender ([email protected])of nagios email notification. so the sender can be customized not [email protected],
maybe something likes [email protected]. Is it possible to modify this? how to?

Thanks

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

Re: how to change the default sender of nagios mail notifica

Post by abrist »

It all depends how you are sending mail. It could be a postfix setting, sendmail setting, exim, or others. Usually the mails are sent as user nagios as the mail is sent from the system user nagios. You will need to alter your mta config to send as a different user.
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.
gyang27
Posts: 3
Joined: Mon Sep 23, 2013 4:52 am

Re: how to change the default sender of nagios mail notifica

Post by gyang27 »

Thanks for your reply. I use the sendmail as my MTA. but I don't know how to change it to meet with my demand.

Could you please show me the details?

Appreciate your help.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: how to change the default sender of nagios mail notifica

Post by abrist »

You could try adding:

Code: Select all

-- -r $ADMINEMAIL$
To the end of your notification commands. Then change the "admin_email" directive in nagios.conf to the email address of your choice.
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.
gyang27
Posts: 3
Joined: Mon Sep 23, 2013 4:52 am

Re: how to change the default sender of nagios mail notifica

Post by gyang27 »

Great!
I got another way to make it true. I added "-- -f [email protected] -F sys-admin" in command.cfg
It works now. Thanks you again.

I have another question here. the command check_disk with parameter -u GB doesn't work

"command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk -u GB -a $ARG1$ $ARG2$ $ARG3$", I didn't find error in the command line

but I don;t know why it still display MB not GB. any suggestion?

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

Re: how to change the default sender of nagios mail notifica

Post by abrist »

gyang27 wrote:I got another way to make it true. I added "-- -f [email protected] -F sys-admin" in command.cfg
That will work as well, though the 'from address' and 'return address' are slightly different. If you have issues sending through relays, you may want to set both.
gyang27 wrote:but I don;t know why it still display MB not GB. any suggestion?
It looks like you may need move the unit (-u GB) switch into the arguments. I tested the check from the cli and it works correctly here.

Do note: You will have to remove the RRD and XML associated with this check (if you rae using rrds and pnp4nagios) as the metric will change to GB (leading to much smaller performance numbers).

Can you run your check from the cli?
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