forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Yang, Tong <yangtong2@huawei.com> Co-committed-by: Yang, Tong <yangtong2@huawei.com>
55 lines
3.9 KiB
HTML
55 lines
3.9 KiB
HTML
<a name="mrs_01_0472"></a><a name="mrs_01_0472"></a>
|
|
|
|
<h1 class="topictitle1">Running the curl Command to Operate OpenTSDB</h1>
|
|
<div id="body1589421654460"><div class="section" id="mrs_01_0472__section937319270818"><h4 class="sectiontitle">Writing Data</h4><p id="mrs_01_0472__p153773518814">For example, to write data of a metric named <strong id="mrs_01_0472__b206155510434">testdata</strong>, whose timestamp is <strong id="mrs_01_0472__b162077415445">1524900185</strong>, value is <strong id="mrs_01_0472__b328517164414">true</strong>, tag is <strong id="mrs_01_0472__b187437105444">key</strong> and <strong id="mrs_01_0472__b12635205494416">value</strong>, run the following command:</p>
|
|
<pre class="codeblock" id="mrs_01_0472__codeblock13280171920918">curl -ki -X POST -d '{"metric":"testdata", "timestamp":1524900185, "value":"true", "tags":{"key":"value"}}' https://<tsd_ip>:4242/api/put?sync</pre>
|
|
<p id="mrs_01_0472__p933373172215"><strong id="mrs_01_0472__b51671650194611"><tsd_ip></strong>: indicates the IP address of the TSD instance of OpenTSDB to which data is to be written.</p>
|
|
<pre class="screen" id="mrs_01_0472__screen1031413371093">HTTP/1.1 204 No Content
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length:0</pre>
|
|
</div>
|
|
<div class="section" id="mrs_01_0472__section126481332391"><h4 class="sectiontitle">Querying Data</h4><p id="mrs_01_0472__p105870161115">For example, to query summary information about the <strong id="mrs_01_0472__b142051616154915">testdata</strong> metric in the past three years, run the following command:</p>
|
|
<pre class="codeblock" id="mrs_01_0472__codeblock16313491110">curl -ks https://<tsd_ip>:4242/api/query?start=3y-ago\&m=sum:testdata | python -m json.tool</pre>
|
|
<ul id="mrs_01_0472__ul7604723151213"><li id="mrs_01_0472__li14604192317127"><strong id="mrs_01_0472__b129929412496"><tsd_ip></strong>: indicates the IP address or host name of the TSD instance of OpenTSDB that needs to be accessed.</li><li id="mrs_01_0472__li66043239124"><strong id="mrs_01_0472__b1336315414507"><start=3y-ago\&m=sum:testdata></strong>: Translates the <strong id="mrs_01_0472__b13964112385119">&</strong> symbol, which may not be identified in the request.</li><li id="mrs_01_0472__li360414233123">(Optional) <strong id="mrs_01_0472__b1182988521"><python -m json.tool></strong>: Converts the response request to the JSON format.</li></ul>
|
|
<pre class="screen" id="mrs_01_0472__screen1130179151113">[
|
|
{
|
|
"aggregateTags": [],
|
|
"dps": {
|
|
"1524900185": 1
|
|
},
|
|
"metric": "testdata",
|
|
"tags": {
|
|
"key": "value"
|
|
}
|
|
}
|
|
]</pre>
|
|
</div>
|
|
<div class="section" id="mrs_01_0472__section1740125111310"><h4 class="sectiontitle">Querying <strong id="mrs_01_0472__b11254114444711">tsd</strong> Status</h4><p id="mrs_01_0472__p19941133511317">For example, to query information about the client connected to HBase, run the following command:</p>
|
|
<pre class="codeblock" id="mrs_01_0472__codeblock144712590132">curl -ks https://<tsd_ip>:4242/api/stats/region_clients | python -m json.tool</pre>
|
|
<p id="mrs_01_0472__p1746622813264"><strong id="mrs_01_0472__b13913431165318"><tsd_ip></strong>: indicates the IP address of the TSD instance of OpenTSDB that needs to be accessed.</p>
|
|
<pre class="screen" id="mrs_01_0472__screen8609182312146">[
|
|
{
|
|
"dead": false,
|
|
"endpoint":"/xx.xx.xx.xx:16020",
|
|
"inflightBreached": 0,
|
|
"pendingBatchedRPCs": 0,
|
|
"pendingBreached": 0,
|
|
"pendingRPCs": 0,
|
|
"rpcResponsesTimedout": 0,
|
|
"rpcResponsesUnknown": 0,
|
|
"rpcid": 78,
|
|
"rpcsInFlight": 0,
|
|
"rpcsSent": 79,
|
|
"rpcsTimedout": 0,
|
|
"writesBlocked": 0
|
|
}
|
|
]</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_0599.html">Using OpenTSDB</a></div>
|
|
</div>
|
|
</div>
|
|
|