Oracle GlassFish Server 3.0.1 Monitoring Scripting Client Installation and Quick Start Guide

ProcedureTo Display Information From a Script

To provide statistics to system administrators, a script must display information when the script is run. Monitoring Scripting Client provides a preinstantiated object that has a method for displaying information from scripts. You must use this method to display updated information on standard output on the client system where the script is run. You cannot use the standard printing mechanisms of the JavaScript language because they write information to the server log.

  1. Invoke the client.print method.

    In the invocation of the client.print method, pass the text string to display as the parameter to the method.

Example 1–5 Displaying Information From a Script

This example displays a string similar to the following in standard output each time the function jspLoaded() is called.

js> jsp loaded event called on host = server and count = 1
var njspLoaded=0;

function jspLoaded(hostName) {
    njspLoaded = njspLoaded + 1;
    client.print( '\n js> jsp loaded event called on ' +
            'host = ' + hostName +
            ' and count = ' + njspLoaded);