56. curl -G 'http://localhost:8086/query'
--data-urlencode "db=test"
--data-urlencode "q=SELECT value FROM cpu_load_short WHERE region='us-west'"
{"results":[{"series":[{"name":"cpu_load_short","columns":["time","value"],"values":
[["2015-06-11T20:46:02Z",0.64]]}]}]}
57. // create an array of points
$points = array(
new Point(
'test_metric', // name of the measurement
0.64, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
1435255849 // Time precision has to be set to seconds!
),
new Point(
'test_metric', // name of the measurement
0.84, // the measurement value
['host' => 'server01', 'region' => 'us-west'], // optional tags
['cpucount' => 10], // optional additional fields
1435255849 // Time precision has to be set to seconds!
)
);
// we are writing unix timestamps, which have a second precision
$result = $database->writePoints($points, Database::PRECISION_SECONDS);
65. CREATE CONTINUOUS QUERY <cq_name>
ON <database_name>
[RESAMPLE [EVERY <interval>] [FOR <interval>]]
BEGIN
SELECT <function>(<stuff>)[,<function>(<stuff>)]
INTO <different_measurement>
FROM <current_measurement>
[WHERE <stuff>]
GROUP BY time(<interval>)[,<stuff>]
END