-
Notifications
You must be signed in to change notification settings - Fork 4
API
Maximilien Richer edited this page Aug 9, 2016
·
3 revisions
The API listen by default on :3000
. Use the -l
option to set the listening address and port.
For obvious security reasons, adding command probes via the API is forbidden by default. If you really want to use this feature you can force it using the --allow-cmd-probe
flag at startup.
URL | HTTP verb | Description |
---|---|---|
/v1/scalers | GET | List scalers |
/v1/scalers | POST | Create scaler |
/v1/scalers/:name | GET | Describe scalers |
/v1/rules | GET | List rules |
/v1/rules | POST | Create rule |
/v1/rules/:name | GET | Describe rules |
Request on /v1/rules
return the following reponse:
HTTP/1.1 200 OK
{
"rules": [
"whoami-cpu-scale",
"whoami2-cpu-scale"
]
}
Request on /v1/rules/whoami-cpu-scale
return the following reponse:
HTTP/1.1 200 OK
{
"Probe": {
"Cmd": "./traefik_rt.sh"
},
"RefreshRate": 3000000000,
"Scale": {
"config": "docker-compose.yaml",
"running": 1,
"service": "whoami"
},
"ServiceName": "whoami"
}
POST /v1/scalers HTTP/1.1
{
"args": {
"config": "./examples/docker-compose/traefik/docker-compose.yaml",
"service": "whoami"
},
"name": "testing",
"type": "docker-compose"
}
HTTP/1.1 201 Created
{
"scaler": "testing"
}
POST /v1/rules HTTP/1.1
{
"down": "< 1.5",
"probe": "swarm.cpu_average",
"probeArgs": {
"Tag": "whoami"
},
"resfreshRate": 10000000000,
"rule": "custom",
"scaler": "whoami-compose",
"service": "whoami",
"up": "> 2"
}
HTTP/1.1 201 Created
{
"rule": "custom"
}