sigar-loader icon indicating copy to clipboard operation
sigar-loader copied to clipboard

Provisioning failure when no home directory set

Open Tenchi2xh opened this issue 9 years ago • 2 comments

We encountered a serious issue while deploying a service using kamon-system-metrics on a linux docker container where the user's home directory was set to / with no write privileges (for security), which provokes the following error:

[ERROR] [01/05/2016 11:19:22.224] [main] [ModuleLoader(akka://kamon)] Failed to auto start the [blaze-prometheus-exporter] module.
java.io.FileNotFoundException: /native/libsigar-amd64-linux.so (No such file or directory)

After investigating the source code of sigar-loader we found out that the native libraries are getting extracted to the home directory, which rests on the easy assumption that everyone has a write-access home directory.

Wouldn't it be better to extract it to a temporary directory?

Tenchi2xh avatar Jan 05 '16 11:01 Tenchi2xh

Hi, @Tenchi2xh

The idea behind of SigarProvisioner is try to extract the native library based on the selection of the user otherwise depending on some priorities:

 * 1) user provided command line agent options. [AGENT]
 * 2) user provided o/s environment variable: [KAMON_SIGAR_FOLDER]
 * 3) user provided java system property. [kamon.sigar.folder] -> ex. -Dkamon.sigar.folder=whatever
 * 4) hard coded location in ${user.dir}/native. This is the last one

dpsoft avatar Jan 05 '16 13:01 dpsoft

I've submitted a PR https://github.com/kamon-io/kamon-system-metrics/pull/15 which should at least allow the ability to set the extract directory by setting an environment variable/sys prop.

agustafson avatar Oct 18 '18 15:10 agustafson