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

[[inputs.system]] /var/run/utmp: no such file... when using Alpine as base Image #5398

Closed
echtelerp opened this issue Feb 9, 2019 · 5 comments
Labels
area/system bug unexpected problem or unintended behavior
Milestone

Comments

@echtelerp
Copy link

some informations to #5283 and the older issue #5031: and as asked by @danielnelson
here the Issue

Relevant telegraf.conf:

used the standard, did no changes. just ran the two commands provided in the readme of Dockerhub:
$ docker run -d --name influxdb -p 8083:8083 -p 8086:8086 influxdb
$ docker run --net=container:influxdb telegraf:alpine

System info:

Host MacOs, Docker Version 2.0.0.2

[Include Telegraf version, operating system name, and other relevant details]

DockerEnvironment$ docker run --net=container:influxdb telegraf:alpine
2019-02-08T21:54:40Z I! Starting Telegraf 1.9.4
2019-02-08T21:54:40Z I! Using config file: /etc/telegraf/telegraf.conf
2019-02-08T21:54:40Z I! Loaded inputs: inputs.mem inputs.processes inputs.swap inputs.system inputs.cpu inputs.disk inputs.diskio inpu
ts.kernel
2019-02-08T21:54:40Z I! Loaded aggregators: 
2019-02-08T21:54:40Z I! Loaded processors: 
2019-02-08T21:54:40Z I! Loaded outputs: influxdb
2019-02-08T21:54:40Z I! Tags enabled: host=9ab66945f415
2019-02-08T21:54:40Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"9ab66945f415", Flush Interval:10s
2019-02-08T21:54:50Z E! [inputs.system]: Error in plugin: open /var/run/utmp: no such file or directory
...
...

Steps to reproduce:

  1. ...$ docker run -d --name influxdb -p 8083:8083 -p 8086:8086 influxdb
  2. ...$ docker run --net=container:influxdb telegraf:alpine
    watch the command line output.

Expected behavior:

run without errors

Actual behavior:

2019-02-08T21:54:50Z E! [inputs.system]: Error in plugin: open /var/run/utmp: no such file or directory

Additional info:

I did dig deeper in this problem.
Alpine as being such a minimal image somehow does not provide the file, that [[inputs.system]] is looking for.
The command uptime is working.

bash-4.4# uptime
 22:11:56 up  6:36,  0 users,  load average: 0.44, 0.43, 0.30

I did not find a solution how to load the utmp corresponding program via apk.

So the workaround provided in other bugs #5031 has some deeper issue behind.
In my specific case I would like to use the container with alpine, without having to bind anything to the host. this behavior makes the container somehow dependent, what I would like to avoid.

[Include gist of relevant config, logs, etc.]

@danielnelson
Copy link
Contributor

Based on running strace uptime, I believe uptime is using /proc/uptime and /proc/loadavg on alpine. However I cannot see how it is retrieving the users value, perhaps it is always hardcoded to 0?

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

The version of uptime on alpine:

# uptime -V
uptime from procps-ng UNKNOWN

I believe this is the source code:
https://gitlab.com/procps-ng/procps/blob/master/proc/whattime.c

@ehlerst
Copy link
Contributor

ehlerst commented Apr 17, 2019

There are 23 issues relating around this and i'm just wondering if anybody else is interested in this just having a flag to turn off "uptime" collection. Would maintainers take a merge that put in a config flag for that?

@ehlerst
Copy link
Contributor

ehlerst commented Apr 17, 2019

Made the PR for both n_users (which is what actually requires utmp http://man7.org/linux/man-pages/man5/utmp.5.html) and for uptime. Both of which i feel are not useful enough to keep fighting with this.

Also @evanphx the docs do say to mount /var/run/utmp:/var/run/utmp however this wont work on the mac and the latest docker CE.

@danielnelson danielnelson added this to the 1.11.1 milestone Jun 25, 2019
@danielnelson
Copy link
Contributor

Closed in #5742

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

No branches or pull requests

3 participants