Page 1 of 1

Host template versus use this configuration as a template?

Posted: Mon Feb 19, 2018 9:27 pm
by toneill2000
We are trying to leverage templates more and I would like to know the specific difference (pros/cons as well) regarding whether to create "Host Templates" or leveraging existing Host objects and setting the field value in the "Use this configuration as a template generic name."

It seems like this gives us two ways to specify a "template" in nagios.

Also, is there a way to flip the value of the register [0/1] option on a host? The Nagios documentation describes what this does but not how to change this value. Thank you.

Re: Host template versus use this configuration as a templat

Posted: Tue Feb 20, 2018 4:27 pm
by kyang
We do have a kb article that touches on this briefly.
https://support.nagios.com/kb/article.php?id=508

As for the register option in Nagios XI. There is no way to actually do this.

There is a feature request for this option to be put in the CCM for hosts/services/contacts. Although there is no exact ETA for when it is expected to be implemented.

The only solution is to copy the config you want to use as a template. Change the register to 0 and upload it manually to XI. (Using the import config files)

Does this help?

Re: Host template versus use this configuration as a templat

Posted: Tue Feb 20, 2018 6:28 pm
by toneill2000
@kyang, unfortunately the link you provided has no mention of the difference between a "host template" and leveraging an existing host as a template by setting the field called "Use this configuration as a template" option. See the image I provided below about the specific field on a host that offers this. I want to know how this differs from an actual Host Template. Thank you for your time here.
Todd
host.jpg

Re: Host template versus use this configuration as a templat

Posted: Wed Feb 21, 2018 1:56 pm
by kyang
To me the only difference I see is that if you have a host who has specific settings: for example --> Notification_intervals, Contacts, maybe an event handler, and maybe a special check_command.

Then instead of creating another host template for that and retyping everything again. You could simply create a template using that host's template settings. Makes things a bit faster instead of retyping it. If that makes sense.

Vice versa for services as well if you wanted to use it's configuration as a template.

Code: Select all

define host {
        host_name       testing template
        alias   testing template
        address localhost
        check_period    24x7
        check_command   check_ping!3000,80%!5000,100%!!!!!!
        contacts        nagiosadmin
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      2
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    a
        notifications_enabled   1
        notification_interval   5.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        notes   Service config created via Puppet
        retain_status_information       1
        retain_nonstatus_information    1
        _TESTFREE       Service config created via Puppet
        }

This is from my objects.cache file

Code: Select all

define host {
        host_name       local
        alias   local
        address 127.0.0.1
        check_period    24x7
        check_command   check_ping!3000,80%!5000,100%!!!!!!
        contacts        nagiosadmin
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      2
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    a
        notifications_enabled   1
        notification_interval   5.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        notes   Service config created via Puppet
        retain_status_information       1
        retain_nonstatus_information    1
        _TESTFREE       Service config created via Puppet
        }

Notice that my testing template carried over all the settings of the host local.

Also note that, anything you override while using this template with a new host/service will take what you overridden. For example Host address and host name.

Let me know if this helps!

Re: Host template versus use this configuration as a templat

Posted: Fri Feb 23, 2018 4:25 pm
by toneill2000
@kyang, thanks for the detail. What you've said makes sense and it's what I suspected. I also see in the table structure it stores it a bit different with a reference back to the host table since the host is playing the role of a template in this case.

You can lock this post. Thanks!