Configuration

Once you have installed the Observer Agent, you need to configure it to connect to your Prometheus instance and Observer Cloud.

Environment Variables

The agent is configured using environment variables. Below are the available options:

  • Name
    AGENT_KEY
    Type
    string
    Description

    Required The authentication key for your agent. Obtain this from the Observer dashboard.

  • Name
    PROMETHEUS_SERVER_URL
    Type
    string
    Description

    Required The URL of your Prometheus server (e.g., http://localhost:9090).

  • Name
    NO_TELEMETRY
    Type
    boolean
    Description

    Optional Disable telemetry reporting. Set to true to disable telemetry. Default: false.

  • Name
    PROMETHEUS_BASIC_AUTH_ENABLED
    Type
    boolean
    Description

    Optional Enable basic authentication for Prometheus.
    Default: false.

  • Name
    PROMETHEUS_USERNAME
    Type
    string
    Description

    Optional The username for Prometheus basic authentication.

  • Name
    PROMETHEUS_PASSWORD
    Type
    string
    Description

    Optional The password for Prometheus basic authentication.

  • Name
    VERBOSE
    Type
    boolean
    Description

    Optional Enable verbose logging for debugging.
    Default: false.

  • Name
    TELEMETRY_VERBOSE
    Type
    boolean
    Description

    Optional Enable detailed telemetry logs.
    Default: false.

  • Name
    CLOUD_SERVER_URL
    Type
    string
    Description

    Optional Override the Observer Cloud API URL.
    Default: https://use.observer.


Configuring the Agent

You can configure the agent using environment variables, a .env file, or by passing values in the command line.

Option 1: Using a .env File

Create a .env file in the agent directory:

AGENT_KEY=<your-agent-key>
PROMETHEUS_SERVER_URL=http://your-prometheus:9090
VERBOSE=true

Runtime

Running the Agent
node index.js

Option 2: Setting Environment Variables Manually

Set variables in your terminal before running the agent:

Linux/macOS

export AGENT_KEY=<your-agent-key>
export PROMETHEUS_SERVER_URL=http://your-prometheus:9090

Windows (cmd)

set AGENT_KEY=<your-agent-key>
set PROMETHEUS_SERVER_URL=http://your-prometheus:9090

Windows (PowerShell)

$env:AGENT_KEY="<your-agent-key>"
$env:PROMETHEUS_SERVER_URL="http://your-prometheus:9090"

Option 3: Passing Variables via Docker

You can also pass environment variables to the agent using the --env flag when running the container:

Run the Agent
docker run -d \
  -e AGENT_KEY=<your-agent-key> \
  -e PROMETHEUS_SERVER_URL=http://your-prometheus:9090 \
  observerhq/agent:latest

Option 4: Kubernetes Secret and Environment Variables

For Kubernetes, store sensitive values in a Secret.

Create secret
kubectl create secret generic observer-agent-secret --from-literal=AGENT_KEY=<your-agent-key>

Modify the Kubernetes manifest to use the secret and additional environment variables:

observer-agent-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: observer-agent
spec:
  replicas: 1
  template:
    spec:
      containers:
        - name: observer-agent
          env:
            - name: AGENT_KEY
              valueFrom:
                secretKeyRef:
                  name: observer-agent-secret
                  key: AGENT_KEY
            - name: PROMETHEUS_SERVER_URL
              value: http://your-prometheus:9090
          image: observerhq/agent:latest

Next Steps

To get started with the Observer Agent, follow these steps: