Skip to content
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.

Summary

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

Examples

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"
}

Scaler creation

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"
}

Rule creation

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"
}
Clone this wiki locally