Template functionality make it possible to automate installation and configuration of jobs across the entire database farm you are managing.
There are 4 templates available in dbWatch Control Center:

  • Default (all platforms)
  • Test (MS SQL Server)
  • Test (Oracle)
  • Maintenance (MS SQL Server)

To be able to create your own templates a json file (“job_templates.json “) must exist in the “config/server” directory (“C:\ProgramData\dbWatchControlCenter\config\server”).

You can copy the default template file which is located in the following directory:
C:\ProgramData\dbWatchControlCenter\archives\no.dbwatch.resources\resources_1.zip\no.dbwatch.resources.archive_version\templates\

The file has the following format

In this example there are two templates:
1. MS SQL Server test
2. Oracle test

Each “template” has a list of jobs associated with it, and each job is identified by “group” and “artifactid” which combined is a unique value for each job that exists.

A great way to create such a list of jobs (which you can then link to a specific “template”) is to install all jobs you want on an instance and then use FDL to list all “artifactid” values. In other words, use the instance as a template.
First install all relevant jobs (in this example there are 7 jobs).

And then run a FDL query:

Remember to remove the version number when copying the “artifact” values to the job_templates.json file.
A template can contain jobs from several database platforms (like template “Default (all platforms)”), and of course only jobs that are compatible with the instance are installed. In addition, one must remember that an instance has a license “attached” to it, which in turn affects which jobs are allowed to be installed.

In order to install jobs from a template on a specific instance, a metadata (“jobtemplate”) must be defined on this instance with the value that refers to the template name.

When you install dbWatch jobs using template there are 3 different options regarding what to do with jobs which are already installed on the instance.
- Keep
- Uninstall
- Disable
The default value is “keep” which means that jobs which are already installed will be unaffected. If you want to uninstall all jobs which are not specified in a template you have to add a metadata “jobtemplatemode” with value “uninstall”.

Both meta data (“jobemplate” and “jobtemplatemode”) can be set using “Manage Jobs” GUI. For each instance go to the “Template” tab and specify template name and installation mode, and then click save. It is also possible to deploy several templates to one instance. In that case jobs from all templates will be merged.

In addition to the job name in a template, it is possible to specify schedule and parameter values for each job if you want to change the default values.
In the example below, the schedule and parameters for the job “Database status” will be changed.

If you are going to add templates to several hundred of instances, we recommend to use “Edit metadata” GUI.
Go to the main menu, select “Server”, “Server configuration”, and then “Edit metadata”

Then select Dictionary «Job Templates»

In this dictionary, two metadata are defined, “jobtemplate” with values that refer to all template names found in the job_templates.json file, and “jobtemplatemode” with three values, keep, uninstall and disable.
In Metadata Editor you can easily add metadata to many instances in the same view.
Select the correct “Key”, then “Mode”. If you select “Single” mode, you must select a value for each instance.
If you select “Multiple” mode, you can add a specific value to many instances at once.

It is important to remember that the instances, where you want to install jobs from a template, must have a “license”. If the “License” value is empty, it will not be possible to install any jobs at all.
The license (in this case “standard”) is also linked to a list of jobs that you are allowed to install on an instance. If, for example, template jobs (from the template “MS SQL Server test”) are not in the “standard” list, then no jobs from this template will be installed.

To trigger deployment of a template on an instance (or many instances) click on “Sync” in “Manage Jobs” GUI, or right click on “DomainControllerNode” and select “Trigger job sync”.

You can monitor deployment of templates in “Internal jobs” view.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment