The API call for obtaining Server Samples has a fair amount of detail, unlike many of the other Uptime Cloud Monitor API calls.
The calling parameters and abbreviations that appear in the data structures are documented at the outset.
The ideal way to get started is to scan the early sections, and then dig into the examples. Refer back to the parameters, keys, and abbreviations when necessary, once you have gotten a feel for using the API.
Server Sample Keys
Note:
the prefacing ‘l_’ means ‘latest’; return most recent sample data.
the prefacing ‘s_’ means ‘separated’; return data from individual components.
Server Samples: Data Types and Units
Other Server Sample Abbreviations
The format of the Process and User arrays are described below.
Additional Process notes:
state
The state is given by a sequence of characters, where the first character indicates the run state of the process.
The state symbol is passed from the OS, without translation. If a symbol appears that is not included below, please check your OS documentation.
I Marks a process that is idle (sleeping for longer than about 20 seconds).
R Marks a runnable process.
S Marks a process that is sleeping for less than about 20 seconds.
T Marks a stopped process.
U Marks a process in uninterruptible wait.
Z Marks a dead process (a zombie).
Retrieve Server Samples
Required Parameters:
uuids
You must specify at least one Server UUID. Up to 20 uuids can be specified in each request. Multiple uuids are specified as a comma-separated string.
Optional Parameters:
starttime
An integer unix timestamp (seconds since epoch) representing the beginning of your query timeframe.
NOTE: if neither starttime or endtime are provided, the last 5 minutes of samples are returned.
endtime
An integer unix timestamp (seconds since epoch) representing the end of your query timeframe.
NOTE: if neither starttime or endtime are provided, the last 5 minutes of samples are returned)
keys
A list of keys you want to include (see “key reference”). Multiple keys are specified as a comma-separated string.
Default: “l_u,l_r,l_b,l_l,m,s,c,i,d”.
NOTE: ‘d’ key is not implemented; however, if you call this api command specifying no keys, the result includes the last 5 minutes of aggregate DiskIO data; meaning that each sample has two values, reads in KB/s, and writes in KB/s
sample_size
Override the default sample size that is determined by the starttime/endtime range. This will only work if you specify a sample_size larger than what is automatically calculated for the time range.
If you specify a smaller sample_size, the default sample_size will be used.
Valid sample sizes range from 5 to 86400 seconds.
Example 1 Retrieving Server Samples, using defaults.
Obtain samples from one system, specifying only the UUID. This will demonstrate the default set of data returned when:
no keys are included in the command, and
the starttime and endtime are not specified.
As noted above, the default keys are “l_u,l_r,l_b,l_l,m,s,c,i,d”.
CURL Command, and variations:
CURL Response:
Response is a JSON-encoded array containing one Server Sample Hash, with 5 minutes of data.
Example 2
Obtain samples from a single system specifying sample_size of 60 seconds. Default keys.
CURL Command, and variations:
CURL Response:
Response is a JSON-encoded array of Server Sample Hashes, same as default except for 60 seconds samples.
Example 3
Obtain samples from a single system specifying sample_size of 60 seconds, and separate network interface metrics.
CURL Command, and variations:
CURL Response:
Response is a JSON-encoded array, containing one Server Sample Hash, with one set of data for each network interface.
Example 4
Obtain the latest health samples from a single system.
CURL Command, and variations:
CURL Response:
Response is a JSON-encoded array, containing one Server Sample Hash, with one set of data for each network interface.
Example 5
Obtain samples from a single system focusing only on processes.
CURL Command, and variations:
CURL Response:
Response is a JSON-encoded array containing one or more Server Sample Hashes, containing the most recent process data.
In this particular example, the returned array contains a single Server Sample Hash.