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

[BUG] Media collecter cannot find smartctl when run by cron #2 #304

Closed
TehloWasTaken opened this issue Jun 15, 2022 · 7 comments · Fixed by #308
Closed

[BUG] Media collecter cannot find smartctl when run by cron #2 #304

TehloWasTaken opened this issue Jun 15, 2022 · 7 comments · Fixed by #308
Labels
bug Something isn't working waiting for response

Comments

@TehloWasTaken
Copy link

TehloWasTaken commented Jun 15, 2022

Describe the bug
scrutiny-collector-metrics-linux-amd64 cannot find smartctl when run by cron.

Expected behavior
Collector program to run

Screenshots
If applicable, add screenshots to help explain your problem.

Log Files

 ___   ___  ____  __  __  ____  ____  _  _  _  _
/ __) / __)(  _ \(  )(  )(_  _)(_  _)( \( )( \/ )
\__ \( (__  )   / )(__)(   )(   _)(_  )  (  \  /
(___/ \___)(_)\_)(______) (__) (____)(_)\_) (__)
AnalogJ/scrutiny/metrics                       linux.amd64-0.4.13

time="2022-06-15T16:56:01+02:00" level=info msg="Verifying required tools" type=metrics
2022/06/15 16:56:01 ERROR: DependencyMissingError: "smartctl is missing"

CRON command is the following (set to one minute for testing purposes)

*/1 * * * * . /etc/profile; /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://10.0.1.114:8080" > /tmp/scrutiny.log 2>&1

It's the exact same issue as in issue #76

@TehloWasTaken TehloWasTaken added the bug Something isn't working label Jun 15, 2022
@AnalogJ
Copy link
Owner

AnalogJ commented Jun 16, 2022

Hey @TehloWasTaken are you running the Scrutiny collector via a manual install? or is this inside the Docker image?

@gofaster
Copy link

gofaster commented Jun 18, 2022

@AnalogJ I'd like to request that an explicit path to smartctl can be defined in the collector.yaml file and/or an environment variable. It might resolve cron spawned env PATH issues, and be safer than running an arbitrary executable named smartctl somewhere in the path with root privilege.

e.g.
smartctl_path: /usr/sbin/smartctl

AnalogJ added a commit that referenced this issue Jun 20, 2022
@AnalogJ
Copy link
Owner

AnalogJ commented Jun 20, 2022

@gofaster great idea, I just implemented this change in the beta branch (docker image tag is beta-omnibus) can you test it out and get back to me?

the collector config file would need to be edited:

commands:
  metrics_smartctl_bin: '/usr/sbin/smartctl' # change to provide custom `smartctl` binary path, eg. `/usr/sbin/smartctl`

@gofaster
Copy link

@AnalogJ Thanks for the quick feature addition. Can you please build an amd64 linux binary for the beta collector? My collectors run standalone without docker.

AnalogJ added a commit that referenced this issue Jun 20, 2022
AnalogJ added a commit that referenced this issue Jun 20, 2022
@AnalogJ
Copy link
Owner

AnalogJ commented Jun 21, 2022

Hey @gofaster sorry for the delay, I had to fix some tests.

You can download a zip file containing all the binaries here

Its the binaries.zip attachment from this CI build: https://github.com/AnalogJ/scrutiny/actions/runs/2532382591

@gofaster
Copy link

@AnalogJ The definable smartctl path option works great. Thanks!

@AnalogJ
Copy link
Owner

AnalogJ commented Jun 21, 2022

great, this will be included in v0.4.14 (when it's released)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for response
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants