Template inheritance issue?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Template inheritance issue?

Post by BanditBBS »

If I set the ARG3 of a service to something, if I assign a template that has ARG1, 2 and 3 set, should the template's ARG3 override the service's configured ARG3? I thought if it was defined in the service that it took precedence over the template.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Template inheritance issue?

Post by slansing »

The service's configuration definitions will always precede the templates, if something is not defined in the service config but it is in the template this will be transposed on the service config. So if you have ARG3 defined in a service already, the template's definition will not be used. "To my knowledge."
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Template inheritance issue?

Post by BanditBBS »

slansing wrote:The service's configuration definitions will always precede the templates, if something is not defined in the service config but it is in the template this will be transposed on the service config. So if you have ARG3 defined in a service already, the template's definition will not be used. "To my knowledge."
Your knowledge is wrong! LOL

Seriously though, I found a case where it is not true. I actually found a case where all sort of weird things happen.

Almost nothing configured in service, no command no ARGs. The template has everything configured in it. If I supply the service def with ARG3 it doesn't take effect. If I set the command in the service and leave ARG1 and ARG2 empty, my check then fails as it isn't grabbing ARg1 and 2 from the template. very strange behavior.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Template inheritance issue?

Post by tmcdonald »

Wanna post/PM some configs?
Former Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Template inheritance issue?

Post by lmiltchev »

Can you show us the service and the template definitions? Hide sensitive info.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Template inheritance issue?

Post by BanditBBS »

these good enough?
Capture1.JPG
Capture2.JPG
if you want the text config files I can post those as well
You do not have the required permissions to view the files attached to this post.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Template inheritance issue?

Post by tmcdonald »

Texts would probably be a bit more complete.
Former Nagios employee
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Template inheritance issue?

Post by BanditBBS »

Code: Select all

define service {
       name                                     win_prod_drive_c
       service_description                      Drive C: Disk Usage
       use                                      xiwizard_windowswmi_service
       check_command                            check_xi_service_wmiplus_auth!-A $USER1$/wmiauth.cfg!checkdrivesize!-a 'C': -w '90' -c '95'!!!!!
       max_check_attempts                       2
       check_interval                           5
       retry_interval                           2
       check_period                             24x7
       notification_interval                    15
       notification_period                      xi_timeperiod_24x7
       notification_options                     w,c,r,
       notifications_enabled                    1
       register                                 0

}
and

Code: Select all

define service {
        host_name                       WDCAE-PWEB04P.AEO.AE.COM
        service_description             Drive E: Disk Usage
        use                             win_prod_drive_c
        contact_groups                  cust_systems_devs
        _xiwizard                       windowswmi
        register                        1
        }
I think I found the issue!!!! ARG3 isnt written to file if ARG1 and 2 are empty?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Template inheritance issue?

Post by BanditBBS »

Hmmmm, it has to be with how the command is written to file. Because no command is set it doesn't write the ARGs. But if I set the command, ARG1 and ARG2 are not passed to the service definition.

This is what it looks like with command set and only ARG3

Code: Select all

define service {
        host_name                       WDCAE-PWEB03P.AEO.AE.COM
        service_description             Drive E: Disk Usage
        use                             win_prod_drive_c
        check_command                   check_xi_service_wmiplus_auth!!!-a 'E': -w '90' -c '95'!!!!!
        contact_groups                  cust_systems_devs
        _xiwizard                       windowswmi
        register                        1
        }
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Template inheritance issue?

Post by slansing »

Whelp, color me wrong on this one though logically it should work as everything else normally does when inheriting from a template. You cannot currently pass arguments through the template. At least I can't on 2.4
Locked