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

Freebsd ARM support #5282

Closed
SomKen opened this issue Jan 14, 2019 · 27 comments · Fixed by #5380
Closed

Freebsd ARM support #5282

SomKen opened this issue Jan 14, 2019 · 27 comments · Fixed by #5380
Labels
area/packaging platform/bsd upstream bug or issues that rely on dependency fixes
Milestone

Comments

@SomKen
Copy link
Contributor

SomKen commented Jan 14, 2019

Feature Request

Any chance of a Freebsd arm build for Telegraf? With Netgate starting to release more ARM based PFSense devices, telegraf is the last feature I need to fully switch off x86.

I know the Freebsd ports tree is normally pretty good, but there's currently no support for telegraf on ARM. As telegraf is more than happy to run on Freebsd and Linux ARM, it seems like there's a build we're just missing.

Maybe this would be better to contact the maintainer of the telegraf builds on freebsd, but I'd trust influx more.

Proposal:

Currently, pfsense, and mainly freebsd, are missing a telegraf package on ARMv7.

Current behavior:

No freebsd ARM package.

Desired behavior:

A freebsd ARM package.

Use case: [Why is this important (helps with prioritizing requests)]

PFSense on ARM

@danielnelson
Copy link
Contributor

I be happy to accept a patch to scripts/build.py, I might work on this in the future but won't have time in the short term.

@girgen @W0CHP have done FreeBSD packaging of Telegraf, have you considered providing packages for arm?

@W0CHP
Copy link

W0CHP commented Jan 15, 2019

I’ll take a crack at it this week; I’m running a FreeBSD 11.2-p8 build environment on an ARM box, as well as a dev PFsense instance on ARM.

If successful, I’ll likely still submit my work to the upstream FreeBSD Ports tree for approval/inclusion as well.

Thanks for the mention, @danielnelson!

@SomKen
Copy link
Contributor Author

SomKen commented Jan 15, 2019

With FreeBSD, you're able to build ARM packages on x86.

From a random guy on the internet, it seems like an environment variable you set prior to building. YMMV. I'd do this, but I don't have freebsd setup directly.

https://www.reddit.com/r/PFSENSE/comments/8ufp0x/cant_find_telegraf_package_sg3100_pfsense_243/e1qu0ps

At one point, pfsense did support telegraf, but Golang wouldn't compile anymore. That doesn't seem to be a problem now. https://github.com/golang/go/wiki/GoArm

@W0CHP
Copy link

W0CHP commented Jan 15, 2019

I tried doing a quick build, but it's failing at the gopsutil plugin (output at end).

Both cross-compiling, and compiling directly on an armv7 FreeBSD machine, fail when building gopsutil.

Since telegraf depends on gopsutil, I recommend, @SomKen, that perhaps you can file an issue in @shirou's shirou/gopsutil project.
I'm afraid I can't perform the build, until there is full armv7 (FreeBSD) support from that dependency.

armv7 FreeBSD gopsutil build output:

github.com/shirou/gopsutil/cpu
../../shirou/gopsutil/cpu/cpu_freebsd.go:25:16: undefined: cpuTimes ../../shirou/gopsutil/cpu/cpu_freebsd.go:42:31: undefined: cpuTimes ../../shirou/gopsutil/cpu/cpu_freebsd.go:66:38: undefined: cpuTimes ../../shirou/gopsutil/cpu/cpu_freebsd.go:72:15: undefined: cpuTimes ../../shirou/gopsutil/cpu/cpu_freebsd.go:87:13: undefined: cpuTimes
github.com/shirou/gopsutil/disk
../../shirou/gopsutil/disk/disk_freebsd.go:26:36: undefined: MNT_WAIT ../../shirou/gopsutil/disk/disk_freebsd.go:31:15: undefined: Statfs ../../shirou/gopsutil/disk/disk_freebsd.go:32:28: undefined: MNT_WAIT ../../shirou/gopsutil/disk/disk_freebsd.go:38:17: undefined: MNT_RDONLY ../../shirou/gopsutil/disk/disk_freebsd.go:41:17: undefined: MNT_SYNCHRONOUS ../../shirou/gopsutil/disk/disk_freebsd.go:44:17: undefined: MNT_NOEXEC ../../shirou/gopsutil/disk/disk_freebsd.go:154:9: undefined: Bintime ../../shirou/gopsutil/disk/disk_freebsd.go:163:22: undefined: Statfs ../../shirou/gopsutil/disk/disk_freebsd.go:167:54: undefined: Statfs ../../shirou/gopsutil/disk/disk_freebsd.go:182:32: undefined: Devstat ../../shirou/gopsutil/disk/disk_freebsd.go:44:17: too many errors

@danielnelson
Copy link
Contributor

danielnelson commented Jan 15, 2019

Here is an issue on the gopsutil issue tracker: shirou/gopsutil#627

@W0CHP
Copy link

W0CHP commented Jan 15, 2019

Awesome I’ll try the trick referenced in the issue!

@W0CHP
Copy link

W0CHP commented Jan 15, 2019

OK I got it built and working on arm6 and arm7 FreeBSD-11.2-p8.

Note that I used/built Telegraf v1.9.0, which is the current version in the official FreeBSD Ports tree (for now).

As @danielnelson mentioned, scripts/build.py needed to be slightly modified. Here is the (v1.9.0) patch for that: https://raw.githubusercontent.com/W0CHP/FreeBSD-ARM/master/net-mgmt/telegraf/files/patch-scripts_build_py

