# Agent Metadata ![agent-metadata](../images/agent-metadata.png) With Agent Metadata, template admins can expose operational metrics from their workspaces to their users. It is the dynamic complement of [Resource Metadata](./resource-metadata.md). See the [Terraform reference](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#metadata). ## Examples All of these examples use [heredoc strings](https://developer.hashicorp.com/terraform/language/expressions/strings#heredoc-strings) for the script declaration. With heredoc strings, you can script without messy escape codes, just as if you were working in your terminal. Some of the below examples use the [`coder stat`](../cli/stat.md) command. This is useful for determining CPU/memory usage inside a container, which can be tricky otherwise. Here's a standard set of metadata snippets for Linux agents: ```hcl resource "coder_agent" "main" { os = "linux" ... metadata { display_name = "CPU Usage" key = "cpu" # Uses the coder stat command to get container CPU usage. script = "coder stat cpu" interval = 1 timeout = 1 } metadata { display_name = "Memory Usage" key = "mem" # Uses the coder stat command to get container memory usage in GiB. script = "coder stat mem --prefix Gi" interval = 1 timeout = 1 } metadata { display_name = "CPU Usage (Host)" key = "cpu_host" # calculates CPU usage by summing the "us", "sy" and "id" columns of # top. script = <