Hi,
Can we add a diferrent contact email on alert server for every host ?
Thanks.
Add email for every host
Re: Add email for every host
Yes. You need to create a different contact for each email and then assign that contact to the host notifications.
Advanced topic, but easier: If the hostname is part of the email address you're sending to, you could use the $HOSTNAME$ macro as part of the email address you're mailing to in your commands.cfg config file.
Advanced topic, but easier: If the hostname is part of the email address you're sending to, you could use the $HOSTNAME$ macro as part of the email address you're mailing to in your commands.cfg config file.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Add email for every host
I see thanks for your information.
Re: Add email for every host
Still wont work.
Can you give us example code for assign email to another host ?
Thanks.
Can you give us example code for assign email to another host ?
Thanks.
Re: Add email for every host
In hosts.cfg (or wherever you're defining your hosts):
Note that I'm using contact_groups here, and specifying different groups. You could just as easily use "contacts" instead and list individual contacts.
Now, in "contacts.cfg" (or wherever you store your contact information):
I've complicated things a bit with the groups, but I thought you might like to see that you can group contacts into multiple groups and then make notifications use the groups instead of the contacts. That way, if someone moves around from one group to another, you just change their group assignment instead of all the locations that they are listed as a notification recipient.
Code: Select all
define host{
use some_template
host_name my.favorite.hostname
address 10.1.1.1
contact_groups group_1
}
define host{
use some_template
host_name my.other.hostname
address 10.1.1.2
contact_groups group_2
}
Now, in "contacts.cfg" (or wherever you store your contact information):
Code: Select all
define contact{
contact_name contact1
use some_template
email [email protected]
}
define contact{
contact_name contact2
use some_template
email [email protected]
}
define contactgroup{
contactgroup_name group_1
alias support team plus admins
members contact1, contact2
}
define contactgroup{
contactgroup_name group_2
alias just support team
members contact1
}
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Add email for every host
Can we just give like this for example in host.cfg ?
Code: Select all
define host{
use some_template
host_name my.favorite.hostname
address 10.1.1.1
contacts [email protected]
}- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Add email for every host
No, this is not how Nagios works. An email address needs to be defined in a contact and the host config references the contact OR the contact group the contact is a member of.pianunix wrote:Can we just give like this for example in host.cfg ?
The email address is just one of the many settings a contact can have, others can be notification interval, what it receives notifications on, etc etc etc. The point being is that Nagios is designed this way to be very flexible.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Add email for every host
I see, well thanks for everything.