The port build Makefile has been tweaked to address shirou/gopsutil#627

Test Port tree if one wants to build the port: https://github.com/W0CHP/FreeBSD-ARM/tree/master/net-mgmt/telegraf

FreeBSD-armv7 binary package* for folks that can't/won't build:
https://github.com/W0CHP/FreeBSD-ARM/raw/master/net-mgmt/telegraf/pkg/telegraf-1.9.0.txz

Here's a screenshot of data being collected on a Telegraf-1.9.0 instance on FreeBSD-11.2 armv7:
https://raw.githubusercontent.com/W0CHP/FreeBSD-ARM/master/net-mgmt/telegraf/Telegraf-ARM.png

*Test package; use at your own risk.

@SomKen
Copy link
Contributor Author

SomKen commented Jan 15, 2019

Quick turn around @W0CHP! Thanks for the inital work.

I'll get this tested shortly on pfsense to make sure its happy too. At least this is a start.

@girgen
Copy link

girgen commented Jan 15, 2019

Cool @W0CHP ! If you send me the patch for the telegraf port, I can commit the fix. Either here, directly to me or as a bugzilla PR.

@SomKen
Copy link
Contributor Author

SomKen commented Jan 16, 2019

@W0CHP for the record, your build is working on my Netgate SG3100 running PFSense 2.4.4-p2.

@W0CHP
Copy link

W0CHP commented Jan 16, 2019

@girgen It looks like you already merged my patches and committed(?) :-)
freebsd/freebsd-ports@8a143a3

Thanks!

@W0CHP
Copy link

W0CHP commented Jan 16, 2019

@danielnelson FYI all of these changes have been merged and committed upstream to the FreeBSD Ports tree (thanks @girgen!).

@girgen
Copy link

girgen commented Jan 16, 2019

@girgen It looks like you already merged my patches and committed(?) :-)
freebsd/freebsd-ports@8a143a3

Thanks!

Yeah, I think I found all changes (the patch file, adding ARCH and the two cp lines), so I committed it together with an update to 1.9.2. Hope I didn't miss anything? :-)

@SomKen
Copy link
Contributor Author

SomKen commented Jan 16, 2019

With the code moving to the freebsd tree, should I close this?

@W0CHP
Copy link

W0CHP commented Jan 16, 2019

Yeah, I think I found all changes (the patch file, adding ARCH and the two cp lines), so I committed it together with an update to 1.9.2. Hope I didn't miss anything? :-)

You nailed it, @girgen! And I tested on two ARM installs from the updated ports tree. Works great.

With the code moving to the freebsd tree, should I close this?

@SomKen I think closing this is appropriate. Thanks for issuing the FR; and thanks again @girgen for the commit. :-)

@SomKen
Copy link
Contributor Author

SomKen commented Jan 16, 2019

Thanks again!

@SomKen SomKen closed this as completed Jan 16, 2019
@danielnelson
Copy link
Contributor

Let's leave this open until fixed in gopsutil.

@danielnelson danielnelson reopened this Jan 16, 2019
@danielnelson danielnelson added the upstream bug or issues that rely on dependency fixes label Jan 16, 2019
@girgen
Copy link

girgen commented Jan 16, 2019

I think both the patch and the copies of files should propagate upstreams from the port, i.e. it should be committed here and in the gopsutil trees.

I guess a pull request is preferred? @W0CHP should get the glory for fixing it. :)

@danielnelson
Copy link
Contributor

We don't vendor, so it would only go upstream, here is the link again to the upstream issue: shirou/gopsutil#627.

@danielnelson
Copy link
Contributor

I believe this was addressed by shirou/gopsutil#632

@SomKen
Copy link
Contributor Author

SomKen commented Mar 25, 2021

@W0CHP You around? Can you share me the repo you had for building this. Netgate still hasn't released Telegraf after two years....

@W0CHP
Copy link

W0CHP commented Mar 25, 2021

@W0CHP You around? Can you share me the repo you had for building this. Netgate still hasn't released Telegraf after two years....

I'm around! I've moved the repo here:
https://repo.w0chp.net/Chipster/FreeBSD-Ports-Custom/src/master/ports/net-mgmt/telegraf

I have not maintained it in two years due to time constraints. Hope that helps.

@SomKen
Copy link
Contributor Author

SomKen commented Mar 25, 2021

Got it! Thanks. It's insane this never got solved, but I think you did all the heavy lifting needed. I owe you a beer.

@SomKen
Copy link
Contributor Author

SomKen commented Mar 27, 2021

@W0CHP You around? Can you share me the repo you had for building this. Netgate still hasn't released Telegraf after two years....

I'm around! I've moved the repo here:
https://repo.w0chp.net/Chipster/FreeBSD-Ports-Custom/src/master/ports/net-mgmt/telegraf

I have not maintained it in two years due to time constraints. Hope that helps.

Go cross compiles.... buahahahah

@SomKen
Copy link
Contributor Author

SomKen commented May 3, 2021

@W0CHP thanks again for your help before. This story has come to an end... 279dda2

@W0CHP
Copy link

W0CHP commented May 3, 2021 via email

@SomKen
Copy link
Contributor Author

SomKen commented Jun 17, 2021

https://docs.influxdata.com/telegraf/v1.18/about_the_project/release-notes-changelog/

"Add FreeBSD ARMv7 build." Front and center...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packaging platform/bsd upstream bug or issues that rely on dependency fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants