29.10 Configuring a Service Using the Command Line Interface

Using the Command Line Interface, you can define service targets, templates and set up incidents. EMCLI is intended for use by enterprise or system administrators writing scripts (shell/batch file, perl, tcl, php, etc.) that provide workflow in the customer's business process. EMCLI can also be used by administrators interactively, and directly from an operating system console. Refer to Enterprise Manager Command Line Interface Guide for details.

Samples EMCLI templates to create a Web transaction and an ATS service test are shown below.

Example 29-1 Web Transaction Service Test Template

<?xml version = '1.0' encoding = 'UTF-8'?> <transaction-template 
template_type="generic_service" xmlns="template">
   <variables>
      <variable name="HOST1" value="linuxserver26.myco.com"/>
      <variable name="PORT1" value="5416"/>
      <variable name="PROTOCOL1" value="https"/>
   </variables>
   <transactions>
      <mgmt_bcn_transaction>
         <mgmt_bcn_txn_with_props>
            <mgmt_bcn_txn description="Test for checking the availability of EM Console/Website" is_representative="true" 
                          name="EM Console Service Test" monitoring="true" txn_type="HTTP"/>
            <properties>
               <property name="readTimeout" num_value="120000.0" prop_type="2" encrypt="false"/>
               <property name="Collection Interval" num_value="5.0" prop_type="2" encrypt="false"/>
               <property name="certValidationMode" string_value="1" prop_type="1" encrypt="false"/>
               <property name="maxDownloadSize" num_value="1.0E8" prop_type="2" encrypt="false"/>
               <property name="sensitiveValuesProtection" string_value="0" prop_type="1" encrypt="false"/>
               <property name="failureStringModes" string_value="regularText" prop_type="1" encrypt="false"/>
               <property name="UserAgent" string_value="Mozilla/4.0 (compatible;MSIE 6.0; Windows NT 5.1) OracleEMAgentURLTiming/3.0" prop_type="1" encrypt="false"/>
               <property name="successStringModes" string_value="regularText" prop_type="1" encrypt="false"/>
               <property name="variablesModes" string_value="urlEncode" prop_type="1" encrypt="false"/>
               <property name="content" string_value="0" prop_type="1"encrypt="false"/>
               <property name="AcceptLanguage" string_value="en" prop_type="1" encrypt="false"/>
               <property name="connectionTimeout" num_value="120000.0" prop_type="2" encrypt="false"/>
               <property name="useCache" string_value="yes" prop_type="1"encrypt="false"/>
               <property name="stringValidationMode" string_value="1" prop_type="1" encrypt="false"/>
               <property name="granularity" string_value="transaction" prop_type="1" encrypt="false"/>
               <property name="numThreads" num_value="4.0" prop_type="2" encrypt="false"/>
               <property name="retries" num_value="1.0" prop_type="2" encrypt="false"/>
               <property name="timeout" num_value="300000.0" prop_type="2" encrypt="false"/>
               <property name="retryInterval" num_value="5000.0" prop_type="2" encrypt="false"/>
            </properties>
            <per_bcn_properties/>
         </mgmt_bcn_txn_with_props>
         <steps_defn_with_props>
            <mgmt_bcn_step_with_props>
               <mgmt_bcn_step step_number="1" name="1.Access Logout page" step_type="HTTP"/>
               <properties>
                  <property name="req_mode" num_value="1.0" prop_type="2" encrypt="false"/>
                  <property name="http_method" string_value="G" prop_type="1" encrypt="false"/>
                  <property name="url" string_value="{PROTOCOL1}://{HOST1}:{PORT1}/em/console/logon/logoff?event=load" prop_type="1" encrypt="false"/>
               </properties>
            </mgmt_bcn_step_with_props>
         </steps_defn_with_props>
         <stepgroups_defn/>
         <txn_thresholds>
            <mgmt_bcn_threshold warning_threshold="6000.0" warning_operator="0" critical_threshold="12000.0" critical_operator="0" num_occurrences="1">
               <mgmt_bcn_threshold_key metric_name="http_response" metric_column="avg_response_time"/>
            </mgmt_bcn_threshold>
            <mgmt_bcn_threshold warning_threshold="0.0" warning_operator="1" critical_threshold="0.0" critical_operator="1" num_occurrences="1">
               <mgmt_bcn_threshold_key metric_name="http_response" metric_column="status"/>
            </mgmt_bcn_threshold>
         </txn_thresholds>
         <step_thresholds/>
         <stepgroup_thresholds/>
      </mgmt_bcn_transaction>
   </transactions>
