Install on Ansible for Linux

This page provides instructions for installing the Observe Agent on Linux systems via Ansible to collect metrics, logs, and application telemetry—including OpenTelemetry traces—and forward them to Observe.

Install the Observe Agent

Before you begin, install Ansible on your control node.

Follow the instructions for your Linux environment:

Install the observe-agent package. You’ll need to first add the Observe yum repository to your trusted repositories in your yum.repos.d folder. Create package.yaml under /etc/ansible/roles/agent/tasks/.

- name : Install Observe Agent
  hosts: all
  become: yes
  tasks:
    - name: add observe-agent yum source
      ansible.builtin.yum_repository:
        name: observe
        description: Gemfury Private Repo
        baseurl: https://yum.fury.io/observeinc/
        mode: 0644
    - name: install observe-agent package
      yum:
        name: observe-agent
        state: latest
        update_cache: yes
        disable_gpg_check: yes

Use ansible-playbook to install the Observe Agent with package.yaml. Your ansible-playbook could be similar to the following one.

$ ansible-playbook --private-key observe-agent-test.pem /etc/ansible/roles/agent/tasks/package.yaml

PLAY [Install Observe Agent] ************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************
ok: [54.202.68.91]
ok: [35.87.95.246]

TASK [add observe-agent yum source] *****************************************************************************************************************
ok: [54.202.68.91]
ok: [35.87.95.246]

TASK [install observe-agent package] ****************************************************************************************************************
changed: [54.202.68.91]
changed: [35.87.95.246]

PLAY RECAP ******************************************************************************************************************************************
35.87.95.246               : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
54.202.68.91               : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Configure the Observe Agent

Follow the instructions for your Linux environment.

Create config.yaml under /etc/ansible/roles/agent/tasks/.

- name : Config Observe Agent
  hosts: all
  become: yes
  tasks:
    - name: install observe-agent.yaml
      ansible.builtin.template:
        src: ../templates/observe-agent.yaml.j2
        dest: /etc/observe-agent/observe-agent.yaml
        owner: root
        group: observe-agent
        mode: 0640

Create observe-agent.yaml.j2 under /etc/ansible/roles/agent/templates.

# Observe data token (ex: a1b2c3d4e5f6g7h8i9k0:l1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6)
token: "<YOUR_INGEST_TOKEN>"

# Target Observe collection url (ex: https://123456789012.collect.observeinc.com/)
observe_url: "<YOUR_OBSERVE_COLLECTION_ENDPOINT>"

health_check:
    enabled: true
    endpoint: localhost:13133
    path: /status

internal_telemetry:
    enabled: true
    metrics:
        enabled: true
        host: localhost
        port: 8888
        level: detailed
    logs:
        enabled: true
        level: ${env:OTEL_LOG_LEVEL}

# Debug mode - Sets agent log level to debug
debug: false

# collect metrics and logs pertaining to the agent itself
self_monitoring:
  enabled: true

# collect metrics and logs about the host system
host_monitoring:
  enabled: true
  # collect logs of all running processes from the host system
  logs:
    enabled: true
  metrics:
    # collect metrics about the host system
    host:
      enabled: true
    # collect metrics about the processes running on the host system
    process:
      enabled: false

# Enable forwarding of local app metrics and traces
forwarding:
  enabled: true
  metrics:
    output_format: otel

# otel_config_overrides:
#   exporters:
#     debug:
#       verbosity: detailed
#       sampling_initial: 5
#       sampling_thereafter: 200
#   service:
#     pipelines:
#       metrics:
#         receivers: [hostmetrics]
#         processors: [memory_limiter]
#         exporters: [debug]

Use ansible-playbook to configure the Observe Agent with config.yaml. Your ansible-playbook could be similar to the following one.

$ ansible-playbook --private-key observe-agent-test.pem /etc/ansible/roles/agent/tasks/config.yaml

PLAY [Config Observe Agent] *************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************
ok: [54.202.68.91]
ok: [35.87.95.246]

TASK [install observe-agent.yaml] *******************************************************************************************************************
changed: [54.202.68.91]
changed: [35.87.95.246]

