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

restart needed for system.ncpus to update #5451

Closed
caapos opened this issue Feb 19, 2019 · 10 comments · Fixed by #6214
Closed

restart needed for system.ncpus to update #5451

caapos opened this issue Feb 19, 2019 · 10 comments · Fixed by #6214
Labels
area/system bug unexpected problem or unintended behavior

Comments

@caapos
Copy link

caapos commented Feb 19, 2019

This https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/system.go#L37 calls a GO system function https://golang.org/pkg/runtime/#NumCPU, which has undesired bahaviour. To force the system.ncpus metric to update in dashboard after change in OS, it is needed to restart telegraf process.

@danielnelson danielnelson added bug unexpected problem or unintended behavior area/system labels Feb 19, 2019
@danielnelson
Copy link
Contributor

We should probably start using gopsutil for this, but they are currently getting cpu count in the same way.

https://github.com/shirou/gopsutil/blob/9294781cc96294e42b8cb19de82a0ff3b19bb056/cpu/cpu.go#L70-L72

Can you describe what type of system you have that has changes to the cpu count, so we can make a good argument for the necessity of this code, and then I'll open an issue on gopsutil.

@caapos
Copy link
Author

caapos commented Feb 21, 2019

We are running our monitored environments on CentOS virtual machines, ufortunately I do not have enough information about the underlying system configuration, but the parameters like te number of CPUs or RAM of individual VMs can be changed without the need to restart the VM. If you need more information, please give me a specific question and I will try to answer.

@danielnelson
Copy link
Contributor

Do you know what the hypervisor is?

@caapos
Copy link
Author

caapos commented Feb 21, 2019

I will find out and send it to you, but the bug would reproduce on ANY hypervisor, because of the nature of the code for checking the number of CPUs.

@danielnelson
Copy link
Contributor

True, I'm just trying to make the use case a little more concrete with a specific example. I just looked up how to do this with kvm + libvirt and was able to do this in a test VM, so I think this will be a good enough example and also helpful for testing.

@caapos
Copy link
Author

caapos commented Feb 21, 2019

Thanks a lot, I will give you specific information about the hypervisor when the rest of our team is awake :)

@danielnelson
Copy link
Contributor

Support for updating the number of CPUs dynamically has been added, though we only have Linux support for now.

@Lomanic
Copy link

Lomanic commented Aug 20, 2019

we only have Linux support for now

FYI darwin and windows are now also supported in gopsutil.

@danielnelson
Copy link
Contributor

Awesome job @Lomanic, Telegraf really couldn't exist without you and @shirou's hard work on gopsutil.

So, if I'm reading this correctly, in Telegraf 1.12.0 (coming soon) we will be using gopsutil v2.19.7 and that should give us Linux/Darwin support but Windows will need to wait for 1.13.

@Lomanic
Copy link

Lomanic commented Aug 22, 2019

Thanks for the kind words, appreciated.

Indeed you're right, gopsutil v2.19.7 includes support for both linux and darwin but only v2.19.8+ will include the windows implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/system bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants