Support the 'guest_nice' cpu mode of /proc/stat.

'guest_nice' is available since Linux 2.6.33.
This commit is contained in:
Karsten Weiss 2017-04-12 10:15:06 +02:00
commit 45ca8db352
2 changed files with 9 additions and 1 deletions

View file

@ -104,7 +104,7 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
break
}
// Only some of these may be present, depending on kernel version.
cpuFields := []string{"user", "nice", "system", "idle", "iowait", "irq", "softirq", "steal", "guest"}
cpuFields := []string{"user", "nice", "system", "idle", "iowait", "irq", "softirq", "steal", "guest", "guest_nice"}
// OpenVZ guests lack the "guest" CPU field, which needs to be ignored.
expectedFieldNum := len(cpuFields) + 1
if expectedFieldNum > len(parts) {