munin
munin copied to clipboard
hwmon plugin reads input names incorrectly
Hi, I've just started using munin and I love it so far, but I just stumbled upon something weird in the hwmon_temp graph :
I dug into the plugin's code to try and understand those labels, and how I could get it to get the actual device names that lm_sensors was reporting correctly (Core 1, Core 2…).
What I found is this : https://github.com/munin-monitoring/munin/blob/a24eda76fe876142d310aac0f56f06a4abea3947/plugins/node.d.linux/hwmon#L155 I've never touched perl before in my life, but from what I gathered from this and the Munin::Plugin code, is that readarray(…) parses the first line of a file into an array by splitting on whitespaces. And the funny labels I was getting happened to match the number of words in the label (i.e 2 for "Core [0-9]" and 3 for "Package id 0").
I get the feeling that what this line was supposed to do was something like :
my ($label) = readarray($path . "_label");
$label = (($devname || "") . " $name") unless $label;
Which would have returned the first element of the array instead of its length, but still would have cropped any label with spaces to its first element. So I tried to replace it with :
my ($label) = readfile($path . "_label") || (($devname || "") . " $name");
chomp($label); # For the trailing newline
I don't know if it's the best solution but it works :shrug:
thanks for this - I had the same issue and this works perfectly