Configuration

AppOptics Host Agent’s main configuration file is /opt/appoptics/etc/config.yaml. The configuration file uses the YAML file format, it is read on agent startup.

Note

NOTE: Updates to configuration file take effect only after restarting the agent.

Publishing to AppOptics

The information required for publishing metrics by AppOptics Host Agent is located in the following section:

plugins:
  include: /opt/appoptics/etc/plugins.d
  publisher:
    publisher-appoptics:
      all:
        token: <api_token>
        url: "https://api.appoptics.com/v1/measurements"

The <api_token> contains the metrics API token.

Publishing through a proxy

Host Agent can publish metrics through a SOCKS5 proxy or HTTP proxy.

Configuration proxy_url sets the url used for accessing the proxy server. If the proxy server requires authentication, then you can specify the user by using proxy_user and the password by using proxy_password.

plugins:
  include: /opt/appoptics/etc/plugins.d
  publisher:
    publisher-appoptics:
      all:
        token: "c6260446e584d8afcafcafcafcafcafcafc112233441128e68ef4ea3f2b289d50"
        url: "https://api.appoptics.com/v1/measurements"

        # Enable proxy configuration
        proxy_url: "<proxy-type>://<proxy-address>:<port>"
        proxy_user: <username>
        proxy_password: <password>

where <proxy-type> can be socks5 for a SOCKS5 proxy or http for a HTTP proxy.

Proxy configuration can be also specified using ALL_PROXY and NO_PROXY enviroment variables.

ALL_PROXY environment variable is used to specify the URL used for accessing the proxy. The format for ALL_PROXY is:

export ALL_PROXY="<proxy-type>://<user>:<password>@<proxy-address>:<port>"

or without authentication

export ALL_PROXY="<proxy-type>://proxy-address>:<port>"

NO_PROXY environment variable is used to specify the URLs that should be excluded from proxy-ing. This should be a comma-separated list of host names, domain names, or a mixture of both. Asterisks can be used as wildcards, but other clients may not support that. Domain names may be indicated by a leading dot. NO_PROXY environment variable is only used when ALL_PROXY environment variable is specified.

For example:

export NO_PROXY="169.254.169.254, localhost, 127.0.0.1, .domain.com"

When running on an EC2 instance, the address 169.254.169.254 is specified to allow EC2 queries to reach local instance instead of the proxy server.

The ALL_PROXY and NO_PROXY environment variables can be specified inside on /etc/defaults/appoptics-snapteld or /etc/sysconfig/appoptics-snapteld files depending on the operating system. Alternatively, they could be specified in the appoptics user profile used for running host agent service or at system level.

SNAPTELD_OPTS=''
SNAPTELD_EXTRA_OPTS=''
export ALL_PROXY="<proxy-type>://<user>:<password>@<proxy-address>:<port>"
export NO_PROXY="169.254.169.254, localhost, 127.0.0.1, .domain.com"

If proxy_url, proxy_user, or proxy_password are specified inside /opt/appoptics/etc/config.yaml configuration file, their values will overwrite values specified by ALL_PROXY environment variable.

Detecting if running on EC2 (OpenStack) instance

Host Agent is able to detect if it is running on EC2 or OpenStack instance by querying Instance Metadata. By default, host agent timeout for qyerying is configured to 1s.

plugins:
  include: /opt/appoptics/etc/plugins.d
  publisher:
    publisher-appoptics:
      all:
        token: "c6260446e584d8afcafcafcafcafcafcafc112233441128e68ef4ea3f2b289d50"
        url: "https://api.appoptics.com/v1/measurements"

        ec2_check_timeout: "1s"

Publishing to a File

The /opt/appoptics/etc/plugins.d/publish-file.yaml.example file contains the information required to publish metrics to a file for debugging purpose:

publisher:
  file:
    all:
      file: "/tmp/appoptics-snaptel/published_metrics.log"

load:
  plugin: snap-plugin-publisher-aofile

Autoloading plugins and tasks

Configuration auto_discover_path sets the directory to auto load plugins and tasks on the start of the snapteld daemon.

auto_discover_path: /opt/appoptics/autoload

On install, only the Host Agent’s system metrics reporting is enabled via this mechanism.

Log level

The log_level setting controls logging verbosity. For example, to get detailed debug level output:

# 1 - Debug, 2 - Info, 3 - Warning, 4 - Error, 5 - Fatal.
# Default value is 3.
log_level: 1
log_path: /var/log/appoptics

Global Tags

The Host Agent generates one global tag common to all metrics named hostname which by default will be populated with the system’s host name. You also have the option to define a hostname alias in the config file. All metrics will then report with hostname and host_hostname_alias tags:

plugins:
include: /opt/appoptics/etc/plugins.d
publisher:
  publisher-appoptics:
    all:
      token: "c6260446e584d8afcafcafcafcafcafcafc112233441128e68ef4ea3f2b289d50"
      url: "https://api.appoptics.com/v1/measurements"
      hostname_alias: myhostname

If you want to add additional global tags you can add a tags: section that contains global tags that are applied to all collected metrics:

plugins:
  include: /opt/appoptics/etc/plugins.d
  publisher:
    publisher-appoptics:
      all:
        token: "c6260446e584d8afcafcafcafcafcafcafc112233441128e68ef4ea3f2b289d50"
        url: "https://api.appoptics.com/v1/measurements"
        # Set this option if you want a different "host" tag to be associated with the metrics you report.
        hostname_alias: myhostname
tags:
  # tags all metrics
  /:
    team: sre

The example above will result in three global tags: hostname, host_hostname_alias, and team.

Optional Metrics

The metrics that a Host Agent plugin reports are defined in the task YAML file. A task describes the how, what, and when of a Host Agent job. The task files for each plugin are stored under /opt/appoptics/etc/tasks.d/. In the task file, the directive

collect:
  metrics:

…describes which metrics to collect. For most of our integrations we have curated a subset of plugin metrics that we deemed the most important and have commented out the others. You’ll find those metrics listed under the “Optional Metrics” section in the Integration’s knowledge base article. For example, the task file for the Apache integration (/opt/appoptics/etc/tasks.d/task-aoapache.yaml) could include the following directive:

workflow:
  collect:
    metrics:
      /apache/BytesPerSec: {}
      /apache/workers/Open: {}
      /apache/workers/Closing: {}
      /apache/workers/Finishing: {}
      /apache/workers/Logging: {}
      /apache/workers/Reading: {}
      #/apache/CPULoad: {}

With this configuration, the BytesPerSec metric and five workers metrics will be loaded whereas the CPULoad metric will be ignored. To activate the CPULoad metric, simply uncomment the line and restart the daemon.

Metric Tags

You can use a Tags: section in the task YAML file to describe additional meta data for metrics. Tags can be described at the branch level, and all leaves of that branch will receive the given tag(s):

workflow:
  collect:
    metrics:
      /apache/BytesPerSec: {}
      /apache/workers/Open: {}
      /apache/workers/Closing: {}
      /apache/workers/Finishing: {}
      /apache/workers/Logging: {}
      /apache/workers/Reading: {}
      #/apache/CPULoad: {}
    tags:
      /apache/workers:
        type: worker
      /apache/workers/Logging:
        action: logging

With the above configuration all the workers metrics will have the type tag and only the Logging metric will also have the action tag.