Hello everyone,
at the moment I have a problem by running this smart check plugin. When I run it via shell on the given host it returns the result without an issue (as root).
But when I run it via root cronjob ( I write the cron output into a text file to prepare the output in a selfmade script which is handled via NRPE) I got always
"Unknown: No health status line found"
But I don´t get it why this happens, the script should be executed with the same root rights.
Any ideas?
check_smart.pl issue
Re: check_smart.pl issue
I'm going to assume the check_smart.pl script you are using was acquired from here:
https://exchange.nagios.org/directory/P ... v2/details
Can you share the full command you are executing from the CLI of the remote machine?
For these sorts of problems, it's almost always something to do with the execution environment. It's likely the SMART command you're manually running as root via the shell has a totally different $PATH than your cron's environment. My guess is your cron's environment is missing some critical $PATH definition for your SMART command, specifically the smartctl command is not included in cron's path.
A simple solution might be to physically alter the check_smart.pl script to use a different SMART command. You could change this definition:
To instead point to the actual binary (sudo /usr/bin/whatever/smartctl) rather than relying on $PATH to resolve smartctl.
https://exchange.nagios.org/directory/P ... v2/details
Can you share the full command you are executing from the CLI of the remote machine?
For these sorts of problems, it's almost always something to do with the execution environment. It's likely the SMART command you're manually running as root via the shell has a totally different $PATH than your cron's environment. My guess is your cron's environment is missing some critical $PATH definition for your SMART command, specifically the smartctl command is not included in cron's path.
A simple solution might be to physically alter the check_smart.pl script to use a different SMART command. You could change this definition:
Code: Select all
my $smart_command = 'sudo smartctl';Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/