From: Andreas E. <ae...@op...> - 2004-05-28 12:55:14
|
Hi all. I was thinking about the way contacts are propagated through the service and host objects in nagios 2.0, and I found some room for improvement. I'd like to be able to define contacts on a multitude of levels, starting with hostgroups and working their way down through service_groups and finally to services. (this also makes configuration backwards compatible, which is always a Good Thing). Here's how I thought it. A general syntax should be agreed upon to define exactly or add or subtract reference pointers to other objects. To _add_ a reference, one would prefix the reference name with a '&'. To _remove_ a reference, one would prefix the reference with a '!', and to specify exactly, one would use no prefix at all (like we override things inherited from templates today). To specify a group, one could prefix with a '@' (this way configuration file token support can be kept small). Not all references would have to support this, but it might be easier to include it on a general basis. For example, we have hosts 'server1' and 'server2' which are in hostgroup 'server-group', looking something like this; define hostgroup { hostgroup_name server-group alias some servers members server1,server2 contacts @server_contacts,server_admin,!@support_contacts } # all contacts in server_contacts and the contact server_admin # remove the contacts in contactgroup support_contacts define host { host_name server1 alias alias for server1 address 10.1.1.2 contacts !the_boss,&@quake_contacts } # the company quake-server, so don't let the boss know # it's being loaded too high all the time. define host{ host_name server2 alias alias for server2 address 10.1.1.3 contacts &xerox_workers } # print-server, so store emails where support staff can find them .... (I don't know enough about servicegroups yet to give an example of how it would work) ... # this looks silly with only 2 hosts, but you get the idea define service{ use default-service host @server-group,!server1 service_description Webpage integrity check_command check_http contacts @security_contacts,@web_contacts } # override host and hostgroup contacts completely for this service define service{ use default-service host @server-group service_description Mailserver check_command check_nrpe!mailq contacts !@quaker_group } # inherit contacts from server-group AND server{1,2}, respectively. # but don't send to @quaker_group I'd be willing to implement it, but I won't be able to work all too fast. One of the major benefits of this is that it makes it really easy to write a webconfiguration interface for it (solid object variable dependancies). I have done some work in that area, and I'd be willing to release it to the public if I can make it work properly on Nagios 2.0. Today, that requires some hacking. It also includes very nice (and extremely fast) functions to read and parse the configuration files, making it easy to extend it to replace the C-version of the GUI. Also, would I wreak havoc on everything if I removed the need for the 'define' word from the beginning of every object statement? -- Andreas Ericsson OP5 AB +46 (0)733 709032 and...@op... |