create_service

Creates a service to be monitored by Enterprise Manager.

Format

emcli create_service
      -name='name'
      -type='type'
      -availType=test|system
      -availOp=and|or
      [-hostName=<host_name>
      [-agentURL=<agent_url>
      [-properties='pname1|pval1;pname2|pval2;...']
      [-timezone_region=<gmt_offset>]
      [-systemname=<system_name>]
      [-systemtype=<system_type>]
      [-keycomponents='keycomp1name:keycomp1type;keycomp2name:keycomp2type;...']
      [-beacons='bcn1name:bcn1isKey;bcn2name:bcn2isKey;...']
      [-input_file="template:Template file name]"]
      [-input_file="variables:Variable file name]"]
      [-sysAvailType=<availability_type>]

[ ]  indicates that the parameter is optional

Options

  • name

    Service name. Names cannot contain colons ( : ), semi-colons ( ; ), or any leading or trailing blanks.

  • type

    Service type.

  • availType

    Sets the availability to either test-based or system-based. If availability is set to test, template file, beacons, and variable are required arguments. If availability is set to system, systemname, systemtype, and keycomponents are required.

  • availOp

    Availability operator. If and, uses all key tests/components to decide availability. If or, uses any key tests/components to decide availability.

  • hostName

    Network name of the system running the Management Agent that is collecting data for this target instance.

  • agentURL

    URL of the Management Agent that is collecting data for this target instance. If you enter the host name, the Agent URL of the host is automatically entered in this field.

  • properties

    Name-value pair (that is, prop_name|prop_value) list of properties for the service instance.

  • timezone_region

    GMT offset for this target instance (-7 or -04:00 are acceptable formats).

  • systemname

    System name on which service resides.

  • systemtype

    Type of system for which you want to create the service.

  • keycomponents

    Name-type pair (that is, keycomp_name:keycomp_type) list of key components in the system that are used for the service.

  • beacons

    Name-isKey pairs that describe the beacons of the service. If isKey is set to Y, beacon is set as a key-beacon of the service. The service should have at least one key beacon if the availability is set to test-based.

  • input_file

    Template file name is the XML file that includes the template definition. Variable file defines the values for the template.

    For more information about the input_file parameter, see -input_file Syntax Guidelines.

  • sysAvailType

    Type of availability when the availType is system-based. Sets the availability to either system target directly or selected components of a system.

    If availability is set to 'system target directly,' the system needs to have availability[status] defined. systemname and systemtype are required parameters.

    If availability is set to 'selected components of a system,' systemname, systemtype and keycomponents are required parameters.

    If availability is set to 'system target directly,' and if the system does not have availability[status] defined, the availability set is invalid. Therefore, the only option that can be set is 'selected components of a system'.

Examples

Example 1

This example creates a generic service named my_service with specified properties on a generic system named my system. The availability is set as system-based, and the availability is based on system target status.

emcli create_service
      -name='my service' -type='generic_service' 
      -availType='system' -availOp='or' 
      			-sysAvailType='system target directly'
      -properties='prop1:value1; prop2:value2'
      -timezone_region='PST8PDT'
      -systemname='my system' -systemtype='generic_system'

Example 2

This example creates a generic service named my_service with specified properties on a generic system named my system with specified key components. The availability is set as system-based.

emcli create_service
      -name='my_service' -type='generic_service'
      -availType='system' -availOp='or'
      -properties='prop1:value1; prop2:value2'
      -timezone_region='PST8PDT'
      -systemname='my system' -systemtype='generic_system'
      -keycomponents='database:oracle_database; mytestbeacon:oracle_beacon'

Example 3

This example creates a timing based generic service test named my_service with specified properties on a generic system with specified key components.

  1. Create a service template:
    1. Go to EM, click Targets then Service. From Service Features click Service Templates.
    2. Click Create.
    3. Select the service target whose definition would be used to create the new service test via emcli.
    4. Click Continue, and provide the template name.

    In the Tests tab we can verify or modify other test related properties and(or) create an XML file with property name,value and password. The created template would be listed in Service Templatesunder Services.

  2. Extract the service template and save it to an xml file Using emcli.

    Enter the commands in EM OMS Host:

    <OMSHOME>/bin/emcli login -username=sysman
    emcli extract_template_tests -templateName="<Template Name>" -templateType="generic_service" -output_file="<PATH To>/oracle_sql_timing_template.xml"
  3. Open the xml file and modify the property value:
     <property name="SID" string_value="<User Defined>" prop_type="1" encrypt="false"/>
  4. Create a new generic service:
    1. Using the same template file:
      emcli create_service
            -name="my_service" -type="generic_service" 
            -availType="TESTS" -availOp="and" 
            -beacons="EM Management Beacon:Y" -input_file="<PATH To>/oracle_sql_timing_template.xml>"
    2. Using both template and variable file:
      emcli create_service 
            -name="my_service" -type="generic_service" 
            -availType="TESTS" -availOp="and" 
            -beacons="EM Management Beacon:Y" 
            -input_file="template:<Path To>/oracle_sql_timing_template_without_variables.xml" 
            -input_file="variables:<Path To>/oracle_sql_timing_template_variables.xml"