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

System Input Plugin should have also variable for determinate path to /hostfs/var #3339

Closed
lukasmrtvy opened this issue Oct 13, 2017 · 7 comments · Fixed by #3441
Closed
Milestone

Comments

@lukasmrtvy
Copy link

Bug report

System Input Plugin should have also variable for determinate path to /hostfs/var

Logs:
2017-10-13T04:52:40Z E! Error in plugin [inputs.system]: open /var/run/utmp: no such file or directory

HOST_VAR=/hostfs/var should be a solution, just like in HOST_ETC= case

Relevant telegraf.conf:

[inputs.system]

System info:

Telegraph 1.4.2
Alpine 3.6

Steps to reproduce:

docker run -d --name telegraf --net host -v /:/hostfs:ro -e HOST_MOUNT_PREFIX=/hostfs -e HOST_ETC=/hostfs/etc mytelegraf

Proposal:

docker run -d --name telegraf -v /:/hostfs:ro -e HOST_MOUNT_PREFIX=/hostfs -e HOST_ETC=/hostfs/etc -e HOST_VAR=/hostfs/var mytelegraf

or

docker run -d --name telegraf -v /:/hostfs:ro -e HOST_MOUNT_PREFIX=/hostfs -e HOSTFS_PREFIX=/hostfs mytelegraf

Additional info:

There are no steps in docs to run telegraph in docker with host monitoring.

For example:
--net host ?
--cap_add ?
--priviledged ?

Thanks

@danielnelson
Copy link
Contributor

@shirou Do you think we should add a HOST_VAR environment variable support to gopsutil? I believe the relevant code is https://github.com/shirou/gopsutil/blob/master/host/host_linux.go#L135

@danielnelson
Copy link
Contributor

@muhahacz I know some people have used the advice in this comment for setup: #1544 (comment). I agree we need to do additional testing and add some setup advice to the documentation.

@shirou
Copy link
Contributor

shirou commented Oct 14, 2017

@danielnelson I agree to add environmental variable support to host.Users. Something like HOST_VAR as described proposal?

@danielnelson
Copy link
Contributor

@shirou Yes, I think so. I'll submit a PR later today.

@lukasmrtvy
Copy link
Author

Seems its fixed in gopsutil v2.17.10.
Will it be available in 1.4.4 ?
Thanks

@danielnelson danielnelson added this to the 1.4.4 milestone Nov 6, 2017
@lukasmrtvy
Copy link
Author

lukasmrtvy commented Nov 16, 2017

@shirou @danielnelson

In this case HOST_VAR=/hostfs/var/ variable does not work as expected..

2017-11-16T15:16:10Z E! Error in plugin [inputs.system]: open /hostfs/var/run/utmp: no such file or directory

Container:
ls -lha /hostfs/var/
lrwxrwxrwx 1 root root 4 Nov 8 21:15 run -> /run

Host:
ls -lha /var/
lrwxrwxrwx 1 root root 4 Nov 8 21:15 run -> /run

Symlink breaks /hostfs/ prefix

utmp in container is located here:
/hostfs/run/utmp

Workaround for now is bind it directly like:
-v /var/run/utmp:/var/run/utmp:ro

@danielnelson
Copy link
Contributor

Thanks for the update @muhahacz, this seems similar to the issues we had with /etc/mtab #1544 (comment)

I'm not sure if there is a better way to address this than your workaround.

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 a pull request may close this issue.

3 participants