node-exporter-textfile-collector-scripts icon indicating copy to clipboard operation
node-exporter-textfile-collector-scripts copied to clipboard

smartmon.py: look for smartctl just in case it is not in path

Open bufanda opened this issue 3 years ago • 2 comments

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.

bufanda avatar Jun 08 '21 22:06 bufanda

Wouldn't it be a lot simpler to just fix the PATH env var in the cronjob?

dswarbrick avatar Jun 10 '21 09:06 dswarbrick

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.

bufanda avatar Jun 11 '21 07:06 bufanda

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.

dswarbrick avatar May 22 '23 17:05 dswarbrick