Bug 250513 - net-mgmt/telegraf: uptime is reported as seconds-since-epoch, not seconds-since-boot
Summary: net-mgmt/telegraf: uptime is reported as seconds-since-epoch, not seconds-sin...
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Palle Girgensohn
Depends on:
Reported: 2020-10-21 18:39 UTC by Ulrich Spörlein
Modified: 2020-12-29 20:04 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (girgen)


Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Spörlein freebsd_committer 2020-10-21 18:39:38 UTC
So there I was installing telegraf, influxdb, grafana and the like and noticed my uptime measured in about 1 year (which itself is bogus, but not the problem).

The problem is that the gopsutil as used by telegraf has a bug in how it returns uptime on FreeBSD. This is fixed in head, but broken in the 2.19.7 version used by the port.

See this:
% sudo telegraf -config /usr/local/etc/telegraf.conf -test|grep uptime; date +%s
2020-10-21T18:31:37Z I! Starting Telegraf 1.15.3
> system,host=coyote.spoerlein.net uptime=1603305097i 1603305097000000000
> system,host=coyote.spoerlein.net uptime_format="18556 days, 18:31" 1603305097000000000

And indeed, checking out 2.19.7 and running a simple print uptime command I get:

% go run gopsutil_uptime.go
1603305234 <nil>

Bisecting shows that v2.20.7 is the first version that fixes it:

% go run gopsutil_uptime.go
1152659 <nil>

Much better. Interestingly, the only commit for that month was a major refactor, that doesn't even state that it fixes this _significant_ problem on FreeBSD.


Please approve that I bump the dependency to v2.20.7, thanks.
Comment 1 Palle Girgensohn freebsd_committer 2020-12-29 20:04:50 UTC

Thanks for your report. Sorry that I didn't see it earlier.

I'm about to update the port to 1.17.0 which has gopsutil version v2.20.9, so this should fix the problem.

Best regards,