Im new to writing plugins for Opsview and was after some help.
Im not sure if this is an environment thing or some other issue.
I have a check called check_suite. It takes in arguments for a path and a filename.
I can see the variables are being received and when I run the plugin from the command line fully, it works absolutely fine as root and as my own user.
However, when using it in opsview, it will occasionally say that the file does not exist and execute a branch of code in my script that I do not expect it to hit as the file definitely exists. The file has is updated regularly and has been present in the same place since December last year.
I am using KSH. I have tried using the if [ -e $FILE_PATH/$FILE_NAME ]option and -r option to see if the file exists. This comes back false on some occasions.
Doing an ls of the folder and including this in the output sent to opsview shows that the file is there. But doing an ls for the PATH/FILE says it does not. Im not sure why this can happen so randomly.
This script has been running for 2 years under crontab and our own scheduling system. It has never executed through that branch of the code, except when the file really was not present. Or when the network went down as it is from a shared file system using NFS.
As a test in my output I have asked the script to do an LS for the exact file, an ls of the folder and then do the if [-e check.
Running manually on CMD line I get the file I expect, the folder listing and the file is there and the if [-e says the file exists.
Using opsview I get no file, the ls of the folder shows the file to be present. But the if [ -e fails and returns False.
Any help would be appreciated.