Skip to main content
The agent detects what a machine is from the cloud’s metadata service: provider, region, zone, instance type, and whether it is spot or on-demand. Detection works on AWS, Google Cloud, Azure, DigitalOcean, and Hetzner. Detection is not possible on on-premises servers, private clouds, other providers, or hosts with blocked metadata access. Those machines show up without a region or instance type and cannot be matched to a public price. Set the values yourself to fix that.

Variables

A variable you set wins over what the agent detects. Leave a variable unset to keep the detected value.
To get a public price, values must match the price catalog’s naming, for example the AWS region us-east-1 and instance type m6i.large.

Set the variables

Export the variables before running the install command. The script writes them to the agent’s environment file: /etc/default/costgraph-agent on systemd hosts, /etc/conf.d/costgraph-agent on OpenRC hosts.
Re-running the script keeps any value already recorded in the environment file, so an upgrade does not drop your settings. To change a value, export the new one before running it again. To remove one, delete its line from that file and restart the agent.

When detection fails at startup

If the agent cannot detect the cloud when it starts, it tries again on its regular metadata interval and updates the machine after detection succeeds. Google Cloud is the exception: restart the agent or set the preceding variables.

On-premises machines

Machines the agent cannot match to a public price can be given one of your organization’s own prices instead. See Pricing IDs.

Machines cloned from one image

Machines cloned from one template share a machine id and can merge into one record in CostGraph. Either regenerate the machine id on each clone, or set COSTGRAPH_INSTANCE_ID to a unique value per machine. To regenerate the machine id on a systemd host:
Also remove /var/lib/dbus/machine-id where it exists. The agent reads that file first and falls back to /etc/machine-id.