PLAY RECAP ******************************************************************************************************************************************
35.87.95.246               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
54.202.68.91               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Start the Observe Agent

Follow the instructions for your Linux environment.

Create enable.yaml under /etc/ansible/roles/agent/tasks/.

- name : Start Observe Agent
  hosts: all
  become: yes
  tasks:
    - name: enable observe-agent
      systemd:
        enabled: true
        name: observe-agent
        state: started

Use ansible-playbook to start the Observe Agent with enable.yaml. Your ansible-playbook could be similar to the following one.

$ ansible-playbook --private-key observe-agent-test.pem /etc/ansible/roles/agent/tasks/enable.yaml

PLAY [Start Observe Agent] **************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************
ok: [54.202.68.91]
ok: [35.87.95.246]

TASK [enable observe-agent] *************************************************************************************************************************
changed: [35.87.95.246]
changed: [54.202.68.91]

PLAY RECAP ******************************************************************************************************************************************
35.87.95.246               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
54.202.68.91               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Send application data to Observe

Once the Observe Agent is deployed, configure your application instrumentation or set the OTEL_EXPORTER_OTLP_ENDPOINT environment variable to one of the following addresses to send application telemetry including traces to the Observe Agent.

📘

Note

When setting up the endpoint to send traces, make sure you use the path that your OTLP library requires. Some libraries need traces to go to /v1/traces, while others expect them at the root path /.

See APM instrumentation for more information about how to instrument your app.

Uninstall the Observe Agent

Follow the instructions for your Linux environment.

Create uninstall.yaml under /etc/ansible/roles/agent/tasks/.

- name : Uninstall Observe Agent
  hosts: all
  become: yes
  tasks:
    - name: stop observe-agent
      systemd:
        name: observe-agent
        state: stopped
    - name: purge observe-agent
      yum:
        name: observe-agent
        state: absent

Use ansible-playbook to start the Observe Agent with uninstall.yaml. Your ansible-playbook could be similar to the following one.


$ ansible-playbook --private-key observe-agent-test.pem /etc/ansible/roles/agent/tasks/uninstall.yaml

PLAY [Uninstall Observe Agent] **********************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************
ok: [54.202.68.91]
ok: [35.87.95.246]

TASK [stop observe-agent] ***************************************************************************************************************************
ok: [54.202.68.91]
ok: [35.87.95.246]

TASK [purge observe-agent] **************************************************************************************************************************
changed: [54.202.68.91]
changed: [35.87.95.246]

PLAY RECAP ******************************************************************************************************************************************
35.87.95.246               : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
54.202.68.91               : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Upgrade the Observe Agent

Create upgrade.yaml under /etc/ansible/roles/agent/tasks/.

- name : Upgrade Observe Agent
  hosts: all
  become: yes
  tasks:
    - name: upgrade observe-agent package
      yum:
        name: observe-agent
        disable_gpg_check: yes
        state: latest
        update_cache: yes
    - name: restart observe-agent
      systemd:
        enabled: true
        name: observe-agent
        state: restarted

Use ansible-playbook to upgrade and restart the Observe Agent with upgrade.yaml. Your ansible-playbook could be similar to the following one.

$ ansible-playbook --private-key observe-agent-test.pem /etc/ansible/roles/agent/tasks/upgrade.yaml

PLAY [Upgrade Observe Agent] *****************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************
ok: [35.87.95.246]
ok: [54.202.68.91]

TASK [upgrade observe-agent package] *********************************************************************************************************************************************************************************************
ok: [54.202.68.91]
ok: [35.87.95.246]

TASK [restart observe-agent] *****************************************************************************************************************************************************************************************************
changed: [54.202.68.91]
changed: [35.87.95.246]

PLAY RECAP ***********************************************************************************************************************************************************************************************************************
35.87.95.246               : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
54.202.68.91               : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

What’s Next

Use both the Log Explorer and the Metric Explorer to monitor your systems. To analyze your trace data, explore both the Trace Explorer and the Service Explorer.