Skip to content
John Vrbanac edited this page Dec 12, 2013 · 14 revisions

#Overview

Media Types

The API supports application/json encoded as UTF-8.

API Versioning

See the Versioning API

Meniscus workers must be capable of reporting their status and relaying that information to the Coordinator(s). The request will be performed using standard REST and the response will be formatted as JSON.

Information that workers make accessible via REST will depend on the type of persona it is. At a minimum all workers will support the following:

  • At one minute intervals they will publish their system load average and disk usage to the Coordinator(s)

Worker Status API

A worker's status is updated with a single call to the coordinator.

Template

  • All fields required
PUT /v1/worker/{worker-id}/status HTTP/1.1
WORKER-TOKEN: {worker_token}
Content-Type: application/json

{
  "worker_status": {
        "hostname": {hostname},
        "ip_address_v4": {ip_address_v4},
        "ip_address_v6": {ip_address_v6},
        "personality": {worker, coordinator, tenant},
        "status": {online},
        "system_info": {
            "timestamp": {iso8601 timestamp},
            "os_type": {os type string},
            "memory_mb": {int},
            "architecture": {x86, x86_64, amd64, ia64, arm, armel, armhf},
            "cpu_cores": {int},
            "disk_usage": [
                {
                    "device": {system device path},
                    "total": {int},
                    "used": {int}
                }
                ],
            "load_average": {
                "1": {CPU load average 1 minute},
                "5": {CPU load average 5 minutes},
                "15": {CPU load average 15 minutes}
            }
        }
    }
}

Request

PUT /v1/worker/973dcbd2-3af9-462a-8c89-541879b5a557/status HTTP/1.1
ACCEPT: application/json
CONTENT-TYPE: application/json
WORKER-TOKEN: 244c04e3-ca0f-4cfd-959d-3d2ecf11783f
{
    "worker_status": {
        "hostname": "worker-01",
        "ip_address_v4": "192.168.1.1",
        "ip_address_v6": "",
        "personality": "worker",
        "status": "online",
        "system_info": {
            "timestamp": "2013-08-07T17:52:59.737401",
            "os_type": "Darwin-11.4.2-x86_64-i386-64bit",
            "memory_mb": 1024,
            "architecture": "x86_64",
            "cpu_cores": 4,
            "disk_usage": [
                {
                  "device": "/dev/sda1",
                  "total": 313764528,
                  "used": 112512436
                }
            ],
            "load_average": {
                "1": 0.24755859375,
                "5": 1.0751953125,
                "15": 0.9365234375
            }
        }
    }
}

Expected response from the Coordinator:

HTTP/1.1 200 ACCEPTED

Updating Status

See the Update Worker Status documentation

Coordinator Status API

Coordinator's are able to report the status of individual Workers or the entire grid. There are two REST API endpoints.

Fetching Grid Status

Template

GET /v1/status HTTP/1.1

Request

GET /v1/status HTTP/1.1
ACCEPT: application/json
CONTENT-TYPE: application/json

Expected response from the Coordinator:

HTTP/1.1 200 OK
CONTENT-TYPE: application/json

{
    "status": [
        {
            "hostname": "worker-01",
            "worker-id": "50ca63d4-ca6f-40c1-a333-2e37128f934d",
            "ip_address_v4": "192.168.100.101",
            "ip_address_v6": "::1",
            "personality": "correlation|normalization|storage",
            "status": "online",
            "system_info": {
                "os_type": "Darwin-11.4.2-x86_64-i386-64bit",
                "memory_mb": "1024",
                "architecture": "",
                "cpu_cores": "4",
                "disk_usage": [
                    {
                        "device: "/dev/sda1",
                        "total": 313764528,
                        "used": 112512436
                    }
                ],
                "load_average": {
                    "1": 0.24755859375,
                    "5": 1.0751953125,
                    "15": 0.9365234375
                }
            }
        },
        {
            "hostname": "worker-02",
            "worker-id": "7360a5bb-678f-4603-8953-85bc6522579a",
            "ip_address_v4": "192.168.100.102",
            "ip_address_v6": "::1",
            "personality": "correlation|normalization|storage",
            "status": "online",
            "system_info": {
                "os_type": "Darwin-11.4.2-x86_64-i386-64bit",
                "memory_mb": "2048",
                "architecture": "",
                "cpu_cores": "2",
                "disk_usage": [
                    {
                        "device: "/dev/sda1",
                        "total": 313764528,
                        "used": 112512436
                    }
                ],
                "load_average": {
                    "1": 0.59234859375,
                    "5": 1.4871953125,
                    "15": 0.0098234375
                }
            }
        }
    ]
}

Fetching Individual Worker Status

Template

GET /v1/worker/{worker-id}/status HTTP/1.1

Request

GET /v1/worker/50ca63d4-ca6f-40c1-a333-2e37128f934d/status HTTP/1.1
ACCEPT: application/json
CONTENT-TYPE: application/json

Expected response from the Coordinator:

HTTP/1.1 200 OK
CONTENT-TYPE: application/json

{
    "status": {
        "hostname": "worker-01",
        "worker-id": "50ca63d4-ca6f-40c1-a333-2e37128f934d",
        "ip_address_v4": "192.168.100.101",
        "ip_address_v6": "::1",
        "personality": "correlation|normalization|storage",
        "status": "online",
        "system_info": {
            "os_type": "Darwin-11.4.2-x86_64-i386-64bit",
            "memory_mb": "1024",
            "architecture": "",
            "cpu_cores": "4",
            "disk_usage": [
                 {
                     "device: "/dev/sda1",
                     "total": 313764528,
                     "used": 112512436
                 }
            ],
            "load_average": {
                "1": 0.24755859375,
                "5": 1.0751953125,
                "15": 0.9365234375
            }
        }
    }
}

Clone this wiki locally