var Hapi = require('hapi');
var server = new Hapi.Server(3000);

server.route({
    method: 'GET',
    path: '/',
    handler: function (request, reply) {
        reply('Transaction Monitoring');
    }
});

server.route({
    method: 'GET',
    path: '/{name}',
    handler: function (request, reply) {
        console.log(request.params.name);
        var spawn = require('child_process').spawn,
        casper = spawn('casperjs', ['test', './siteTests/' + request.params.name + '.js']);
        
        casper.stdout.on('data', function (data) {
            console.log('' + data);
        });
        
        casper.on('exit', function(code){
            if(code== 10){
                rdata = '<status>ok</status>';
            }
            else{
                rdata = '<status>fail</status>';
            }
            reply(rdata);
        });
    }
});

server.start(function () {
    console.log('Server running at:', server.info.uri);
});

@@ -390,16 +390,44 @@
 .spawn,%0A
+        start = new Date();%0A
         
@@ -685,66 +685,265 @@
     
-if(code== 10)%7B%0A                rdata = '%3Cstatus%3Eok%3C/status
+end = new Date()%0A            elapsed = start - end%0A            elapsed = elapsed * -1%0A            if(code== 10)%7B%0A                rdata = '%3Cpingdom_http_custom_check%3E%3Cstatus%3Eok%3C/status%3E%3Cresponse_time%3E' + elapsed + '%3C/response_time%3E%3C/pingdom_http_custom_check
 %3E';%0A
@@ -1004,19 +1004,46 @@
 = '%3C
+pingdom_http_custom_check%3E%3C
 status%3E
-fail
+down
 %3C/st
@@ -1047,16 +1047,74 @@
 /status%3E
+%3Celapsed%3E' + elapsed + '%3C/time%3E%3Cpingdom_http_custom_check%3E
 ';%0A     
@@ -1142,24 +1142,41 @@
 reply(rdata)
+.type('text/xml')
 ;%0A        %7D)

Put responses in pingdom xml format