summaryrefslogtreecommitdiffstats
path: root/web/api
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-12-28 14:42:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-12-28 14:42:52 +0000
commit12b9efaebb6d008437af4a72a98d05c4319fc825 (patch)
tree70876046e52ae898dd7327424f2c27fde1a5d45f /web/api
parentReleasing debian version 1.11.0+dfsg-1~exp1. (diff)
downloadnetdata-12b9efaebb6d008437af4a72a98d05c4319fc825.tar.xz
netdata-12b9efaebb6d008437af4a72a98d05c4319fc825.zip
Merging upstream version 1.11.1+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api')
-rw-r--r--web/api/README.md7
-rw-r--r--web/api/badges/README.md32
-rw-r--r--web/api/exporters/README.md3
-rw-r--r--web/api/web_api_v1.c14
4 files changed, 37 insertions, 19 deletions
diff --git a/web/api/README.md b/web/api/README.md
index 973d1bb6b..813998016 100644
--- a/web/api/README.md
+++ b/web/api/README.md
@@ -1,10 +1,12 @@
-# netdata REST API
+# API
+
+## Netdata REST API
The complete documentation of the netdata API is available at the **[Swagger Editor](https://editor.swagger.io/?url=https://raw.githubusercontent.com/netdata/netdata/master/web/api/netdata-swagger.yaml)**.
If your prefer it over the Swagger Editor, you can also use **[Swagger UI](https://registry.my-netdata.io/swagger/#!/default/get_data)**. This however does not provide all the information available.
-## google charts
+## Google charts API
netdata is a [Google Visualization API datatable and datasource provider](https://developers.google.com/chart/interactive/docs/reference), so it can directly be used with [Google Charts](https://developers.google.com/chart/interactive/docs/).
@@ -15,4 +17,3 @@ Check this [single chart, jsfiddle example](https://jsfiddle.net/ktsaou/ensu4uws
and this [multi chart, jsfiddle example](https://jsfiddle.net/ktsaou/L5y2eqp2/):
![image](https://cloud.githubusercontent.com/assets/2662304/23824766/31a4a68c-0685-11e7-8429-8327cab64be2.png)
-
diff --git a/web/api/badges/README.md b/web/api/badges/README.md
index cf0b22bea..11d04d064 100644
--- a/web/api/badges/README.md
+++ b/web/api/badges/README.md
@@ -20,7 +20,7 @@ Similarly, there is [a chart that shows outbound bandwidth per class](http://lon
The right one is a **volume** calculation. Netdata calculated the total of the last 86.400 seconds (a day) which gives `kilobits`, then divided it by 8 to make it KB, then by 1024 to make it MB and then by 1024 to make it GB. Calculations like this are quite accurate, since for every value collected, every second, netdata interpolates it to second boundary using microsecond calculations.
-Let's see a few more badge examples (they come from the [netdata registry](https://github.com/netdata/netdata/wiki/mynetdata-menu-item)):
+Let's see a few more badge examples (they come from the [netdata registry](../../../registry/)):
- **cpu usage of user `root`** (you can pick any user; 100% = 1 core). This will be `green <10%`, `yellow <20%`, `orange <50%`, `blue <100%` (1 core), `red` otherwise (you define thresholds and colors on the URL).
@@ -56,14 +56,14 @@ Here is what you can put for `options` (these are standard netdata API options):
```html
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu"></img>
</a>
```
Which produces this:
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu"></img>
</a>
- `alarm=NAME`
@@ -84,14 +84,14 @@ Here is what you can put for `options` (these are standard netdata API options):
```html
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&dimensions=system%7Cnice"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&dimensions=system%7Cnice"></img>
</a>
```
Which produces this:
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&dimensions=system%7Cnice"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&dimensions=system%7Cnice"></img>
</a>
- `before=SECONDS` and `after=SECONDS`
@@ -106,28 +106,28 @@ Here is what you can put for `options` (these are standard netdata API options):
```html
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60"></img>
</a>
```
Which produces the average of last complete minute (XX:XX:00 - XX:XX:59):
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60"></img>
</a>
While this is the previous minute (one minute before the last one, again aligned XX:XX:00 - XX:XX:59):
```html
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&before=-60&after=-60"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&before=-60&after=-60"></img>
</a>
```
It produces this:
<a href="#">
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&before=-60&after=-60"></img>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&before=-60&after=-60"></img>
</a>
- `group=min` or `group=max` or `group=average` (the default) or `group=sum` or `group=incremental-sum`
@@ -208,11 +208,11 @@ These are options dedicated to badges:
This option scales the svg image. It accepts values above or equal to 100 (100% is the default scale). For example, lets get a few different sizes:
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=100"></img> original<br/>
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=125"></img> `scale=125`<br/>
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=150"></img> `scale=150`<br/>
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=175"></img> `scale=175`<br/>
- <img src="http://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=200"></img> `scale=200`
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=100"></img> original<br/>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=125"></img> `scale=125`<br/>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=150"></img> `scale=150`<br/>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=175"></img> `scale=175`<br/>
+ <img src="https://registry.my-netdata.io/api/v1/badge.svg?chart=system.cpu&after=-60&scale=200"></img> `scale=200`
- `refresh=auto` or `refresh=SECONDS`
@@ -243,7 +243,7 @@ These are options dedicated to badges:
</script>
```
-A more advanced badges refresh method is to include `http://your.netdata.ip:19999/refresh-badges.js` in your page. For more information and use example, [check this](https://github.com/netdata/netdata/blob/master/web/gui/refresh-badges.js).
+A more advanced badges refresh method is to include `http://your.netdata.ip:19999/refresh-badges.js` in your page. For more information and use example, [check this](../../gui/refresh-badges.js).
---
@@ -321,4 +321,4 @@ You can refresh them from your browser console though. Press F12 to open the web
```js
var len = document.images.length; while(len--) { document.images[len].src = document.images[len].src.replace(/\?cacheBuster=\d*/, "") + "?cacheBuster=" + new Date().getTime().toString(); };
-``` \ No newline at end of file
+```
diff --git a/web/api/exporters/README.md b/web/api/exporters/README.md
index e69de29bb..02e04abbf 100644
--- a/web/api/exporters/README.md
+++ b/web/api/exporters/README.md
@@ -0,0 +1,3 @@
+# Exporters
+
+TBD
diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c
index 1e03828e4..5c54d52fc 100644
--- a/web/api/web_api_v1.c
+++ b/web/api/web_api_v1.c
@@ -429,6 +429,20 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c
return ret;
}
+// Pings a netdata server:
+// /api/v1/registry?action=hello
+//
+// Access to a netdata registry:
+// /api/v1/registry?action=access&machine=${machine_guid}&name=${hostname}&url=${url}
+//
+// Delete from a netdata registry:
+// /api/v1/registry?action=delete&machine=${machine_guid}&name=${hostname}&url=${url}&delete_url=${delete_url}
+//
+// Search for the URLs of a machine:
+// /api/v1/registry?action=search&machine=${machine_guid}&name=${hostname}&url=${url}&for=${machine_guid}
+//
+// Impersonate:
+// /api/v1/registry?action=switch&machine=${machine_guid}&name=${hostname}&url=${url}&to=${new_person_guid}
inline int web_client_api_request_v1_registry(RRDHOST *host, struct web_client *w, char *url) {
static uint32_t hash_action = 0, hash_access = 0, hash_hello = 0, hash_delete = 0, hash_search = 0,
hash_switch = 0, hash_machine = 0, hash_url = 0, hash_name = 0, hash_delete_url = 0, hash_for = 0,