8000 docs: fixed incorrect agent metadata docs (#7005) · coder/coder@929589d · GitHub
[go: up one dir, main page]

Skip to content

Commit 929589d

Browse files
authored
docs: fixed incorrect agent metadata docs (#7005)
* docs: fixed incorrect agent metadata docs * docs: prettier; fixed incorrect agent metadata docs
1 parent b4afbe7 commit 929589d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

docs/templates/agent-metadata.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,16 @@ resource "coder_agent" "main" {
2828
# calculates CPU usage by summing the "us", "sy" and "id" columns of
2929
# vmstat.
3030
script = <<EOT
31-
vmstat | awk 'FNR==3 {printf "%2.0f%%", $13+$14+$16}'
31+
top -bn1 | awk 'FNR==3 {printf "%2.0f%%", $2+$3+$4}'
3232
EOT
3333
interval = 1
3434
timeout = 1
3535
}
3636
3737
metadata {
3838
display_name = "Disk Usage"
39-
key = "cpu"
40-
script = <<EOT
41-
df -h | awk -v mount="/" '$6 == mount { print $5 }'
42-
EOT
39+
key = "disk"
40+
script = "df -h | awk '$6 ~ /^\\/$/ { print $5 }'"
4341
interval = 1
4442
timeout = 1
4543
}
@@ -59,7 +57,7 @@ resource "coder_agent" "main" {
5957
key = "load"
6058
script = <<EOT
6159
awk '{print $1,$2,$3}' /proc/loadavg
62-
>>
60+
EOT
6361
interval = 1
6462
timeout = 1
6563
}
@@ -68,6 +66,16 @@ resource "coder_agent" "main" {
6866

6967
## Utilities
7068

69+
[top](https://linux.die.net/man/1/top) is available in most Linux
70+
distributions and provides virtual memory, CPU and IO statistics. Running `top`
71+
produces output that looks like:
72+
73+
```
74+
%Cpu(s): 65.8 us, 4.4 sy, 0.0 ni, 29.3 id, 0.3 wa, 0.0 hi, 0.2 si, 0.0 st
75+
MiB Mem : 16009.0 total, 493.7 free, 4624.8 used, 10890.5 buff/cache
76+
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 11021.3 avail Mem
77+
```
78+
7179
[vmstat](https://linux.die.net/man/8/vmstat) is available in most Linux
7280
distributions and provides virtual memory, CPU and IO statistics. Running `vmstat`
7381
produces output that looks like:

0 commit comments

Comments
 (0)
0