Assign Service Templates to Pre-Existing Service Checks

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
hudbaylicensing
Posts: 27
Joined: Fri Jul 13, 2012 11:48 am

Assign Service Templates to Pre-Existing Service Checks

Post by hudbaylicensing »

Is there a way to assign a Service template to service checks already created?

Everytime we need to change password for our WMI checks, we have to go through each and every service and update it there - only recently read about service templates and have created WMI Service Template for each of the AD domains that we have (currently have 3 AD domains companywide) but I am unsure how to apply these to service checks we have already created.

Thanks,
Marc
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Assign Service Templates to Pre-Existing Service Checks

Post by slansing »

All you need to do is assign that template to your services, make sure that what you want to be inherited from the template is not already defined on the target object itself or it will ignore the template for that option.
hudbaylicensing
Posts: 27
Joined: Fri Jul 13, 2012 11:48 am

Re: Assign Service Templates to Pre-Existing Service Checks

Post by hudbaylicensing »

Thanks for the info - how exactly would I assign it to my existing service checks? Maybe I am doing it wrong:

1. Go to CCM
2. Services in the Monitoring section
3. Find my services that I want to assign the template to and click on it (for example a C: Drive Usage check)
4. Click on Manage Templates button.\
5. Find the new Template I created, select it and click Add Selected.
6. Then remove the original template that was applied.
7. Click Close
8. Remove values in $ARG1$ and $ARG2$.
9. Click Save, then Apply Configuration.

I do not receive any errors, but it doesn't seem to apply the template to it and now just acts as if a username and password has not been specified.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Assign Service Templates to Pre-Existing Service Checks

Post by tmcdonald »

Is the password defined in the template? If not then it would need to be set individually for each service.
Former Nagios employee
hudbaylicensing
Posts: 27
Joined: Fri Jul 13, 2012 11:48 am

Re: Assign Service Templates to Pre-Existing Service Checks

Post by hudbaylicensing »

Yes, it is defined in the template.

One thing, this is a WMI disk space check, it still has $ARG3$ and $ARG4$ values on the service check (critical and warnings). Should I move these args to template as well?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Assign Service Templates to Pre-Existing Service Checks

Post by lmiltchev »

Can you post the service, template, and command definitions? (hide sensitive info)
Be sure to check out our Knowledgebase for helpful articles and solutions!
hudbaylicensing
Posts: 27
Joined: Fri Jul 13, 2012 11:48 am

Re: Assign Service Templates to Pre-Existing Service Checks

Post by hudbaylicensing »

Is there a way to export the definitions? Not sure how...
hudbaylicensing
Posts: 27
Joined: Fri Jul 13, 2012 11:48 am

Re: Assign Service Templates to Pre-Existing Service Checks

Post by hudbaylicensing »

Service Template:

define service {
name xiwizard_windowswmi_service_Hudbay
service_description Hudbay WMI Service Disk Usage Checks
use xiwizard_windowswmi_service_Hudbay
check_command check_xi_service_wmiplus!MyAD2\Administrator!MyPassword!!!!!!
register 0

}

Service:

define service {
host_name hbffc130.hudbay.corp
service_description Drive C: Disk Usage
use xiwizard_windowswmi_service_Hudbay
check_command check_xi_service_wmiplus!!!checkdrivesize!-a 'C': -w '80' -c '95'!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contact_groups IT infrastructure Team
_xiwizard windowswmi
register 1

Command:

define command {
command_name check_xi_service_wmiplus
command_line $USER1$/check_wmi_plus.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -m $ARG3$ $ARG4$
}
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Assign Service Templates to Pre-Existing Service Checks

Post by lmiltchev »

Try:

Service Template:

Code: Select all

define service {
name xiwizard_windowswmi_service_Hudbay
service_description Hudbay WMI Service Disk Usage Checks
use xiwizard_windowswmi_service_Hudbay
check_command check_xi_service_wmiplus!'username'!'password'!checkdrivesize!-a 'C': -w '80' -c '90'
register 0
}
Service:

Code: Select all

define service {
host_name hbffc130.hudbay.corp
service_description Drive C: Disk Usage
use xiwizard_windowswmi_service_Hudbay
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contact_groups IT infrastructure Team
_xiwizard windowswmi
register 1
}
Command:

Code: Select all

define command {
command_name check_xi_service_wmiplus
command_line $USER1$/check_wmi_plus.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -m $ARG3$ $ARG4$
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
hudbaylicensing
Posts: 27
Joined: Fri Jul 13, 2012 11:48 am

Re: Assign Service Templates to Pre-Existing Service Checks

Post by hudbaylicensing »

That worked! Thanks so much!
Locked