Project Wonder additions to wotaskd and JavaMonitor

Version 71.1 by Pascal Robert on 2009/08/08 20:44

Introduction

wotaskd and JavaMonitor were open sourced when WebObjects 5.4 was released in 2007. In 2008 and 2009, the source was modified and included in Project Wonder. This is the list of additions that were added to the Wonder versions of the tools.

Statistics

If you call http://monitorhost:port/cgi-bin/WebObjects/JavaMonitor.woa/wa/statistics, the answer send you back statistics, in JSON format, about instances, per application. Sample :


(
{
"configuredInstances" = "2";
"maxSessions" = "0";
"maxAvgIdleTime" = "2.078";
"avgTransactions" = "44.0000";
"sumSessions" = "0";
"avgAvgTransactionTime" = "0.0985000";
"refusingInstances" = "0";
"avgSessions" = "0.0000";
"maxTransactions" = "88";
"applicationName" = "AjaxExample";
"avgAvgIdleTime" = "1.0390000";
"maxAvgTransactionTime" = "0.197";
"runningInstances" = "2";
"sumTransactions" = "88";
},
{
"configuredInstances" = "2";
"maxSessions" = "0";
"maxAvgIdleTime" = "325.443";
"avgTransactions" = "0.5000";
"sumSessions" = "0";
"avgAvgTransactionTime" = "0.00000";
"refusingInstances" = "0";
"avgSessions" = "0.0000";
"maxTransactions" = "1";
"applicationName" = "AjaxExample2";
"avgAvgIdleTime" = "162.7215000";
"maxAvgTransactionTime" = "0.0";
"runningInstances" = "2";
"sumTransactions" = "1";
}
)

If JavaMonitor is configured with a password, and I hope you do, pass pw=monitorpassword as a argument to the query :

http://monitorhost:port/cgi-bin/WebObjects/JavaMonitor.woa/wa/statistics?pw=monitorpassword

Direct Actions to many tasks

You can do most of the standard tasks you do in Monitor by calling direct actions. They are in a different query handler, /admin. They follow the same format and use the same query parameters. Those DA can be useful if you need to restart instances or other tasks within ant or other build/deployment systems.

?type=all : return details about all applications and instances
?type=app&name=AppName : return details about all instances of a specific application
?type=ins&name=AppName-InstanceNo : return details about one specific instance

For example, if you want to get details about all instances and applications, you call :

http://hostname:56789/cgi-bin/WebObjects/JavaMonitor.woa/admin/info?type=all

To get details about the AjaxExample application :

http://hostname:56789/cgi-bin/WebObjects/JavaMonitor.woa/admin/info?type=app&name=AjaxExample

And for a specific instance :

http://hostname:56789/cgi-bin/WebObjects/JavaMonitor.woa/admin/info?type=ins&name=AjaxExample-1

The response for the direct actions will either send a JSON array or YES/NO. For example, the query info for all instances will return :


[{"name": "AjaxExample", "id": "1", "host": "leopards.macti.lan", "port": "2001", "state": "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
"transactions": "88", "activeSessions": "0", "averageIdlePeriod": "2.078", "avgTransactionTime": "0.197"},
{"name": "AjaxExample", "id": "2", "host": "leopards.macti.lan", "port": "2002", "state": "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
"transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0.0", "avgTransactionTime": "0.0"},
{"name": "AjaxExample2", "id": "1", "host": "leopards.macti.lan", "port": "2003", "state": "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
"transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0.0", "avgTransactionTime": "0.0"},
{"name": "AjaxExample2", "id": "2", "host": "leopards.macti.lan", "port": "2004", "state": "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
"transactions": "1", "activeSessions": "0", "averageIdlePeriod": "325.443", "avgTransactionTime": "0.0"}]

List of available direct actions :

/info : return details (number of deaths, state, etc.; see above), in JSON, about an instance.
/running : return YES if the instance is running, NO if not.
/stopped : return NO if the instance is running, YES if not.
/bounce: more on it later.
/clearDeaths : clear the number of deaths (same action as clicking the "Clear deaths" in JavaMonitor)
/turnScheduledOn : turn scheduling on for an application or instance. Call /turnScheduledOff to do the opposite.
/turnRefuseNewSessionsOn : turn "Refuse new sessions" on, call turnRefuseNewSessionsOff to do the opposite.
/turnAutoRecoverOn : guess what? It activate "Auto recover"! And guess again? /turnAutoRecoverOff do the opposite!
/forceQuit : force quit an application, might be useful to call it from a monitoring system.
/stop : stop an application/instance the normal way.
/start : start an application/instance the normal way.

Automatic archive of SiteConfig.xml

On every change you do to the configuration, a backup of SiteConfig.xml will be done in, by default, /Library/WebObjects/Configuration.