node-exporter-textfile-collector-scripts
node-exporter-textfile-collector-scripts copied to clipboard
smartmon.py: look for smartctl just in case it is not in path
When used in a cronjob the path environment variable might not be set, so the script will look in the most common pathes for the binary. If it is not found it will be used as is, so script might fail in this case.
Wouldn't it be a lot simpler to just fix the PATH env var in the cronjob?
Wouldn't it be a lot simpler to just fix the PATH env var in the cronjob?
Every cron has only a limited PATH variable and sure I could set the PATH variable for the cronjob, but then imo it should be at least be documented somewhere, because debugging cronjob is not an easy task, and this would simply avoid that hassle.
The proposed functionality essentially duplicates what normal shell PATH behaviour does, albeit hard-coding a list of paths in the script. This sort of thing does not belong in textfile collectors.
Fix your PATH environment, or alternatively I would accept a PR which added a CLI argument for specifying the exact path to the smartctl
binary.