Forum Discussion

David_Carlson's avatar
David_Carlson
Icon for Nimbostratus rankNimbostratus
Mar 14, 2018

External monitor won't write to file when run

I borrowed a sample monitor and tried to make some modifications. While troubleshooting I tried to write the contents to a file to see what was actually happening. Nothing was getting written so I replaced all of the variables with the actual data and still nothing. I am able to run it from the shell and it writes the result to the file. Do I have to do something different if the script is called from the F5 monitor? It's applied to a pool with just one server to test and the server is up and responding. Any help would be appreciated. Thank you!

send request & check for expected response

curl -fNs -d data | grep -i "Desired result" 2>&1 >> /var/tmp/script.log

mark node UP if expected response was received

if [ $? -eq 0 ] then Remove the PID file rm -f $PIDFILE

echo "UP"

else Remove the PID file rm -f $PIDFILE fi

exit

3 Replies

  • what are the permissions on the file, who owns it, and which directory is it in? Bear in mind, when you run the script you are probably effectively running it as root. When bigd runs the monitor, it's running as itself. I would make sure the file you want to write to is somewhere like /shared/tmp/ and that the file is owned by bigd and retest. Make sure bigd has write access, also.

     

  • It was in /var/tmp owned by root and I had run chmod 777 on it so everyone should have access. I moved it to /shared/tmp as you suggested and tried to change the owner to bigd but that user doesn't exist. Any other ideas?

     

  • bigd is not a user as you think, its the monitoring daemon. If this daemon is not running, your monitoring functionality fails. So do not look for bigd as a user. As Chris mentioned, its the file permission & location which matters.

     

    After changing the destination path & updating the file permission, it should work for you.