Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: fixed incorrect agent metadata docs#7005

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sharkymark merged 2 commits intomainfromdocs-agent-metadata
Apr 4, 2023
Merged
Changes fromall 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
20 changes: 14 additions & 6 deletionsdocs/templates/agent-metadata.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,18 +28,16 @@ resource "coder_agent" "main" {
# calculates CPU usage by summing the "us", "sy" and "id" columns of
# vmstat.
script = <<EOT
vmstat| awk 'FNR==3 {printf "%2.0f%%", $13+$14+$16}'
top -bn1| awk 'FNR==3 {printf "%2.0f%%", $2+$3+$4}'
EOT
interval = 1
timeout = 1
}

metadata {
display_name = "Disk Usage"
key = "cpu"
script = <<EOT
df -h | awk -v mount="/" '$6 == mount { print $5 }'
EOT
key = "disk"
script = "df -h | awk '$6 ~ /^\\/$/ { print $5 }'"
interval = 1
timeout = 1
}
Expand All@@ -59,7 +57,7 @@ resource "coder_agent" "main" {
key = "load"
script = <<EOT
awk '{print $1,$2,$3}' /proc/loadavg
>>
EOT
interval = 1
timeout = 1
}
Expand All@@ -68,6 +66,16 @@ resource "coder_agent" "main" {

## Utilities

[top](https://linux.die.net/man/1/top) is available in most Linux
distributions and provides virtual memory, CPU and IO statistics. Running `top`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
distributions and provides virtual memory, CPU and IO statistics. Running`top`
distributions and provides virtual memory, CPU and IO statistics. Running`top -bn1`

we'll want to recommendtop -bn1 here because regular top opens a live-refreshing screen view, which is not friendly for parsing.

produces output that looks like:

```
%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
MiB Mem : 16009.0 total, 493.7 free, 4624.8 used, 10890.5 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 11021.3 avail Mem
```

[vmstat](https://linux.die.net/man/8/vmstat) is available in most Linux
distributions and provides virtual memory, CPU and IO statistics. Running `vmstat`
produces output that looks like:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp