Bulk change service template
Bulk change service template
Hi,
How can I bulk change service templates? (MySQL commands are good too)
Thanks.
How can I bulk change service templates? (MySQL commands are good too)
Thanks.
Re: Bulk change service template
The bulk modification tool only supports host and service objects. So an sql command may be the only way to bulk modify a template. What are you looking to alter?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Bulk change service template
My configuration has about 1000 services which were created without a relevant template.
I'd like to start working with templates for those services.
I've already bulk-modified before using MySQL and have no problem running some queries.
Thanks.
I'd like to start working with templates for those services.
I've already bulk-modified before using MySQL and have no problem running some queries.
Thanks.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Bulk change service template
We need to know what specific changes you wish to make to the database as we can not support certain alterations due to the high possibility your database could be ruined. Are you looking to make changes to notification options for your templates, or something along those lines? I can only think of a few things you would wish to change as templates by design are singular configurations used to push that configuration to multiple hosts/services so identical templates would defeat the purpose in most cases.What are you looking to alter?
Re: Bulk change service template
You've completely misunderstood me, but I guess it's my fault 
I don't wish to change any templates, I'd just like to apply templates over a bulk of services.
Is this possible?
I don't wish to change any templates, I'd just like to apply templates over a bulk of services.
Is this possible?
Re: Bulk change service template
Did you utilize wizards at all for the creation of these services? If so, there would be a template assigned to those services automatically. If you want to add templates to existing services that currently don't utilize them, you'll have to manually add them at the moment. It's important to note that config directives in the service definitions will override any templates, but you can use the Bulk Modification tool to clear many of the values in a list of services. This will allow those services to inherit from the template.
See the following doc on more detailed info about object inheritance.
http://nagios.sourceforge.net/docs/3_0/ ... tance.html
You could also look at Service->hostgroup assignments if you have a lot of common services across your many hosts. This would allow you to manage one service definition for an entire group of hosts. You can also apply a single service definition to a list of hosts.
See the following doc on more detailed info about object inheritance.
http://nagios.sourceforge.net/docs/3_0/ ... tance.html
You could also look at Service->hostgroup assignments if you have a lot of common services across your many hosts. This would allow you to manage one service definition for an entire group of hosts. You can also apply a single service definition to a list of hosts.
Re: Bulk change service template
So I can't run a MySQL command to apply templates to services?
Thanks
Thanks
Re: Bulk change service template
We don't recommend making changes directly in the database. Any issues on your Nagios XI server, caused by running MySQL commands this way would make your XI instance NOT supportable.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Bulk change service template
I know, that's why I keep backups
Please share the command for applying templates over a service.
Thanks.
Please share the command for applying templates over a service.
Thanks.
Re: Bulk change service template
Again, this is most definitely a "Do this at your own risk!" scenario.
I'd suggest clearing all existing template relationships first for any affect services. These are starter queries, so you can decide how to best implement them.
foreach service:
// <sort_order> should be 1 if you're only using 1 template on a service
I'd suggest clearing all existing template relationships first for any affect services. These are starter queries, so you can decide how to best implement them.
foreach service:
Code: Select all
DELETE FROM `tbl_lnkServiceToServicetemplate` WHERE `idMaster`=<service_id>;Code: Select all
INSERT INTO `tbl_lnkServiceToServicetemplate`
(`idMaster`,`idSlave`,`idTable`,`idSort`)
VALUES (<service_id>, <template_id>, 1 ,<sort_order> );