NagiosXI - Service template not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Bala.Mutyam
Posts: 97
Joined: Wed Apr 29, 2020 12:18 pm

NagiosXI - Service template not working

Post by Bala.Mutyam »

Hi,

I have configured below service template and assign the template to a host group/host but it's not inheriting alert from the service template. Can you please help me with this?

command definition:

Code: Select all

define command {
    command_name    check_dns_euro
    command_line    $USER1$/check_dns -H $HOSTNAME$.exampple.com
}
service template definition

Code: Select all

define service {
    name                            win_check_dns_euro
    hostgroup_name                  euro_dns
    service_description             Check_euro_DNS
    use                             xiwizard_generic_service
    check_command                   check_dns_euro
    max_check_attempts              5
    check_interval                  5
    check_period                    24x7
    notification_period             cp-standard-timeperiod
    register                        0
}
host group definition

Code: Select all

define hostgroup {
    hostgroup_name    euro_dns
    alias             Euro DNS
    members           hostname
}
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NagiosXI - Service template not working

Post by dchurch »

I'm not sure what you mean by "not inheriting alert" - does that mean your service isn't inheriting the contact or contact groups from the service template?
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NagiosXI - Service template not working

Post by dchurch »

Just checking in since we haven't heard from you in a while. Did you get this working?
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Bala.Mutyam
Posts: 97
Joined: Wed Apr 29, 2020 12:18 pm

Re: NagiosXI - Service template not working

Post by Bala.Mutyam »

dchurch wrote:I'm not sure what you mean by "not inheriting alert" - does that mean your service isn't inheriting the contact or contact groups from the service template?
Hi dchurch,

Apologies, i was away. Shouldn't all the hosts in the host group have the service check?

Thanks
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NagiosXI - Service template not working

Post by dchurch »

Yes. That service and host group are configured in such a way that all the hosts in the host euro_dns host group should get the win_check_dns_euro service check when the config is applied.

If you PM me a system profile I can diagnose further. Get one by going to Admin (top menu) => System Profile (in the left menu), then clicking the blue button.

If you're unable to generate the the profile through the web interface, please try generating it from the command line by running these commands as root:

Code: Select all

rm -rf /usr/local/nagiosxi/var/components/profile*
/usr/local/nagiosxi/scripts/components/getprofile.sh SUPPORT
Then send me the resulting /usr/local/nagiosxi/var/components/profile.zip file.
If the profile script fails, please include the ENTIRE output.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Bala.Mutyam
Posts: 97
Joined: Wed Apr 29, 2020 12:18 pm

Re: NagiosXI - Service template not working

Post by Bala.Mutyam »

PM'd system profile.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NagiosXI - Service template not working

Post by dchurch »

After analyzing your config, I think I found the reason the service template wasn't being configured for the host.

The object called win_check_dns_euro is merely a service template and not an actual service. It's not referenced anywhere in the service definitions, so it can't be applied to a host.

Defining a service group for a service template only means that services inheriting from that service template will be assigned to that service group (unless defined otherwise in the service definition).

Either:
  • Convert win_check_dns_euro it to a service
    • This means delete it from the service templates list, and re-add it under the services list
  • Or, add a service based on win_check_dns_euro
    • This means add a new service to the services list and add win_check_dns_euro under its templates.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Bala.Mutyam
Posts: 97
Joined: Wed Apr 29, 2020 12:18 pm

Re: NagiosXI - Service template not working

Post by Bala.Mutyam »

Hi dchurch: Thanks for the update, i have created a service, win_check_dns_euro and assign the service to the win_check_dns_euro template and it's working now.

Does the host template also work in similar manner: host template and host definition (asking for for the hostname)?

Can you also share documents with example for service templates and host templates?

Thanks
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: NagiosXI - Service template not working

Post by dchurch »

Bala.Mutyam wrote:Does the host template also work in similar manner: host template and host definition (asking for for the hostname)?
Yes, that's right. Defining a host template will also not cause a host to show up in the system.

Here's a doc explaining how templates and inheritance work: https://assets.nagios.com/downloads/nag ... tance.html
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Bala.Mutyam
Posts: 97
Joined: Wed Apr 29, 2020 12:18 pm

Re: NagiosXI - Service template not working

Post by Bala.Mutyam »

@dchurch: Hi,

I having a weird issue with overriding default threshold for a service. i have defined a service template called cp_windows_servers_base_template and assigned the cp_windows_servers_base_template and assigned to cp_windows_basic_service_checks service so all hosts in CP_Windows_Servers will have all the base thresholds.

For some hosts i'm trying to override defaults thresholds, so created cp_windows_sql_servers_memory_usage_template assigned to cp_windows_sql_servers_memory_usage service so all hosts in CP_Windows_MS_SQL_Servers threshold be override.

But overriding is not working for these 2 template and all others working fine. Also override is working for one host in CP_Windows_MS_SQL_Servers. What am i doing wrong here? can you please help? I added all config's below.


Service base template:

Code: Select all

define service {
    name                            cp_windows_servers_base_template
    hostgroup_name                  CP_Windows_Servers
    service_description             Every Windows server inherits checks from this template
    max_check_attempts              5
    check_period                    24x7
    notification_interval           720
    notification_period             cp-standard-timeperiod
    register                        0
}
Service template to override base thresholds:

Code: Select all

define service {
    name                            cp_windows_sql_servers_memory_usage_template
    hostgroup_name                  CP_Windows_MS_SQL_Servers
    service_description             MS SQL Servers Memory Override
    max_check_attempts              5
    check_period                    24x7
    notification_interval           720
    notification_period             cp-standard-timeperiod
    register                        0
}
Base Service Definitions:

Code: Select all

define service {
    service_description    Memory Usage
    use                    cp_windows_servers_base_template
    check_command          check_xi_ncpa!-t 'NCPA221token' -P 5693 -M memory/virtual -u Gi -w 85 -c 90!!!!!!!
    register               1
}
override service definition:

Code: Select all

define service {
    service_description    Memory Usage
    use                    cp_windows_sql_servers_memory_usage_template
    check_command          check_xi_ncpa!-t 'NCPA221token' -P 5693 -M memory/virtual -u Gi -w 97 -c 99!!!!!!!
    register               1
}
Hostgroup definitions for both the templates:

Code: Select all

define hostgroup {
    hostgroup_name    CP_Windows_MS_SQL_Servers
    alias             CP Windows MS SQL Servers
    members      host1, host2,host3, etc.
}


define hostgroup {
    hostgroup_name    CP_Windows_Servers
    alias             All CP Windows Servers
    members host1, host2,host3, etc.
Locked