12c cloud control backup metric extension - exported code

Another improvement in 12.1.0.3 and metric extensions seems to be the ability to export/import metric definitions which should mean that i can share the defintion with you to be used on your system should you wish. Unfortunately however i can't upload files directly to blogger (it's just a zip with some xml in) but what i can do it post the source from within those files to allow you to recreate it...long winded but at least it means it can be done

The zip file contains the following structure:






So if you create all those directories to start with and then I'll paste the xml here to create the individual files (there are only three of them)

top level file you can see above is called mea.xml and contains:


<MetricExtensionArchive name="MEAME$7-DAY-BACKUP-CHECK">
<MetricExtension name="ME$7-DAY-BACKUP-CHECK" type="oracle_database" version="1" display_name="7-DAY-BACKUP-CHECK" description="Check how many days since last full (level 0) backup" version_comment=" " metadata_digest="282914cf4a8084e6069581b8ba582947" coll_digest="babf523477800879bb820ecaf9616029" attach_digest="d41d8cd98f00b204e9800998ecf8427e">
</MetricExtension>
</MetricExtensionArchive>


collection contains 1 file called ME#24#7-DAY-BACKUP-CHECK.xml contents of which are:


<TargetCollectionExt EXT_NAME="ME$7-DAY-BACKUP-CHECK" EXT_VERSION="1" TARGET_TYPE="oracle_database"><CollectionItem NAME="ME$7-DAY-BACKUP-CHECK" UPLOAD="YES">
    <Schedule>
        <IntervalSchedule INTERVAL="15" TIME_UNIT="Min"/>
    </Schedule>
    <MetricColl NAME="ME$7-DAY-BACKUP-CHECK">
        <Condition COLUMN_NAME="DAYS-SINCE-BACKUP" CRITICAL="9" WARNING="8" OPERATOR="GT" OCCURRENCES="1" MESSAGE="The value of %columnName% is %value%" MESSAGE_NLSID="EMAGENT_DEFAULT_MESSAGE" CLEAR_MESSAGE="Alert for %columnName% is cleared" CLEAR_MESSAGE_NLSID="EMAGENT_DEFAULT_NO_ROW_CLEAR_MESSAGE"/>
    </MetricColl>
</CollectionItem>
</TargetCollectionExt>


and the final file is in metadata and called ME#24#7-DAY-BACKUP-CHECK.xml


<TargetMetadataExt EXT_NAME="ME$7-DAY-BACKUP-CHECK" EXT_VERSION="1" TARGET_TYPE="oracle_database"><Metric NAME="ME$7-DAY-BACKUP-CHECK" TYPE="TABLE">
<Display>
<Label NLSID="NLS_METRIC_oracle_databaseME$7-DAY-BACKUP-CHECK">7-DAY-BACKUP-CHECK</Label>
<Description NLSID="NLS_DESCRIPTION_oracle_databaseME$7-DAY-BACKUP-CHECK">Check how many days since last full (level 0) backup</Description>
</Display>
<TableDescriptor>
<ColumnDescriptor NAME="DAYS-SINCE-BACKUP" TYPE="NUMBER">
<Display>
<Label NLSID="NLS_COLUMN_oracle_databaseME$7-DAY-BACKUP-CHECKDAYS-SINCE-BACKUP">DAYS-SINCE-BACKUP</Label>
</Display>
<CategoryValue CLASS="Default" CATEGORY_NAME="Availability">
</CategoryValue>
</ColumnDescriptor>
</TableDescriptor>
<QueryDescriptor FETCHLET_ID="SQL">
<Property NAME="STATEMENT" SCOPE="GLOBAL" OPTIONAL="TRUE">  select min  (sysdate-bjd.start_time)
  from v$rman_backup_job_details bjd ,v$backup_set_details bsd
  where bsd.session_recid=bjd.session_recid
  and bsd.session_key=bjd.session_key
  and bsd.SESSION_STAMP=bjd.SESSION_STAMP
  and bsd.BACKUP_TYPE||bsd.INCREMENTAL_LEVEL='D0'
  and bjd.status='COMPLETED'
</Property>
<Property NAME="MachineName" SCOPE="INSTANCE" OPTIONAL="TRUE">MachineName</Property>
<Property NAME="Port" SCOPE="INSTANCE" OPTIONAL="TRUE">Port</Property>
<Property NAME="SID" SCOPE="INSTANCE" OPTIONAL="TRUE">SID</Property>
<Property NAME="UserName" SCOPE="INSTANCE" OPTIONAL="TRUE">UserName</Property>
<Property NAME="password" SCOPE="INSTANCE" OPTIONAL="TRUE">password</Property>
<Property NAME="Role" SCOPE="INSTANCE" OPTIONAL="TRUE">Role</Property>
<CredentialRef NAME="SQLCreds"></CredentialRef>
</QueryDescriptor>
</Metric>
</TargetMetadataExt>


So you should be able to reconstruct the zip and just import it into your system.

Now i just need to find a way of making the zip available without all this messing about....

Update i found out a way to do it with google sites - so here is the direct link to the zip:

metric extension zip file

Comments