Package: munin-plugins-core
Version: 2.0.24-1
Severity: wishlist
Tags: patch upstream

Hello,

three cosmetical issues with the labels generated by the irqstats
plugin:

1.

The concept of "interrupt domains" is somewhat unknown in the Intel
world. It seems to be quite common on other archs like ARM-based and
powerpc though.

Somewhat guessing from reading the Linux kernel sources, the basic
idea is the interrupt number as seen bei the interrupt controller
("hwirq") do not necessarily match the number the kernel uses
internally and is visible in the first column of /proc/interrupts.
In that case, an additional column contains that hwirq IRQ number¹.

The irqstats plugin is not aware of that and generates a label from
both that number and the actual name, like in

(...)
|            CPU0
(...)
|  25:  492375413  main-interrupt-ctrl  11  eth0
|  33:        949  main-interrupt-ctrl  33  serial
|  74:   15147181  main-interrupt-ctrl  46  f1072004.mdio-bus
(...)
[ /proc/interrupts ]


(...)
| i25.label 11  eth0
| i25.info Interrupt 25, for device(s): 11  eth0
| i25.type DERIVE
| i25.min 0
| i33.label 33  serial
| i33.info Interrupt 33, for device(s): 33  serial
| i33.type DERIVE
| i33.min 0
| i74.label 46  f1072004.mdio-bus
| i74.info Interrupt 74, for device(s): 46  f1072004.mdio-bus
| i74.type DERIVE
| i74.min 0
(...)
[ $(munin-run irqstats config) ]


2.

On kernels with CONFIG_GENERIC_IRQ_SHOW_LEVEL² enabled (powerpc), an
additional column containing "Level" or "Edge" is printed

|            CPU0
(...)
|  19:        745   MPIC 1     19 Level     pata-macio
|  25:          0   MPIC 1     25 Level     VIA-PMU
|  26:          0   MPIC 1     26 Level     keywest i2c
(...)
[ /proc/interrupts ]


3.

In the expample above, the space in the PIC name "MPIC 1"³ causes
additional trouble, "config" suggests the labels as follows

| irqstats.i19.label 1     19 Level     pata-macio
| irqstats.i25.label 1     25 Level     VIA-PMU
| irqstats.i26.label 1     26 Level     keywest i2c


These labels just eat space and are somewhat confusing.

The patch below catches these situations by

1. Dropping that number, unless it's different from the logical
   one. In that case, it is appended to the label.
2. Stripping these strings if present.
3. Wild-guessing. The $type variable is not used by the way but the
   patch creates a value in the intended idea.
   It might be an idea to fix that extra space in the kernel.

Regards,
    Christoph

¹ kernel-git:
    commit v3.10-rc5-20-gc12d2f4
² kernel-git:
    commit v2.6.38-7061-gab7798f
    commit v2.6.39-rc5-148-g94b2c36
³ kernel-git:
    commit v2.6.15-1517-g1beb6a7


--- a/plugins/node.d.linux/irqstats.in
+++ b/plugins/node.d.linux/irqstats.in
@@ -112,6 +112,16 @@
        # For numbered interrupts the format is set
        $label = pop @data;
        $type = pop @data;
+       # work around "MPIC \d" on powerpc
+       if ($type =~ "MPIC" && $label =~ s/^([12])\s+//) {
+           $type .= " $1";;
+       }
+       # handle hwirq
+       if ($label =~ /^(\d+)\s+(.+)/) {
+           $label = $1 eq $irq ? $2 : "$2 [$1]";
+       }
+       # handle level/edge
+       $label =~ s/^(Level|Edge)\s+//;
     } else {
        # For named interrupts it's more confusing, slice and dice
        # to divorce data from commentary

Attachment: signature.asc
Description: Digital signature

Reply via email to