naemon / naemon-core

Networks, Applications and Event Monitor
http://www.naemon.io/
GNU General Public License v2.0
154 stars 63 forks source link

Inherit more service attributes from its host #83

Closed julianbrost closed 10 years ago

julianbrost commented 10 years ago

Currently only the attributes contact_groups, notification_interval and notification_period of a service are inherited from the corresponding host, see http://www.naemon.org/documentation/usersguide/objectinheritance.html#implied_inheritance

I'd like to see the same behavior for some other attributes too, in my case I need this for check_period as I monitor some services on many hosts where only some are turned off at night and currently I have to duplicate the service definitions for them which seems unnecessary.

Implementing this shouldn't break any existing setups as having no check_period specified in a service is not allowed at the moment. If you give me some hints on where to look at the source code, I'd be willing to work on a patch.

sni commented 10 years ago

notification_period inheritance happens in naemon/xodtemplate.c:3497

julianbrost commented 10 years ago

This actually seems to be pretty simple. I'm about to test it with my installation and if everything works fine, I'll submit a pull request.

I would add the same inheritance for check_interval, check_period and retry_interval. Are there any other attributes where this might be useful?

sni commented 10 years ago

i guess thats it. According to http://www.naemon.org/documentation/usersguide/objectdefinitions.html#host_definition i'd say the others don't make sense.

ageric commented 10 years ago

On 2014-08-05 16:01, Julian wrote:

This actually seems to be pretty simple. I'm about to test it with my installation and if everything works fine, I'll submit a pull request.

I would add the same inheritance for check_interval, check_period and retry_interval. Are there any other attributes where this might be useful?

Please don't do it for check_interval and retry_interval. check_period makes a lot of sense, but having different intervals on hosts and services also does, and currently check_interval defaults to 5 and retry_interval to 1. Changing it so these parameters are inherited by the hosts may break people's existing setups.

/Andreas

julianbrost commented 10 years ago

My patched version works fine so far (and my configuration got a lot simpler).

I'm not quite sure about check_interval and retry_interval. I can't think of a situation where one might need this, but on the other hand maybe someone thought the same when implementing this for the other three attributes. But if this would break backwards compatibility, I don't want to spend too much time on this.

So you'll probably see a pull request for check_period and the according documentation changes in the next few days.

julianbrost commented 10 years ago

I just created these two pull request:

sni commented 10 years ago

thanks