Skip to content

chore(dogfood): replace deprecated provider field and add order to agent metadata #13456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions dogfood/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ resource "coder_agent" "dev" {
os = "linux"
dir = local.repo_dir
env = {
OIDC_TOKEN : data.coder_workspace.me.owner_oidc_access_token,
OIDC_TOKEN : data.coder_workspace_owner.me.oidc_access_token,
}
startup_script_behavior = "blocking"

Expand All @@ -169,39 +169,44 @@ resource "coder_agent" "dev" {
# if you don't want to display any information.
metadata {
display_name = "CPU Usage"
key = "0_cpu_usage"
key = "cpu_usage"
order = 0
script = "coder stat cpu"
interval = 10
timeout = 1
}

metadata {
display_name = "RAM Usage"
key = "1_ram_usage"
key = "ram_usage"
order = 1
script = "coder stat mem"
interval = 10
timeout = 1
}

metadata {
display_name = "CPU Usage (Host)"
key = "2_cpu_usage_host"
key = "cpu_usage_host"
order = 2
script = "coder stat cpu --host"
interval = 10
timeout = 1
}

metadata {
display_name = "RAM Usage (Host)"
key = "3_ram_usage_host"
key = "ram_usage_host"
order = 3
script = "coder stat mem --host"
interval = 10
timeout = 1
}

metadata {
display_name = "Swap Usage (Host)"
key = "4_swap_usage_host"
key = "swap_usage_host"
order = 4
script = <<EOT
#!/bin/bash
echo "$(free -b | awk '/^Swap/ { printf("%.1f/%.1f", $3/1024.0/1024.0/1024.0, $2/1024.0/1024.0/1024.0) }') GiB"
Expand All @@ -212,7 +217,8 @@ resource "coder_agent" "dev" {

metadata {
display_name = "Load Average (Host)"
key = "5_load_host"
key = "load_host"
order = 5
# get load avg scaled by number of cores
script = <<EOT
#!/bin/bash
Expand All @@ -224,15 +230,17 @@ resource "coder_agent" "dev" {

metadata {
display_name = "Disk Usage (Host)"
key = "6_disk_host"
key = "disk_host"
order = 6
script = "coder stat disk --path /"
interval = 600
timeout = 10
}

metadata {
display_name = "Word of the Day"
key = "7_word"
key = "word"
order = 7
script = <<EOT
#!/bin/bash
curl -o - --silent https://www.merriam-webster.com/word-of-the-day 2>&1 | awk ' $0 ~ "Word of the Day: [A-z]+" { print $5; exit }'
Expand Down
Loading