Add /status example and /summary stub

This commit is contained in:
Scott Schneider 2015-02-25 12:02:13 -08:00
parent 4e41b83b95
commit a36ff01e8b

View file

@ -70,7 +70,9 @@ vmpooler provides an API and web front-end (dashboard) on port `:4567`. See the
vmpooler provides a REST API for VM management. The following examples use `curl` for communication. vmpooler provides a REST API for VM management. The following examples use `curl` for communication.
#### GET /vm #### VM operations
##### GET /vm
Retrieve a list of available VM pools. Retrieve a list of available VM pools.
@ -84,7 +86,7 @@ $ curl --url vmpooler.company.com/vm
] ]
``` ```
#### POST /vm ##### POST /vm
Useful for batch operations; post JSON (see format below), get back VMs. Useful for batch operations; post JSON (see format below), get back VMs.
@ -106,7 +108,7 @@ $ curl -d '{"debian-7-i386":"2","debian-7-x86_64":"1"}' --url vmpooler.company.c
} }
``` ```
#### POST /vm/<pool> ##### POST /vm/<pool>
Check-out a VM or VMs. Check-out a VM or VMs.
@ -143,7 +145,7 @@ $ curl -d --url vmpooler.company.com/vm/debian-7-i386+debian-7-i386+debian-7-x86
} }
``` ```
#### GET /vm/<hostname> ##### GET /vm/<hostname>
Query a checked-out VM. Query a checked-out VM.
@ -162,7 +164,7 @@ $ curl --url vmpooler.company.com/vm/pxpmtoonx7fiqg6
} }
``` ```
#### PUT /vm/<hostname> ##### PUT /vm/<hostname>
Modify a checked-out VM. Modify a checked-out VM.
@ -175,7 +177,7 @@ $ curl -X PUT -d '{"lifetime":"2"}' --url vmpooler.company.com/vm/fq6qlpjlsskycq
} }
``` ```
#### DELETE /vm/<hostname> ##### DELETE /vm/<hostname>
Schedule a checked-out VM for deletion. Schedule a checked-out VM for deletion.
@ -188,6 +190,74 @@ $ curl -X DELETE --url vmpooler.company.com/vm/fq6qlpjlsskycq6
} }
``` ```
#### Status and metrics
##### GET /status
A "live" status endpoint, representing the current state of the service.
```
$ curl --url vmpooler.company.com/status
```
```json
{
"capacity": {
"current": 716,
"total": 717,
"percent": 99.9
},
"clone": {
"duration": {
"average": 8.8,
"min": 2.79,
"max": 69.76
},
"count": {
"total": 1779
}
},
"queue": {
"pending": 1,
"cloning": 0,
"booting": 1,
"ready": 716,
"running": 142,
"completed": 0,
"total": 859
},
"status": {
"ok": true,
"message": "Battle station fully armed and operational."
}
}
```
If there are empty pools, the "status" section will convey this:
```json
"status": {
"ok": false,
"message": "Found 2 empty pools.",
"empty": [
"centos-6-x86_64",
"debian-7-x86_64"
]
}
```
##### GET /summary
...
```
$ curl --url vmpooler.company.com/summary
```
```json
{
...
}
```
### Dashboard ### Dashboard
A dashboard is provided to offer real-time statistics and historical graphs. It looks like this in a large installation on a fairly busy day: A dashboard is provided to offer real-time statistics and historical graphs. It looks like this in a large installation on a fairly busy day: