From 1956b4dd7b574f8be03a355fa61b045fc5fdcae1 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 28 Jan 2013 14:12:17 +0100 Subject: [PATCH 1/2] fix interrupts.c to actually work --- tools/munin-plugins-busybox/interrupts.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/munin-plugins-busybox/interrupts.c b/tools/munin-plugins-busybox/interrupts.c index 8c800c61..32171f6d 100644 --- a/tools/munin-plugins-busybox/interrupts.c +++ b/tools/munin-plugins-busybox/interrupts.c @@ -37,10 +37,13 @@ int interrupts(int argc, char **argv) { return 1; } while(fgets(buff, 256, f)) { - if(!strncmp(buff, "intr ", 5)) - printf("intr.value %s", buff+5); - else if(!strncmp(buff, "ctxt ", 5)) - printf("ctx.value %s", buff+5); + if(!strncmp(buff, "intr ", 5)) { + buff[5 + strcspn(buff + 5, " \t\n")] = '\0'; + printf("intr.value %s\n", buff+5); + } else if(!strncmp(buff, "ctxt ", 5)) { + buff[5 + strcspn(buff + 5, " \t\n")] = '\0'; + printf("ctx.value %s\n", buff+5); + } } fclose(f); return 0; From b9c124798fa1018ec5ad4cd65533ee1419583ace Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 28 Jan 2013 14:18:45 +0100 Subject: [PATCH 2/2] fix cpu.c config for more recent kernels It still lacks behind the vanilla cpu plugin. --- tools/munin-plugins-busybox/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/munin-plugins-busybox/cpu.c b/tools/munin-plugins-busybox/cpu.c index 9f3483f8..3f9d9ff7 100644 --- a/tools/munin-plugins-busybox/cpu.c +++ b/tools/munin-plugins-busybox/cpu.c @@ -42,7 +42,7 @@ int cpu(int argc, char **argv) { } puts("graph_title CPU usage"); - if(extinfo == 7) + if(extinfo >= 7) puts("graph_order system user nice idle iowait irq softirq"); else puts("graph_order system user nice idle"); @@ -87,7 +87,7 @@ int cpu(int argc, char **argv) { "user.cdef user,%d,/\n" "nice.cdef nice,%d,/\n" "idle.cdef idle,%d,/\n", ncpu, ncpu, ncpu, ncpu); - if(extinfo == 7) { + if(extinfo >= 7) { puts("iowait.label iowait\n" "iowait.draw STACK\n" "iowait.min 0");