Page 1 of 2
NagiosXI - Service template not working
Posted: Thu Dec 03, 2020 6:06 am
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
}
Re: NagiosXI - Service template not working
Posted: Thu Dec 03, 2020 5:04 pm
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?
Re: NagiosXI - Service template not working
Posted: Thu Dec 10, 2020 5:45 pm
by dchurch
Just checking in since we haven't heard from you in a while. Did you get this working?
Re: NagiosXI - Service template not working
Posted: Wed Jan 20, 2021 10:48 am
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
Re: NagiosXI - Service template not working
Posted: Thu Jan 21, 2021 10:31 am
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.
Re: NagiosXI - Service template not working
Posted: Fri Jan 29, 2021 6:15 am
by Bala.Mutyam
PM'd system profile.
Re: NagiosXI - Service template not working
Posted: Fri Jan 29, 2021 3:13 pm
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.
Re: NagiosXI - Service template not working
Posted: Mon Feb 01, 2021 12:35 pm
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
Re: NagiosXI - Service template not working
Posted: Mon Feb 01, 2021 5:23 pm
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
Re: NagiosXI - Service template not working
Posted: Mon Feb 08, 2021 7:57 am
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.