Database Reference
In-Depth Information
Listing 10-8.
<TargetMetadata>
Element
<TargetMetadata META_VER="1.8" TYPE="sample_host1">
<Display>...</Display>
<Metric>...</Metric>
......
<Metric>...</Metric>
<InstanceProperties>...</InstanceProperties>
</TargetMetadata>
The top-level element
TargetMetadata
includes a unique target type ID
"sample_host1"
in the
TYPE
attribute,
and metadata version
"1.8"
as the
META_VER
attribute. You should change the version number if you change the file.
When EM12c detects that the target type version has changed, it will reload the new metadata. I've spent countless
hours troubleshooting why my plug-in didn't work after I updated the metadata definition to simply find out later that
I missed changing the
META_VER
attribute. When a newer version of the plug-in is deployed, EM12c analyzes whether
the metadata version has changed and skips some updates internally if
META_VER
is unchanged in the new target type
metadata definition.
Note that the examples packaged with the EDK, such as
sample_host1
, reference the XML DataType Definition
(DTD)
$OMS_HOME/sysman/admin/dtds/TargetMetadata.dtd
in the comments. This is an old definition from 10g/11g
Grid Control that is not only old-style but also outdated. Use the XML Schema-based API reference in
<EDK>/doc/partnersdk/mrs/emcore/targetType
. For example, the
TargetMetadata
root element is described in
<EDK>/doc/partnersdk/mrs/emcore/targetType/noNamespace/element/TargetMetadata.html
.
The children of the
TargetMetadata
element normally include three elements:
Display
,
Metric
, and
InstanceProperties
.
Display
First, let's examine the
Display
element. This element is used solely for storing properties that indicate how a
component defined by the parent element is displayed in the EM12c console. You will see the
Display
element
present under almost any other element of the target type metadata that has some visibility in the user interface. In
this case, it's the target type itself, and the
Display
element defines how the target type is displayed. In its simplest
form, the
Display
element will contain the single element
Label
with the content used to display the target type in
the console, as in Listing 10-9. The optional
NLSID
attribute of the
Label
is a unique identifier that can be used for
translation of the console user interface associated with this target type to other languages. If you specify it, make a
habit of prefixing the
NLSID
with the target type ID so that it's unique across all possible plug-ins (since your target
type ID is unique, you just need to make sure that all your
NLSID
s are unique within your own target type). The
Display
element can have additional elements in it, depending on the context, as you will see later in this chapter.
Listing 10-9.
<Display> Element
<Display>
<Label NLSID="hs_displayname">Sample Plugin Host 1</Label>
</Display>
Note that the order of the elements in the target type metadata XML file is important;
Metric
elements must
always precede the
InstanceProperties
element. Next you will look at the
InstanceProperties
structure, as it will
later be useful in understanding metrics and how they are collected.