@cryptotaxi247 / netdata-1 / commits / c84b604ea

made /proc/stat guest_nice optional - it is not there on older systems

Costa Tsaousis (ktsaou) committed Mar 20, 2015 at 11:11 UTC c84b604ea2b962a165cf199281cc832245ca5dce
1 file changed +3 -3
src/proc_stat.c
+3 -3
@@ -40,8 +40,8 @@ int do_proc_stat(int update_every, unsigned long long dt) {
40 for(l = 0; l < lines ;l++) {
41 if(strncmp(procfile_lineword(ff, l, 0), "cpu", 3) == 0) {
42 words = procfile_linewords(ff, l);
43 - if(words < 11) {
44 - error("Cannot read /proc/stat cpu line. Expected 11 params, read %d.", words);
43 + if(words < 10) {
44 + error("Cannot read /proc/stat cpu line. Expected 10 params, read %d.", words);
45 continue;
46 }
47
@@ -58,7 +58,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
58 softirq = strtoull(procfile_lineword(ff, l, 7), NULL, 10);
59 steal = strtoull(procfile_lineword(ff, l, 8), NULL, 10);
60 guest = strtoull(procfile_lineword(ff, l, 9), NULL, 10);
61 - guest_nice = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
61 + if(words >= 11) guest_nice = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
62
63 char *title = "Core utilization";
64 char *type = RRD_TYPE_STAT;