diff --git a/dogfood/main.tf b/dogfood/main.tf index ac42bb844c..e9eeff7b6f 100644 --- a/dogfood/main.tf +++ b/dogfood/main.tf @@ -95,48 +95,106 @@ resource "coder_agent" "dev" { metadata { display_name = "CPU Usage" - key = "cpu" + interval = 10 + timeout = 1 + key = "0_cpu_usage" + script = < /tmp/cusage + echo "Unknown" + exit 0 + fi + + # interval in microseconds should be metadata.interval * 1000000 + interval=10000000 + ncores=$(nproc) + echo "$cusage $cusage_p $interval $ncores" | awk '{ printf "%2.0f%%\n", (($1 - $2)/$3/$4)*100 }' + + EOT + } + + metadata { + display_name = "RAM Usage" + interval = 10 + timeout = 1 + key = "1_ram_usage" + script = <&1 | awk ' $0 ~ "Word of the Day: [A-z]+" { print $5; exit }' - EOT - interval = 60 + 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 }' + EOT + interval = 86400 timeout = 5 }