Tuesday, October 28, 2008

Using nagios to check PHP script execution time

We want to record the execution time of some of our PHP scripts.  I want to use nagios to do this but it is proving rather difficult.

Initially I was hoping I could provide some credentials to nagios for it to use and log into our web site, run a set of scripts, and then report back to us how long each script took.  Since our site does not use basic authentication I cannot do it the intial way I wanted.  

To work around the issues we are having and hopefully NOT have to write our own nagios plug-in here is what I am proposing.

Create a test directory that uses basic authentication so it is protected from the general public and has a set of scripts that we run with the execution time posted near the bottom.  We then use the standard check_http plug-in from nagios to search for that string and parse it as normal. 

Hopefully this approach to things won't take too long to develop and prototype.  Also I hope to report back with a follow up on what I actually did (with code examples) to get this working.

No comments: