Page 1 of 1

Where do you have your object defitions

Posted: Wed Jan 15, 2014 4:55 pm
by jbruyet
Hey all, now that I've figured out my server email issue I'm getting my alerting figured out. I do have one question though -- where do you keep your object definitions? I was going to keep them in my templates.cfg file but then I dont' know which other .cfg files are using those definitions. I think I'm also going to split some of the alerting so important alerts go to my cell phone and less important alerts go to my email address so one definition could have two (or possibly three) different contacts. Then I thought I'd just put that definition in the top of my .cfg files but that seems like a lot of duplication for some things. I tried to find some hints and tips for alerting but I can't find anything along these lines. Any help here would be greatly appreciated.

Thanks,

Joe B

Re: Where do you have your object defitions

Posted: Wed Jan 15, 2014 5:01 pm
by slansing
Hey jbruyet,

Which object definitions do you mean? Objects are typically Hosts, Services, groups, etc. These are commonly split into their own .cfg files so you do not have to go on a wild game hunt trying to track down a single service definition. On the note of alerting, your alert definitions are generally on a host/service basis, or a template applied to your hosts/services.

Re: Where do you have your object defitions

Posted: Thu Jan 16, 2014 10:12 pm
by jbruyet
Ok, I guess I didn't know what they were called. I had copied some of the definitions that are listed in the templates.cfg file over to some of my .cfg files in Objects. My question is do people think it better to have those definitions in the .cfg files (printer.cfg, routers.cfg, etc.) along with the host definitions or or do people think it better to keep them in one file like the templates.cfg file.

Thanks,

Joe B

Re: Where do you have your object defitions

Posted: Fri Jan 17, 2014 1:12 pm
by slansing
We'll keep this open to see if there is any community feedback, generally we see people (including ourselves) use separate configuration files, e.g "switch1.cfg holding the host and service definitions for this switch, etc."

Re: Where do you have your object definitions

Posted: Fri Jan 24, 2014 1:29 pm
by jbruyet
Ok, maybe I'm explaining it wrong. Here's one of the "Host Definitions" that I'm talking about:

Code: Select all

define host {
        name WinServer
        use generic-host
        check_period 24x7
        check_interval 5
        retry_interval 1
        max_check_attempts 10
        check_command check-host-alive
        notification_period 24x7
        notification_interval 30
        notification_options d,u,s
        contact_groups PhoneContacts
        register 1
    }
Then in my Service and Process checks I include the line:

Code: Select all

use WinServer
I have some of these definitions sitting in the templates.cfg file and I have some of them sitting in the device config files. I see advantages and disadvantages to both ways so before I go all in I wanted to see what other admins have done, and maybe why they did it that way.

Thanks,

Joe B

Re: Where do you have your object defitions

Posted: Fri Jan 24, 2014 2:40 pm
by tmcdonald
I think you might be a bit confused about the "use" directive. "use" includes a template in your host/service/whatever definition. If you try to "use" the name of a host, weird things will happen if it works at all. One exception to this is incomplete object definitions, but you are not using these here.

As for keeping things organized, I usually keep all related services in one config when using Core since the editing is mainly done by hand in this case. That way you only have to open one file when removing a lot of services of the same type from hosts.