templates and inheritance

Daniel Rich drich at employees.org
Mon Jun 2 21:05:13 CEST 2003


It sounds like you are trying to do what I do here.  I do it with 
services so I don't have to duplicate the same data over and over 
again.  For example:

services-templates.cfg:
define service{
        name                            generic-service
        active_checks_enabled           1
       ... the standard generic-service entry ...
}
# SSH
define service{
        name                            ssh-service
        use                             generic-service
        service_description             SSH
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  smallservers-admin-admins
        notification_interval           120
        notification_period             24x7
        notification_options            w,c,r
        check_command                   check_ssh
        register                        0
        }


services.cfg
define service{
        use                             ssh-service
        host_name               host1
        }
define service{
        use                             ssh-service
        host_name               host2
        }
etc.



Tom Welsh wrote:

>Slap me if I'm being stupid.
>
>What I'd like to do is put a bunch of generic stuff in a hosts.cfg file
>then have multiple /usr/local/nagios/etc/<config Dirs> pointed to with
>system specific host config's. Again these could be hosts.cfg but would
>only contain stuff for that item.
>
>In the etc/hosts.cfg I'd stick
>
># Generic host definition template
>define host{
>        	name                            generic-host
>notification_interval           60      
>		notifications_enabled           1       
>		event_handler_enabled           1       
>		flap_detection_enabled          1       
>		process_perf_data               1       
>		retain_status_information       1       
>		retain_nonstatus_information    1       
>		register                        0       
>       	 }
>
>an example of what id want in my etc/switches/hosts.cfg
>
>#'cat 6509' host definition
>define host{
>        use                     generic-host      
>        host_name               cat6509-core
>        alias                   Catalyst 6509
>        address                 172.122.10.254
>        check_command           check-host-alive
>        max_check_attempts      3
>        notification_period     24x7
>        notification_options    d,r
>        }
>
>I'd then have the nagios.cfg point to various config's
>
>cfg_file=/usr/local/nagios/etc/hosts.cfg             # for generic
>stuffs
>cfg_file=/usr/local/nagios/etc/switches/hosts.cfg    # every switch
>config's 
>cfg_file=/usr/local/nagios/etc/routers/hosts.cfg     # every router
>config's
>cfg_file=/usr/local/nagios/etc/Microsoft/hosts.cfg   # Microsoft
>config's
>cfg_file=/usr/local/nagios/etc/UNIX/hosts.cfg        # UNIX box config's
>
>
>My question is would all the generic stuff be inherited from
>etc/hosts.cfg into etc/switches/hosts.cfg and the others?
>
>The purpose is so I can change stuff for generic host and only need to
>change it in one place as opposed to 5 different locations. Obviously id
>use like to use the same mechanism for services as well
>
>Ta in advance
>  
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20030602/34005474/attachment.sig>


More information about the Users mailing list