sigar-loader
sigar-loader copied to clipboard
Provisioning failure when no home directory set
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?
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
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.