Website health monitoring
This library provides a minimal set of libraries to run your own tests and add your test suite to an external monitoring tool, like Nagios. You can also run the tests manually by opening the health check website in your browser.
To do this, the library defines a template health.run which can be called on the psite.health root of the health checks. This template will output / echo 'OK' if all checks ar ok. If any check fails, it will display all errors encountered in all tests.
To set this up, load this library unnamed:
Create a new psite.health next to the site you want to check. You could use any other location, but you want an easy way to link your own tests to the site to check.
Create psection.health objects under this psite.health. These section group your tests together, usefull when manually checking the health site.
Under the psection.health objects create a ppage.health object for each test. In each ppage.health you simply create a new template 'view.html' which will run your test. This view.html template simply echoes 'OK' if the test succeeds. Any other output will be seen as an error message and fails the test. This output is shown in health.run and in your browser if you are checking manually.
For now each check is called using the http client, so no state is shared between each test. This also makes the tests slow so in the future this will probably become optional.
You can create and call as many templates as you want on each ppage.health, only the view.html is called directly by the test framework.