Update URL examples (#2207)

added div with copy function
This commit is contained in:
Yurii Kravets 2022-02-22 20:08:35 +02:00 committed by Aliaksandr Valialkin
parent fc6f71fba8
commit 538114cd7c
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -10,15 +10,23 @@ sort: 20
**Deletes time series from VictoriaMetrics** **Deletes time series from VictoriaMetrics**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl 'http://<victoriametrics-addr>:8428/api/v1/admin/tsdb/delete_series?match[]=vm_http_request_errors_total' curl 'http://<victoriametrics-addr>:8428/api/v1/admin/tsdb/delete_series?match[]=vm_http_request_errors_total'
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl 'http://<vmselect>:8481/delete/0/prometheus/api/v1/admin/tsdb/delete_series?match[]=vm_http_request_errors_total' curl 'http://<vmselect>:8481/delete/0/prometheus/api/v1/admin/tsdb/delete_series?match[]=vm_http_request_errors_total'
``` ```
</div>
Additional information: Additional information:
* [How to delete time series](https://docs.victoriametrics.com/#how-to-delete-time-series) * [How to delete time series](https://docs.victoriametrics.com/#how-to-delete-time-series)
@ -28,15 +36,23 @@ Additional information:
**Exports CSV data from VictoriaMetrics** **Exports CSV data from VictoriaMetrics**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl 'http://<victoriametrics-addr>:8428/api/v1/export/csv?format=__name__,__value__,__timestamp__:unix_s&match=vm_http_request_errors_total' > filename.txt curl 'http://<victoriametrics-addr>:8428/api/v1/export/csv?format=__name__,__value__,__timestamp__:unix_s&match=vm_http_request_errors_total' > filename.txt
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl -G 'http://<vmselect>:8481/select/0/prometheus/api/v1/export/csv?format=__name__,__value__,__timestamp__:unix_s&match=vm_http_request_errors_total' > filename.txt curl -G 'http://<vmselect>:8481/select/0/prometheus/api/v1/export/csv?format=__name__,__value__,__timestamp__:unix_s&match=vm_http_request_errors_total' > filename.txt
``` ```
</div>
Additional information: Additional information:
* [How to export time series](https://docs.victoriametrics.com/#how-to-export-csv-data) * [How to export time series](https://docs.victoriametrics.com/#how-to-export-csv-data)
* [URL Format](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format) * [URL Format](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format)
@ -47,15 +63,23 @@ Additional information:
**Exports data from VictoriaMetrics in native format** **Exports data from VictoriaMetrics in native format**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl -G 'http://<victoriametrics-addr>:8428/api/v1/export/native?match[]=vm_http_request_errors_total' > filename.txt curl -G 'http://<victoriametrics-addr>:8428/api/v1/export/native?match[]=vm_http_request_errors_total' > filename.txt
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl -G 'http://<vmselect>:8481/select/0/prometheus/api/v1/export/native?match=vm_http_request_errors_total' > filename.txt curl -G 'http://<vmselect>:8481/select/0/prometheus/api/v1/export/native?match=vm_http_request_errors_total' > filename.txt
``` ```
</div>
More information: More information:
* [How to export data in native format](https://docs.victoriametrics.com/#how-to-export-data-in-native-format) * [How to export data in native format](https://docs.victoriametrics.com/#how-to-export-data-in-native-format)
@ -65,15 +89,23 @@ More information:
**Imports data obtained via /api/v1/export** **Imports data obtained via /api/v1/export**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl --data-binary "@import.txt" -X POST 'http://destination-victoriametrics:8428/api/v1/import' curl --data-binary "@import.txt" -X POST 'http://destination-victoriametrics:8428/api/v1/import'
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl --data-binary "@import.txt" -X POST 'http://<vminsert>:8480/insert/prometheus/api/v1/import' curl --data-binary "@import.txt" -X POST 'http://<vminsert>:8480/insert/prometheus/api/v1/import'
``` ```
</div>
Additional information: Additional information:
* [How to import time series data](https://docs.victoriametrics.com/#how-to-import-time-series-data) * [How to import time series data](https://docs.victoriametrics.com/#how-to-import-time-series-data)
@ -83,17 +115,25 @@ Additional information:
**Imports CSV data to VictoriaMetrics** **Imports CSV data to VictoriaMetrics**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl --data-binary "@import.txt" -X POST 'http://localhost:8428/api/v1/import/prometheus' curl --data-binary "@import.txt" -X POST 'http://localhost:8428/api/v1/import/prometheus'
curl -d "GOOG,1.23,4.56,NYSE" 'http://localhost:8428/api/v1/import/csv?format=2:metric:ask,3:metric:bid,1:label:ticker,4:label:market' curl -d "GOOG,1.23,4.56,NYSE" 'http://localhost:8428/api/v1/import/csv?format=2:metric:ask,3:metric:bid,1:label:ticker,4:label:market'
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl --data-binary "@import.txt" -X POST 'http://<vminsert>:8480/insert/0/prometheus/api/v1/import/csv' curl --data-binary "@import.txt" -X POST 'http://<vminsert>:8480/insert/0/prometheus/api/v1/import/csv'
curl -d "GOOG,1.23,4.56,NYSE" 'http://<vminsert>:8480/insert/0/prometheus/api/v1/import/csv?format=2:metric:ask,3:metric:bid,1:label:ticker,4:label:market' curl -d "GOOG,1.23,4.56,NYSE" 'http://<vminsert>:8480/insert/0/prometheus/api/v1/import/csv?format=2:metric:ask,3:metric:bid,1:label:ticker,4:label:market'
``` ```
</div>
Additional information: Additional information:
* [URL format](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format) * [URL format](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#url-format)
* [How to import CSV data](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-import-csv-data) * [How to import CSV data](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-import-csv-data)
@ -104,6 +144,8 @@ Additional information:
**Sends data from DataDog agent to VM** **Sends data from DataDog agent to VM**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
echo ' echo '
{ {
@ -126,7 +168,11 @@ echo '
' | curl -X POST --data-binary @- http://localhost:8428/datadog/api/v1/series ' | curl -X POST --data-binary @- http://localhost:8428/datadog/api/v1/series
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
echo ' echo '
{ {
@ -149,6 +195,8 @@ echo '
' | curl -X POST --data-binary @- 'http://<vminsert>:8480/insert/0/datadog/api/v1/series' ' | curl -X POST --data-binary @- 'http://<vminsert>:8480/insert/0/datadog/api/v1/series'
``` ```
</div>
Additional information: Additional information:
* [How to send data from datadog agent](https://docs.victoriametrics.com/#how-to-send-data-from-datadog-agent) * [How to send data from datadog agent](https://docs.victoriametrics.com/#how-to-send-data-from-datadog-agent)
@ -158,14 +206,22 @@ Additional information:
**Searches Graphite metrics in VictoriaMetrics** **Searches Graphite metrics in VictoriaMetrics**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl -G 'http://localhost:8428/graphite/metrics/find?query=vm_http_request_errors_total' curl -G 'http://localhost:8428/graphite/metrics/find?query=vm_http_request_errors_total'
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl -G 'http://<vmselect>:8481/select/0/graphite/metrics/find?query=vm_http_request_errors_total' curl -G 'http://<vmselect>:8481/select/0/graphite/metrics/find?query=vm_http_request_errors_total'
``` ```
</div>
Additional information: Additional information:
* [Metrics find](https://graphite-api.readthedocs.io/en/latest/api.html#metrics-find) * [Metrics find](https://graphite-api.readthedocs.io/en/latest/api.html#metrics-find)
@ -178,14 +234,22 @@ Additional information:
**Writes data with InfluxDB line protocol to VictoriaMetrics** **Writes data with InfluxDB line protocol to VictoriaMetrics**
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl -d 'measurement,tag1=value1,tag2=value2 field1=123,field2=1.23' -X POST 'http://localhost:8428/write' curl -d 'measurement,tag1=value1,tag2=value2 field1=123,field2=1.23' -X POST 'http://localhost:8428/write'
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl -d 'measurement,tag1=value1,tag2=value2 field1=123,field2=1.23' -X POST 'http://<vminsert>:8480/insert/0/influx/write' curl -d 'measurement,tag1=value1,tag2=value2 field1=123,field2=1.23' -X POST 'http://<vminsert>:8480/insert/0/influx/write'
``` ```
</div>
Additional information: Additional information:
* [How to send data from influxdb compatible agents such as telegraf](https://docs.victoriametrics.com/#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) * [How to send data from influxdb compatible agents such as telegraf](https://docs.victoriametrics.com/#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf)
@ -199,27 +263,43 @@ Turned off by default. Enable OpenTSDB receiver in VictoriaMetrics by setting `-
*If run from docker, '-opentsdbListenAddr' port should be exposed* *If run from docker, '-opentsdbListenAddr' port should be exposed*
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
echo "put foo.bar.baz `date +%s` 123 tag1=value1 tag2=value2" | nc -N localhost 4242 echo "put foo.bar.baz `date +%s` 123 tag1=value1 tag2=value2" | nc -N localhost 4242
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
echo "put foo.bar.baz `date +%s` 123 tag1=value1 tag2=value2 VictoriaMetrics_AccountID=0" | nc -N http://<vminsert> 4242 echo "put foo.bar.baz `date +%s` 123 tag1=value1 tag2=value2 VictoriaMetrics_AccountID=0" | nc -N http://<vminsert> 4242
``` ```
</div>
Enable HTTP server for OpenTSDB /api/put requests by setting `-opentsdbHTTPListenAddr` command-line flag. Enable HTTP server for OpenTSDB /api/put requests by setting `-opentsdbHTTPListenAddr` command-line flag.
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
curl -H 'Content-Type: application/json' -d '[{"metric":"foo","value":45.34},{"metric":"bar","value":43}]' http://localhost:4242/api/put curl -H 'Content-Type: application/json' -d '[{"metric":"foo","value":45.34},{"metric":"bar","value":43}]' http://localhost:4242/api/put
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
curl -H 'Content-Type: application/json' -d '[{"metric":"foo","value":45.34},{"metric":"bar","value":43}]' curl -H 'Content-Type: application/json' -d '[{"metric":"foo","value":45.34},{"metric":"bar","value":43}]'
'http://<vminsert>:8480/insert/42/opentsdb/api/put' 'http://<vminsert>:8480/insert/42/opentsdb/api/put'
``` ```
</div>
Additional information: Additional information:
* [Api http put](http://opentsdb.net/docs/build/html/api_http/put.html) * [Api http put](http://opentsdb.net/docs/build/html/api_http/put.html)
@ -231,16 +311,24 @@ Additional information:
Enable Graphite receiver in VictoriaMetrics by setting `-graphiteListenAddr` command-line flag. Enable Graphite receiver in VictoriaMetrics by setting `-graphiteListenAddr` command-line flag.
Single: Single:
<div class="with-copy" markdown="1">
```bash ```bash
echo "foo.bar.baz;tag1=value1;tag2=value2 123 `date +%s`" | echo "foo.bar.baz;tag1=value1;tag2=value2 123 `date +%s`" |
nc -N localhost 2003 nc -N localhost 2003
``` ```
</div>
Cluster: Cluster:
<div class="with-copy" markdown="1">
```bash ```bash
echo "foo.bar.baz;tag1=value1;tag2=value2;VictoriaMetrics_AccountID=42 123 `date +%s`" | nc -N http://<vminsert> 2003 echo "foo.bar.baz;tag1=value1;tag2=value2;VictoriaMetrics_AccountID=42 123 `date +%s`" | nc -N http://<vminsert> 2003
``` ```
</div>
Additional information: Additional information:
`VictoriaMetrics_AccountID=42` - tag that indicated tenant ID. `VictoriaMetrics_AccountID=42` - tag that indicated tenant ID.