Cosmo Monitoring
Server Status Page
Cosmo 0.2.4 introduced a rudimentary server status page in the admin console at
/admin/status
. This page shows memory usage statistics gathered from the JVM.
Future versions of Cosmo will use JMX to add Cosmo data to the server status page and will likely remove JVM-level statistics, as all servlet containers and app servers likely have their own management interfaces. Additionally, Cosmo will likely support remote monitoring via JMX clients.
Status Dump
A simple plain text version of the status data can be dumped by requesting the URL
/admin/status/dump
. The format uses key/value pairs, one per line, with = separating the key and value. The data may include blank/whitespace lines and/or lines with comments signifed by a leading #.
Client programs that wish to dump status data must simulate logging into the web UI by following these steps:
-
GET /security_check?j_username=<username>&j_password=<password>
where username and password are the credentials linked to an administrative account
- Extract the session cookie from the login response
-
GET /status/dump
and pass the session cookie
Example:
>>> REQUEST <<<
GET /security_check?j_username=root&j_password=cosmo HTTP/1.1
>>> RESPONSE <<<
HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
X-Cosmo-Version: 0.7-SNAPSHOT
Set-Cookie: JSESSIONID=8F5A6AC8B21DF5A657AB84405CAB6379; Path=/
Content-Type: text/plain;charset=UTF-8
Content-Length: 19
Date: Fri, 09 Feb 2007 20:02:21 GMT
/cosmo/account/view
>>> REQUEST <<<
GET /status/dump HTTP/1.1
Cookie: JSESSIONID=8F5A6AC8B21DF5A657AB84405CAB6379; Path=/
>>> RESPONSE <<<
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache,no-store,max-age=0
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 91
Date: Fri, 02 Dec 2005 23:44:05 GMT
jvm.memory.max=129664
jvm.memory.total=32576
jvm.memory.used=12514
jvm.memory.free=20062
The status dump will probably be removed in a future version of Cosmo once JMX management is enabled.
Garbage Collection
The "Run garbage collector" button on the server status page allows a user or client to manually invoke garbage collection. A button press can be programmatically simulated by requesting the URL
/status/gc.do
in the context of an authenticated web UI session (as above). A successful response will be a 302 redirect back to
/status
.