(mt):Get predefined range stats

  • This page was last modified on February 20, 2011, at 04:11.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

This method provides a way to retrieve the resource usage levels for a specific (mt) Media Temple server over certain predefined ranges of time.

Contents

Request Info

The following URL and HTTP methods are available:

HTTP Method URL Resolution *
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/5min
15
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/15min
15
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/30min
15
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/1hour
60
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/1day
900
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/1week
7200
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/1month
28800
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/3month
86400
GET


https://api.mediatemple.net/api/v1/stats/{serviceId}/1year
86400

Resolution is fixed and denotes the interval in seconds that data points are to be returned for. So only one data point per minute will be returned for the 1hour predefined range.

The following parameters must be provided in the URL:

Parameter Type Description
serviceId int The service id

The following query parameters can be provided in the URL:

Parameter Type Description
precision int The numeric precision to use in returned data. Digits to the right of the decimal. DEFAULT=2

Response Info

The response will return an HTTP status code to indicate the general category of success or failure to the client. More specific error codes and messages will be contained in the response data itself, if provided. For more information on response codes and parsing response data, see Parsing API responses.

Sample Request

To get the stats for the past 5 minutes in JSON format, do the following:

curl -D log.txt -s -X "GET" "https://api.mediatemple.net/api/v1/stats/555/5min.json?apikey=a5h34sf62..."

Sample Response

Here is an example of the returned result:

{
"statsList" : {
"timeStamp" : 1284439830,
"resolution" : 15,
"serviceId" : 555,
"stats" : [ {
"timeStamp" : 1284439830,
"cpu" : 47.43482,
"memory" : 40.658417,
"load1Min" : 13.552806,
"load5Min" : 20.329208,
"load15Min" : 27.105612,
"processes" : 39,
"diskSpace" : 33.882015,
"kbytesIn" : 54.211224,
"kbytesOut" : 60.987625,
"packetsIn" : 67.76403,
"packetsOut" : 74.540436,
"state" : 1
}, {
"timeStamp" : 1284439845,
"cpu" : 22.831272,
"memory" : 19.56966,
"load1Min" : 6.52322,
"load5Min" : 9.784831,
"load15Min" : 13.046441,
"processes" : 39,
"diskSpace" : 16.30805,
"kbytesIn" : 26.092882,
"kbytesOut" : 29.354492,
"packetsIn" : 32.6161,
"packetsOut" : 35.877712,
"state" : 1
}, {
"timeStamp" : 1284439860,
"cpu" : 63.22567,
"memory" : 54.19343,
"load1Min" : 18.064478,
"load5Min" : 27.096716,
"load15Min" : 36.128956,
"processes" : 6,
"diskSpace" : 45.161194,
"kbytesIn" : 72.25791,
"kbytesOut" : 81.290146,
"packetsIn" : 90.32239,
"packetsOut" : 99.35462,
"state" : 1
}, {
"timeStamp" : 1284439875,
"cpu" : 43.377197,
"memory" : 37.180454,
"load1Min" : 12.393485,
"load5Min" : 18.590227,
"load15Min" : 24.786968,
"processes" : 4,
"diskSpace" : 30.983711,
"kbytesIn" : 49.57394,
"kbytesOut" : 55.77068,
"packetsIn" : 61.967422,
"packetsOut" : 68.16417,
"state" : 1
}...]
}
}

The returned data points will include all point from now()-5 minutes through now(), where now() is the current time of the request.

Response Fields

The fields in the result represent the following:

Field Description
timeStamp The time these stats were recorded
cpu The percentage of CPU being consumed
memory The percentage of memory currently allocated
load1Min The system load average for the past minute
load5Min The system load average for the past 5 minutes
load15Min The system load average for the past 15 minutes
processes The number of processes currently running
diskSpace The percentage of disk space currently used
kbytesIn The kilobytes in per second
kbytesOut The kilobytes out per second
packetsIn The packets in per second
packetsOut The packets our per second
state The server state (0=off, 1=running)