]> arthur.barton.de Git - netdata.git/commitdiff
made /proc/stat guest_nice optional - it is not there on older systems
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 20 Mar 2015 09:11:01 +0000 (11:11 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 20 Mar 2015 09:11:01 +0000 (11:11 +0200)
src/proc_stat.c

index 65a18a23452531fa0ac3e1a83c4d626e6d76c12d..e78e8b118b3629bfa10fa809d0a430a14a1e6b76 100755 (executable)
@@ -40,8 +40,8 @@ int do_proc_stat(int update_every, unsigned long long dt) {
        for(l = 0; l < lines ;l++) {
                if(strncmp(procfile_lineword(ff, l, 0), "cpu", 3) == 0) {
                        words = procfile_linewords(ff, l);
-                       if(words < 11) {
-                               error("Cannot read /proc/stat cpu line. Expected 11 params, read %d.", words);
+                       if(words < 10) {
+                               error("Cannot read /proc/stat cpu line. Expected 10 params, read %d.", words);
                                continue;
                        }
 
@@ -58,7 +58,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
                        softirq         = strtoull(procfile_lineword(ff, l, 7), NULL, 10);
                        steal           = strtoull(procfile_lineword(ff, l, 8), NULL, 10);
                        guest           = strtoull(procfile_lineword(ff, l, 9), NULL, 10);
-                       guest_nice      = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
+                       if(words >= 11) guest_nice      = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
 
                        char *title = "Core utilization";
                        char *type = RRD_TYPE_STAT;