Resource Definition Examples

In this example, there are 3 new resources being defined:
  • MyUserName
  • MyServerName
  • MyServerAccess

The 3 new resources will be collected in addition to the base resources.

This configuration file is applicable for Weblogic and Tomcat running on Linux and Windows.

  • The MyUserName resource is collected from the environment properties either in Windows or Linux.
  • The MyServerName resource is collected from either Weblogic or Tomcat using their respected mbean followed by the regex filter.
  • The MyServerAccess resource is a string created with the the value of MyServerName and MyUserName resources, and also, the value of Hostname resource from base default resources.

Example:

RESOURCE:
    MyServerAccess:
        property: my.server.access
        scalar: string
        source:
          - type: value
            value: ${com.oracle.apm.agent.resource.hostname}_${my.username}_${my.server.name}
    MyUserName:
        property: my.username
        scalar: string
        source:
          # Windows user name
           - type: property
             key: USERNAME
          # Linux user name
          - type: property
            key: USER
    MyServerName:
        property: my.server.name
        scalar: string
        source:
            # Weblogic server name
            - type: mbean
              mbean_name: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean
              value_path: ServerRuntime/WeblogicVersion
              regex: (\D+)?([\d\.]+).*
              regex_group: 1
            # Tomcat server name
            - type: mbean
              mbean_name: Catalina:type=Server
              value_path: serverInfo
              regex: (.*)/(.*)
              regex_group: 1
    MySpecial:
        property: my.special
        scalar: string