-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
status: show guest VM health (cpu/ram/disk) #3574
Comments
You can use $ minikube ssh -- top -b -n 1 | head -n 4
top - 20:47:27 up 1:01, 1 user, load average: 0.00, 0.01, 0.00
Tasks: 142 total, 1 running, 141 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.0/6.2 6[|||||| ]
%Cpu1 : 0.0/0.0 0[ ]
$ minikube ssh -- free -m
total used free shared buff/cache available
Mem: 1990 72 1127 16 790 1871
Swap: 999 0 999
$ minikube ssh -- df -h /var/lib/docker
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 17G 49M 16G 1% /var/lib/docker Nothing wrong with having the basic information available with a simple command, though. |
Maybe this will muddy the "status" command output, and better off as a separate cmd (or extra flag) ? This library looked quite useful, for making a health check binary that can be deployed on the VM: https://github.com/shirou/gopsutil Strange that there is no built-in monitoring of node disk usage, only cpu and ram ? (cAdvisor has it) https://github.com/google/cadvisor/tree/master/deploy/kubernetes |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Here's a little hack to show the available information: package main
import (
"fmt"
"os"
"time"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem"
)
func busy(percent []float64) float64 {
return percent[0] // single
}
func idle(percent []float64) float64 {
return 100.0 - busy(percent)
}
func megs(bytes uint64) float64 {
return float64(bytes) / 1024.0 / 1024.0
}
func main() {
interval := time.Duration(1) * time.Second
path := "/var/lib/minikube"
if _, err := os.Stat(path); os.IsNotExist(err) {
path = "/"
}
i, _ := cpu.Info()
p, _ := cpu.Percent(interval, false)
v, _ := mem.VirtualMemory()
s, _ := mem.SwapMemory()
d, _ := disk.Usage(path)
fmt.Printf("CPU\tNumber:%d, Idle:%.1f%%, Busy:%.1f%%\n",
len(i), idle(p), busy(p))
fmt.Printf("MEM\tTotal:%.0f, Available:%.0f, Used:%.1f%%\n",
megs(v.Total), megs(v.Available), v.UsedPercent)
fmt.Printf("SWP\tTotal:%.0f, Free:%.0f, Used:%.1f%%\n",
megs(s.Total), megs(s.Free), s.UsedPercent)
fmt.Printf("HDD\tTotal:%.0f, Free:%.0f, Used:%.1f%%\n",
megs(d.Total), megs(d.Free), d.UsedPercent)
} Typical output: $ ./health
CPU Number:2, Idle:95.2%, Busy:4.8%
MEM Total:1991, Available:1285, Used:24.9%
SWP Total:0, Free:0, Used:0.0%
HDD Total:17368, Free:14847, Used:9.2% |
I noticed today that
|
This issue is still relevent in minikube v1.6. It'd be nice if someone plumbed |
@tstromberg - |
We can get some of this from the metrics-server, by using But it would be nice to be able to get the "raw" data from the VM as well ? http://www.virtualbox.org/manual/ch08.html#vboxmanage-metrics Some available:
When using KIC, we need to make sure to not display the data for the host. $ docker stats docker --no-stream --format '{{json .}}'
{"BlockIO":"245MB / 0B","CPUPerc":"23.86%","Container":"minikube","ID":"6c28dceb5e35","MemPerc":"9.91%","MemUsage":"792.8MiB / 7.812GiB","Name":"docker","NetIO":"92.1kB / 297kB","PIDs":"455"} |
What to do when running out of space? > minikube ssh -- df -h /var/lib/docker
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 10G 9.9G 0 100% /var/lib/docker I know I can run |
@mr-bjerre - if you are on Windows/macOS, try giving Docker more space: |
Skaffold more space, right? What I usually do is
|
I added some parsers for The CPU usage is trickier, since
5% user, 3% system, 92% idle |
Added implementation of a vmstat parser as well, in 4c78a65 count := runtime.NumCPU()
busy, idle, _ := util.LocalCPU()
fmt.Printf("Local CPU: #%d %d%% %d%%\n", count, busy, idle)
rr, _ := cr.RunCmd(exec.Command("nproc"))
count, _ = strconv.Atoi(strings.TrimSpace(rr.Stdout.String()))
rr, _ = cr.RunCmd(exec.Command("vmstat", "1", "2"))
busy, idle, _ = util.ParseVMStat(rr.Stdout.String())
fmt.Printf("Remote CPU: #%d %d%% %d%%\n", count, busy, idle) Since it is based on integers, the numbers don't always add up:
The local implementation just uses gopsutil, per above: 03d950f Put the code in "generic-status" for now, needs better status cmd... |
Hi probably related off topic question, I was wondering if we could somehow use a spilt of memory for minikube like minimal amount from RAM + Swap sort of memory from disk |
The status command should make it obvious when one is out of guest VM resources - particularly disk space.
The text was updated successfully, but these errors were encountered: