Since MoSKito 2.2.0 MoSKito Inspect has an integrated RESTful interface, that is parallel to the user interface. This document defines the usage of the MoSKito Inspect RESTful interface.
This document is describes the api for 2.2.x to 2.5.x
Since 2.6.x there is a new API: MoSKito Inspect REST API
General
Request format
Requests to the REST Interface should have the form:
http://server:port/<appname>/<restpath>/<section>/<usecase>/<parameters>
Not all parts of the path must be always present.
Sections
The following text is divided into section and use-cases in the exact order of the url names. So if you want to call list use case from accumulators section, you simply call:
http://server:port/<appname>/<restpath>/accumulators/list or http://localhost:8080/moskito/moskito-inspect-rest/accumulators/list
accumulators
Requests to the /accumulators/* path are handled by net.anotheria.moskito.webui.accumulators.resource.AccumulatorResource.
list
Method | GET | |
Reply | { "success": true, "results": { "accumulators": [ { "id": "6", "name": "OldGenFree 1m", "path": "MemoryPool-PS Old Gen-Heap.MemoryPool-PS Old Gen-Heap.Free/1m/MILLISECONDS", "numberOfValues": 0, "lastValueTimestamp": "none", "maxNumberOfValues": 0 }, { "id": "12", "name": "OldGenFree 5m", "path": "MemoryPool-PS Old Gen-Heap.MemoryPool-PS Old Gen-Heap.Free/5m/MILLISECONDS", "numberOfValues": 0, "lastValueTimestamp": "none", "maxNumberOfValues": 0 }, ... |
get/{id}
Method | GET | |
Parameters | id | path parameter |
Example | http://{{url}}:{{port}}/{{app}}/moskito-inspect-rest/accumulators/get/22 | |
Reply | { "success": true, "results": { "graphData": { "name": "URL REQ 5m", "data": [ { "values": [ "25" ], "timestamp": "23:38", "isoTimestamp": "2013-02-13T23:38:01,723" }, { "values": [ "0" ], "timestamp": "23:43", "isoTimestamp": "2013-02-13T23:43:01,724" }, { "values": [ "0" ], "timestamp": "23:48", "isoTimestamp": "2013-02-13T23:48:01,724" }, { "values": [ "0" ], "timestamp": "23:53", "isoTimestamp": "2013-02-13T23:53:01,723" }, { "values": [ "2" ], "timestamp": "23:58", "isoTimestamp": "2013-02-13T23:58:01,724" } ] }, "accumulator": { "id": "36", "name": "URL REQ 5m", "path": "RequestURIFilter.cumulated.REQ/5m/MILLISECONDS", "numberOfValues": 5, "lastValueTimestamp": "2013-02-13T23:58:01,724", "maxNumberOfValues": 0 } } } |
remove/{id}
Specify the id of accumulator to delete it.
Method | GET | |
Parameters | id | path parameter |
Example | http://{{url}}:{{port}}/{{app}}/moskito-inspect-rest/accumulators/remove/18 | |
Reply | { "success": "true" } |
create - POST
Method | POST | |
Parameters | see example | |
Example: | http://{{url}}:{{port}}/{{app}}/moskito-inspect-rest/accumulators/create { "name": "TestAccumulator", "producerId": "ThreadCount", "interval": "1m", "unit": "MILLISECONDS", "statName": "ThreadCount", "valueName": "current" } | |
Reply | { "success": true, "results": { "created": { "id": "47", "name": "TestAccumulator-3", "path": "ThreadCount.ThreadCount.current/1m/MILLISECONDS", "numberOfValues": 0, "lastValueTimestamp": "none", "maxNumberOfValues": 0 } } } |
Note, if the name is already used, a new name is selected, which is old name plus -number.
thresholds
Requests to the /thresholds/* path are handled by net.anotheria.moskito.webui.threshold.resource.ThresholdResource.
The list of thresholds includes definitions and statuses.
list
Method | GET | |
Reply | { "success": "true", "results": { "definitions": { "ThresholdDefinition": [ { "id": "3", "name": "ThreadCount", "producerName": "ThreadCount", "statName": "ThreadCount", "valueName": "Current", "intervalName": "default", "descriptionString": "ThreadCount.ThreadCount.Current/default/MILLISECONDS", "timeUnit": "MILLISECONDS" }, { "id": "1", "name": "PermGenFree", "producerName": "MemoryPool-PS Perm Gen-NonHeap", "statName": "MemoryPool-PS Perm Gen-NonHeap", "valueName": "Free", "intervalName": "1m", "descriptionString": "MemoryPool-PS Perm Gen-NonHeap.MemoryPool-PS Perm Gen-NonHeap.Free/1m/MILLISECONDS", "timeUnit": "MILLISECONDS" }, { "id": "2", "name": "OldGenFree", "producerName": "MemoryPool-PS Old Gen-Heap", "statName": "MemoryPool-PS Old Gen-Heap", "valueName": "Free", "intervalName": "1m", "descriptionString": "MemoryPool-PS Old Gen-Heap.MemoryPool-PS Old Gen-Heap.Free/1m/MILLISECONDS", "timeUnit": "MILLISECONDS" } ] }, "statuses": { "ThresholdStatus": [ { "name": "ThreadCount", "colorCode": "green", "timestamp": "2015-02-10T01:28:14,974", "description": "ThreadCount.ThreadCount.Current/default/MILLISECONDS", "value": "23", "timestampInMillis": "1423528094974", "id": "3", "flipCount": "1" }, ... |
definitions
Method | GET | |
Reply | { "success": "true", "results": { "definitions": { "ThresholdDefinition": [ { "id": "3", "name": "ThreadCount", "producerName": "ThreadCount", "statName": "ThreadCount", "valueName": "Current", "intervalName": "default", "descriptionString": "ThreadCount.ThreadCount.Current/default/MILLISECONDS", "timeUnit": "MILLISECONDS" }, { "id": "1", "name": "PermGenFree", "producerName": "MemoryPool-PS Perm Gen-NonHeap", "statName": "MemoryPool-PS Perm Gen-NonHeap", "valueName": "Free", "intervalName": "1m", "descriptionString": "MemoryPool-PS Perm Gen-NonHeap.MemoryPool-PS Perm Gen-NonHeap.Free/1m/MILLISECONDS", "timeUnit": "MILLISECONDS" }, { "id": "2", "name": "OldGenFree", "producerName": "MemoryPool-PS Old Gen-Heap", "statName": "MemoryPool-PS Old Gen-Heap", "valueName": "Free", "intervalName": "1m", "descriptionString": "MemoryPool-PS Old Gen-Heap.MemoryPool-PS Old Gen-Heap.Free/1m/MILLISECONDS", "timeUnit": "MILLISECONDS" } ] } } } |
statuses
Method | GET | |
Reply | { "success": "true", "results": { "statuses": { "ThresholdStatus": [ { "name": "ThreadCount", "colorCode": "green", "timestamp": "2015-02-11T01:28:11,844", "description": "ThreadCount.ThreadCount.Current/default/MILLISECONDS", "value": "21", "timestampInMillis": "1423614491844", "id": "3", "flipCount": "1" }, ... |
alerts
Method | GET | |
Reply | { "success": "true", "results": { "status": { "ThresholdAlert": { "id": "3", "name": "ThreadCount", "timestamp": "2015-02-11T01:28:11,850", "oldStatus": "OFF", "oldColorCode": "off", "oldValue": "none yet", "newStatus": "GREEN", "newColorCode": "green", "newValue": "14" } } } } |
remove/{id}
Specify the id of threshold to delete it.
Method | GET | |
Parameters | id | path parameter |
Example | http: //{{url}}:{{port}}/{{app}}/moskito-inspect-rest/thresholds/remove/2 | |
Reply | { "success": "true" } |
create - POST
worstStatus
Returns the worst status of all thresholds. Takes no parameters.
Example output:
{ "success": true, "results": { "status": "GREEN" } }
worstStatusForSelectedThresholds - POST
producers
categories
subsystem