When you run it on the command line, what user are you running it as? For my setup I run nagios as the user 'nagios'. I have found that if scripts are giving problems it is usually environmental and I make sure that the nagios user's env has the appropriate variables/permissions set.
|