Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hwmon plugin reads input names incorrectly #1542

Open
compilin opened this issue Jun 19, 2023 · 1 comment
Open

hwmon plugin reads input names incorrectly #1542

compilin opened this issue Jun 19, 2023 · 1 comment

Comments

@compilin
Copy link

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 :
image
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 :

my ($label) = readarray($path . "_label") || (($devname || "") . " $name");

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 🤷
image

@jameski83
Copy link

thanks for this - I had the same issue and this works perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants