My biggest tip is to perform ALL of your tests running as the nagios user, as this is how the monitoring engine is going to do it.
Code: Select all
su nagios
NOTE:
su - nagios
This is NOT how the monitoring engine executes the plugin.
Also, some programs detect that you are not running in a terminal session and require a special parameter to overcome this.
For example top requires the -b argument to run in batch mode:
Code: Select all
top -n 1 -b
You can append your command with 2>&1 to redirect STDERR to STDOUT.
Code: Select all
top -n 1 -b 2>&1
Sorry I don't have a direct answer but these tips should help you pinpoint the problem.