Dynamic properties
Local dynamic properties are defined in XML files located in the [Workarea dir]/data/resources/properties_local directory.
You cannot add files to this directory manually, but import them by placing them in the [Workarea dir]/data/resources/import_area directory.
A property XML file can contain an asproperties section with resource metadata, followed by one or more property definitions. The following example is adapted from the SQL Server “Page verify option” property supplied with dbWatch Control Center. It uses an existing job table and is intended to illustrate the XML format, not as a standalone property to install on every SQL Server instance.
<?xml version='1.0' encoding='utf-8'?>
<properties>
<asproperties>
<name>Page verify option</name>
<version>1.0</version>
<company>dbwatch.no</company>
<group>no.dbwatch</group>
<artifactid>sqlserver_page_verify_option_prop</artifactid>
</asproperties>
<comp-query><![CDATA[./instance[databasetype='sqlserver']->i/instance[maj_version > 2008] ]]></comp-query>
<property>
<key>page_verify_option_change_count</key>
<key>page_verify_option_last_change</key>
<compatability>instance[databasetype='sqlserver']/task[name='Page verify option']</compatability>
<parameters>
<parameter>
<default></default>
<name>engine</name>
<type>string</type>
<description>The monitoring engine database</description>
</parameter>
</parameters>
<value engine="sql"><![CDATA[
select count(*), max(change_date)
from [{$engine}]..dbw_page_verify_option_histr
]]></value>
<valid-for>48h</valid-for>
</property>
</properties>
The main fields are:
- asproperties : Metadata identifying the resource, including name, version, company, group and artifact ID.
- comp-query : A resource-level FDL query restricting where the property definitions apply.
- property : Defines one or more dynamic property values.
- key : The name that identifies a property (used in FDL queries). Multiple keys can be supplied when a query returns multiple columns.
- compatability : FDL query that defines the database instances or tasks that this property is compatible with.
- parameters : Optional parameters used when resolving a property value.
- value : A query or other expression that defines the property value.
- valid-for : How long this property can be cached. Format xh/xm/xs, examples “24h”, “15m”, “60s”. Hours/minutes/seconds cannot be combined, so “1m 30s” is not allowed and must be written as “90s”.
Note: The XML element is spelled compatability in dbWatch Control Center property definitions. Although compatibility is the correct English spelling, use compatability in the XML.
The value tag has an engine attribute that specifies the type of the contained code. Legal values are currently: sql, dbwql, ssh, javascript.
There can be several value tags; they form a sequence of steps that are executed when resolving the property.
Examples from bundled resources
Additional examples are available in the property resources supplied with dbWatch Control Center. On Windows, these can be found in a versioned ZIP archive under:
C:\Program Files\dbWatchControlCenter\features\no.dbwatch.resources\
Inside the archive, look for the no.dbwatch.resources.archive_version/properties/ directory. The ZIP filename varies between builds. Use these files as examples rather than editing bundled resources directly, since software upgrades may replace them.