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

added support for netbsd on check-load #273

Merged
merged 2 commits into from
Feb 12, 2019
Merged

added support for netbsd on check-load #273

merged 2 commits into from
Feb 12, 2019

Conversation

paulbsd
Copy link
Contributor

@paulbsd paulbsd commented Feb 10, 2019

No description provided.

)

func getloadavg() (loadavgs [3]float64, err error) {
outputBytes, err := exec.Command("sysctl", "-n", "vm.loadavg").Output()
Copy link
Contributor

Choose a reason for hiding this comment

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

Using unix.SysctlRaw is better if possible, to avoid overhead of executing command.
(ref: https://github.com/mackerelio/go-osstat/blob/master/loadavg/loadavg_bsd_nocgo.go )

@astj
Copy link
Contributor

astj commented Feb 10, 2019

Thank you for contributing!

Looks good, but, as commented above, using unix.SysctlRaw is better if possible. Or is there any reason to use exec.Command ?

@paulbsd
Copy link
Contributor Author

paulbsd commented Feb 10, 2019

Thanks for feedback.
I commited another change, using github.com/mackerelio/go-osstat/loadavg, which use unix.SysctlRaw.
May go-osstat be used on any other OS for check-load ?

@astj
Copy link
Contributor

astj commented Feb 12, 2019

May go-osstat be used on any other OS for check-load ?

Yes. Though we should remember that go-osstat uses cgo, but in case of loadavg it has fallback to non-cgo so there's no problem!

@astj
Copy link
Contributor

astj commented Feb 12, 2019

@paulbsd
I'd like to merge this p-r for now. If you're interested in using go-osstat more widely, I'll appreciate it in another pull request. Thank you again for contribution!

@astj astj merged commit ca3163f into mackerelio:master Feb 12, 2019
@lufia lufia mentioned this pull request Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants