servercheck

See also

Check Extensions

GET

Fetches identifying and meta information as well as “check” values regarding all servers that have a Type with a name beginning with “EDGE” or “MID” (ostensibly this is equivalent to all cache servers).

Auth. Required

Yes

Roles Required

None

Response Type

Array

Request Structure

No parameters available.

Response Structure

adminState

The name of the server’s Status - called “adminState” for legacy reasons

cacheGroup

The name of the Cache Group to which the server belongs

checks

An optionally present map of the names of “checks” to their values. Only numeric and boolean checks are represented, and boolean checks are represented as integers with 0 meaning “false” and 1 meaning “true”. Will not appear if the server in question has no valued “checks”.

hostName

The (short) hostname of the server

id

The server’s integral, unique identifier

profile

The name of the Profile used by the server

revalPending

A boolean that indicates whether or not the server has pending revalidations

type

The name of the server’s Type

updPending

A boolean that indicates whether or not the server has pending updates

#476 Response Example
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Thu, 23 Jan 2020 20:00:19 GMT; Max-Age=3600; HttpOnly
X-Server-Name: traffic_ops_golang/
Date: Thu, 23 Jan 2020 19:00:19 GMT
Content-Length: 352

{ "response": [
    {
        "adminState": "REPORTED",
        "cacheGroup": "CDN_in_a_Box_Edge",
        "id": 12,
        "hostName": "edge",
        "revalPending": false,
        "profile": "ATS_EDGE_TIER_CACHE",
        "type": "EDGE",
        "updPending": false
    },
    {
        "adminState": "REPORTED",
        "cacheGroup": "CDN_in_a_Box_Mid",
        "id": 11,
        "hostName": "mid",
        "revalPending": false,
        "profile": "ATS_MID_TIER_CACHE",
        "type": "MID",
        "updPending": false
    }
]}

POST

Post a server check result to the “serverchecks” table. Updates the resulting value from running a given check extension on a server.

Auth. Required

Yes

Roles Required

None1

Response Type

Object

Request Structure

The request only requires to have either host_name or id defined.

host_name

The hostname of the server to which this “servercheck” refers.

id

The id of the server to which this “servercheck” refers.

servercheck_short_name

The short name of the “servercheck”.

value

The value of the “servercheck”

#477 Request Example
POST /api/2.0/servercheck HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 113
Content-Type: application/json

{
    "id": 1,
    "host_name": "edge",
    "servercheck_short_name": "test",
    "value": 1
}

Response Structure

#478 Response Example
{ "alerts": [
    {
        "level": "success",
        "text": "Server Check was successfully updated."
    }
]}
1

No roles are required to use this endpoint, however access is controlled by username. Only the reserved user extension is permitted the use of this endpoint.