</transaction-template>

Example 29-2 ATS Service Test Template

<?xml version = '1.0' encoding = 'UTF-8'?>
<transaction-template template_type="generic_service" xmlns="template"> 
   <variables/>
   <transactions>
      <mgmt_bcn_transaction>
         <mgmt_bcn_txn_with_props>
            <mgmt_bcn_txn is_representative="true" name="ATS Page"           monitoring="true" txn_type="OATS"/>
            <properties>
               <property name="Collection Interval" num_value="5.0" prop_type="2"  encrypt="false"/>
               <property name="scriptDescription" string_value="[1] SignIn&#xA;[2] Welcome&#xA;[3] Single Sign-Off&#xA;[4] Sign In" prop_type="1"encrypt="false"/>
               <property name="fileUploadTime" string_value="2012-08-0908:47:22.0" prop_type="1" encrypt="false"/>
               <property name="OpenScriptJwgName" string_value="ATKHomepage.zip" prop_type="1" encrypt="false"/>
               <property name="usageOptions" string_value="userDefined" prop_type="1" encrypt="false"/>
               <property name="fileSize" string_value="41368" prop_type="1" encrypt="false"/>
               <property name="beaconDistributionOverride" string_value="AtsCredentials=1" prop_type="1" encrypt="false"/>
               <property name="FilePropertyValue" prop_type="7" encrypt="false"/>
               <property name="databankFilesJar" prop_type="7" encrypt="false"/>
               <property name="databankFiles" string_value="AtsCredentials,AtsCredentials.csv,3;" prop_type="1" encrypt="false"/>
               <property name="granularity" string_value="transaction" prop_type="1" encrypt="false"/>
               <property name="databankValues" string_value="people.firstname=yang.,people.lastName=wang,middle.middlename_col=x." prop_type="1" encrypt="false"/>
               <property name="modules" string_value="oracle.oats.scripting.modules.utilities;version=2.4.0&#xA;oracle.oats.scripting.modules.http;version=2.4.0&#xA;" 
                         prop_type="1" encrypt="false"/>
               <property name="databankAliasMapping" string_value="AtsCredentials=AtsCredentials.csv" prop_type="1" encrypt="false"/>
               <property name="defaultCLIOptions" string_value="-dboptions*:1:FIRST_RECORD_ONLY -jwg ATKHomepage.jwg -noReport true" prop_type="1"
                         encrypt="false"/>
            </properties>
            <per_bcn_properties/>
         </mgmt_bcn_txn_with_props>
         <steps_defn_with_props>
            <mgmt_bcn_step_with_props>
               <mgmt_bcn_step step_number="1" name="[1] Sign In" step_type="OATS"/>
               <properties>
                  <property name="url" string_value="http:://www.test.com/test1" prop_type="1" encrypt="false"/>
               </properties>
            </mgmt_bcn_step_with_props>
            <mgmt_bcn_step_with_props>
               <mgmt_bcn_step step_number="2" name="[2] Welcome" step_type="OATS"/>
               <properties>
                  <property name="url" string_value="http:://www.test.com/test2" prop_type="1" encrypt="false"/>
               </properties>
            </mgmt_bcn_step_with_props>
            <mgmt_bcn_step_with_props>
               <mgmt_bcn_step step_number="3" name="[3] Single Sign-Off" step_type="OATS"/>
               <properties>
                  <property name="url" string_value="http:://www.test.com/test3" prop_type="1" encrypt="false"/>
               </properties>
            </mgmt_bcn_step_with_props>
            <mgmt_bcn_step_with_props>
               <mgmt_bcn_step step_number="4" name="[4] Sign In" step_type="OATS"/>
               <properties>
                  <property name="url" string_value="http:://www.test.com/test4" prop_type="1" encrypt="false"/>
               </properties>
            </mgmt_bcn_step_with_props>
         </steps_defn_with_props>
         <stepgroups_defn/>
         <txn_thresholds>
            <mgmt_bcn_threshold warning_threshold="0.0" warning_operator="1" critical_threshold="0.0" critical_operator="1" num_occurrences="1">
               <mgmt_bcn_threshold_key metric_name="openscript_response" metric_column="status"/>
            </mgmt_bcn_threshold>
         </txn_thresholds>
         <step_thresholds/>
         <stepgroup_thresholds/>
      </mgmt_bcn_transaction>
   </transactions>
</transaction-template>