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

hddtemp: Support more than 32 drives #631

Merged
merged 4 commits into from
Sep 21, 2016
Merged

hddtemp: Support more than 32 drives #631

merged 4 commits into from
Sep 21, 2016

Conversation

bgilbert
Copy link
Contributor

@bgilbert bgilbert commented Jun 3, 2014

The hddtemp plugin imposes a 32-drive and 1024-byte limit on the response from the hddtemp daemon. On my system, the 1024-byte limit truncates the response after 29 drives.

Drop the drive limit and increase the buffer limit to 1 MB. (This is hopefully larger than anyone will need, and prevents collectd from being DoSed by the hddtemp daemon.)

@mfournier mfournier added Patch and removed Patch labels Jul 24, 2014
@pyr
Copy link
Member

pyr commented Dec 2, 2014

Hi @tokkee! Your thoughts on this ?

while ((name = strtok_r (ptr, "|", &saveptr)) != NULL &&
(model = strtok_r (NULL, "|", &saveptr)) != NULL &&
(temperature = strtok_r (NULL, "|", &saveptr)) != NULL &&
(mode = strtok_r (NULL, "|", &saveptr)) != NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're touching this anyway, it should use strsplit() from common.h instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strsplit() has a hard-coded set of field separators and won't split on |.

@tokkee
Copy link
Member

tokkee commented Feb 27, 2015

The general approach sounds fine to me. I've added two comments on the code but otherwise didn't look at all details yet.

@octo
Copy link
Member

octo commented Sep 12, 2016

Thanks for the patch @bgilbert. Could you please rebase on master so I can merge this? Thanks!

@octo octo added the Feature label Sep 12, 2016
bgilbert and others added 4 commits September 19, 2016 01:35
Instead of building an array of fields and then walking it, split into
fields as we go.
Dynamically scale the response buffer, up to a maximum of 1 MB.
Don't rely on signedness of buffer_size.
@bgilbert
Copy link
Contributor Author

Done.

@octo octo merged commit b968fcb into collectd:master Sep 21, 2016
@octo
Copy link
Member

octo commented Sep 21, 2016

Thank you so much @bgilbert!

@bgilbert bgilbert deleted the hddtemp-scaling branch September 21, 2016 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants