Page 1 of 1

NagiosXI Service Template Inheritance

Posted: Thu Apr 17, 2014 1:04 am
by mlopez
Hi All,
I created the service beforehand and just created the Hostgroup, Servicegroup, Host and Service Template and applied it to an existing service and host. When changing the parameters on the "Service Template" it's not changing the associated Service. After reading more on the cause it seems to be related to the "Register" value which needs to be 0 and not 1 but I cannot figure out how to change this value as the config file under "/usr/local/nagios/etc/services" is getting changed back as per NagiosQL as per the big warning when opening the file.

--------------------
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update

--------------------



Below is the service:

Code: Select all

define service {
        host_name                       20098
        service_description             upsFailureNotify
        use                                  upsFailureNotify_service
        servicegroups                   upsFailureNotify_servicegroup
        is_volatile                     1
        max_check_attempts              1
        check_interval                  1
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        notification_interval           1
        notification_period             xi_timeperiod_24x7
        notifications_enabled           1
        contacts                        nagiosadmin
        stalking_options                o,w,c,u,
        icon_image                      snmptrap.png
        _xiwizard                       snmp_trap
        [b]register                        1[/b]
        }
Any help would be greatly appreciated.

Sincerely,
Michael

Re: NagiosXI Service Template Inheritance

Posted: Thu Apr 17, 2014 10:44 am
by tmcdonald
Were these created in the CCM or by hand on the command line? If in the CCM, you will need to create a template under the Templates section and it will have 'register 0'. Also, know that if you have a value in a template and you set that same value in the service that uses the template, the value in the service will take precedence.

Re: NagiosXI Service Template Inheritance

Posted: Tue Apr 22, 2014 12:17 pm
by mlopez
Hi TMC,
These were created using the CCM, is there any way to flip them to Register 0 through the specific service GUI? I must be blind because I can't find the option.

BTW below is my setting for the upsFail service which specifies "Register 0" at the template level.

Code: Select all

define service {
       name                                    upsFailureNotify_service
       host_name                                *
       hostgroup_name                           sms_host
       service_description                      upsFailureNotify SNMP Traps
       servicegroups                            upsFailureNotify_servicegroup
       check_command                            check_dummy!!!!!!!!
       is_volatile                              1
       initial_state                            o
       max_check_attempts                       1
       active_checks_enabled                    0
       passive_checks_enabled                   1
       flap_detection_enabled                   0
       notification_period                      24x7
       notifications_enabled                    1
       contacts                                 nagiosadmin
       contact_groups                           admins
       stalking_options                         o,w,c,u,
       icon_image                               snmptrap.png
       register                                 0

}

Re: NagiosXI Service Template Inheritance

Posted: Tue Apr 22, 2014 1:48 pm
by abrist
mlopez wrote:is there any way to flip them to Register 0 through the specific service GUI? I must be blind because I can't find the option.
Not really. Templates and object configs are treated as metaphysically different "things" in Nagios QL - they sit in different tables and have different relations. You could copy the config file, change the desired values, and then import it back into XI, but for one config, you may find it much faster to just recreate the object in the correct Aristotelian Category.

Re: NagiosXI Service Template Inheritance

Posted: Wed Apr 23, 2014 1:00 pm
by povachon
Have the same issue here. I understand we cant change de register option from 0 to 1 in gui. I make the change in CLI and save the file. As soon as i import de Template back, my change have been destroy.

So how can i change that setting plz.

Regard
PO

Re: NagiosXI Service Template Inheritance

Posted: Wed Apr 23, 2014 2:29 pm
by sreinhardt
You need to set register to 0 and remove service description entirely. These were the only two items from a normal service config file that I needed to modify to have it properly import as a template. Note that the name field will be how it is referenced inside CCM, so you may want to alter that too.

Re: NagiosXI Service Template Inheritance

Posted: Thu May 01, 2014 3:08 pm
by mlopez
Hi Spenser,
Figured out the "Register 0" for services.

What I did is create "Service Templates" for each one and tied it to a hostgroup_name as shown below:

Code: Select all

define service {
       name                                     upsFailureNotify_service
       host_name                                *
       hostgroup_name                           host
       service_description                      upsFailureNotify SNMP Traps
       servicegroups                            upsFailureNotify_servicegroup
       check_command                            check_dummy!!!!!!!!
       is_volatile                              1
       initial_state                            o
       max_check_attempts                       1
       check_interval                           1
       retry_interval                           1
       active_checks_enabled                    0
       passive_checks_enabled                   1
       check_period                             xi_timeperiod_24x7
       flap_detection_enabled                   0
       notification_interval                    1
       notification_period                      xi_timeperiod_24x7
       notification_options                     w,c,u,r,
       notifications_enabled                    1
       contacts                                 nagiosadmin
       contact_groups                           admins
       icon_image                               snmptrap.png
       register                                 0

}


Now I was wondering about Host Templates, I created a Host Template when creating the host, I do the following:


I add a new host under the CCM -> HOSTS:
- Go under the Host settings and configure the following:
- (Common Settings) Put in the name, IP, Description
- (Common Settings) Manage Templates (Tie it to a Template)
- (Common Settings) Manage Hostgroups (Tie it to a Hostgroup)
- (Alert Settings) Manage Contacts (Tie it to contacts)
- (Alert Settings) Manage Contactgroups (Tie it to Contactgroups)


below is an example of one of my hosts:

Code: Select all

define host {
        host_name                       TMR54
        use                             snmptrap_host
        alias                           ROMERO
        address                         192.168.1.18
        hostgroups                      host
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        contacts                        nagiosadmin
        contact_groups                  admins
        notification_interval           60
        notification_period             xi_timeperiod_24x7
        notification_options            d,r,
        notifications_enabled           1
        register                        1
        }
Am I doing this all wrong? Any advise would be greatly appreciated as all my Hosts have the same config and want to be able to change them all in 1 shot instead of going one by one when I need to do a modification, as this is a larger set up it would be ideal for mass changes.

Sincerely,
Michael

Re: NagiosXI Service Template Inheritance

Posted: Thu May 01, 2014 4:06 pm
by abrist
mlopez wrote:Am I doing this all wrong? Any advise would be greatly appreciated as all my Hosts have the same config and want to be able to change them all in 1 shot instead of going one by one when I need to do a modification, as this is a larger set up it would be ideal for mass changes.
No, you mostly got it. I would suggest setting contactgroups on the templates and contacts in contactgroups only, so that adjusting contactgroups is only done through a template, and adjusting contacts is done purely through the contactgroups.

Re: NagiosXI Service Template Inheritance

Posted: Mon Jun 09, 2014 3:51 pm
by mlopez
Hi abris,
You may close this thread as your explanation has resolved my issue.

Sincerely,
Michael