Skip to main content
The CostGraph Agent is a daemon that runs on your virtual machines and continuously reports resource and network usage to CostGraph. It collects:
  • Host metrics — CPU, memory, disk, and network utilization for the machine.
  • Container metrics and inventory — when a Docker or containerd runtime is present.
These stream to CostGraph, where they power:
  • VM inventory and cost — every host and its attached disks, with compute and storage cost attributed per VM, plus live utilization and status.
  • Rightsizing recommendations — resize suggestions from observed CPU and memory usage, including cheaper instance types across cloud providers.
  • Idle detection — VMs with consistently low CPU, memory, network, and disk activity are flagged to terminate.
  • Container and process insight — per-container metrics and the top processes driving usage on each host.
  • Cost anomalies — unusual spend or utilization changes surfaced automatically.

Prerequisites

  • A Linux host e.g Debian, Ubuntu, RHEL, Amazon Linux, Alpine etc (amd64 or arm64).
  • An API key from the CostGraph platform.
  • For network flow tracing, a root-privileged BTF-enabled kernel and a host-mounted cgroup v2 filesystem.

Installation

Pipe the installer to sh with your API key on the sh side of the pipe:
Or download, inspect, then run:
The installer detects your init system and registers the agent as a systemd or OpenRC service that starts on boot. It supports Debian, Ubuntu, RHEL, Amazon Linux, and Alpine, and installs the latest stable release by default. Your API key is stored in /etc/default/costgraph-agent (systemd) or /etc/conf.d/costgraph-agent (OpenRC).Pin a specific release with COSTGRAPH_AGENT_VERSION — see the changelog for available versions.Manage the service the usual way:
macOS support via Homebrew is coming soon. For now, install on a Linux host using one of the methods above.

Verify

Once it’s running, your host appears in the CostGraph platform. CostGraph agent host view in the platform

Configuration

The agent is configured entirely through command-line flags and the COSTGRAPH_API_KEY environment variable.
When you install with the script or Ansible, your API key is written to /etc/default/costgraph-agent and loaded by the service automatically.
The agent automatically detects the host filesystems:
  • cgroupfs — by checking /host/sys/fs/cgroup first, then /sys/fs/cgroup.
  • procfs — by checking /host/proc first, then /proc.
string
required
API key used to authenticate with CostGraph. Can also be set with the COSTGRAPH_API_KEY environment variable, which takes precedence over the flag.
number
default:"9101"
Port the agent exposes its own Prometheus metrics on, at /metrics.
string
default:"/var/lib/costgraph-agent"
Directory for durable agent state, including the on-disk remote-write queue.
number
default:"128"
Maximum number of remote-write blocks buffered in memory before they spill to the on-disk queue.
number
default:"5368709120"
Maximum size of the on-disk remote-write queue in bytes (5 GiB) before backpressure is applied.
string
default:"info"
Log verbosity. One of debug, info, warn, or error.
boolean
Prints the agent version and exits.
boolean
default:"false"
Container network flows are collected by default. Host-process network flows are collected only when this is enabled.

Changing flags for the managed service

The install script runs costgraph-agent as a systemd (or OpenRC) service with no extra flags. To change a flag for the managed service on a systemd host, add a drop-in:
The first empty ExecStart= clears the original command so your override fully replaces it.