summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-05-22 15:30:14 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-10 23:41:15 +0200
commit673300920c0f4182bdf449e789d13aeb525ac3ea (patch)
treec95a5d49c172b72648393b4b82b10d7c8c59be4f
parentf98442442edcd2a0a06ed3616e1fdd4399056b31 (diff)
Update README
Change-Id: Iac523214e776b8f3e7bf7479a3774c46c84df398 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r--.vscode/settings.json9
-rw-r--r--README.md49
-rw-r--r--src/plugins/influxdb-writer.c2
3 files changed, 49 insertions, 11 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 2e7e9f0..85c0a34 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -17,5 +17,12 @@
"influxdb.h": "c"
},
"C_Cpp.intelliSenseEngineFallback": "Disabled",
- "C_Cpp.errorSquiggles": "Disabled"
+ "C_Cpp.errorSquiggles": "Disabled",
+ "cSpell.words": [
+ "CTLP",
+ "DBHOST",
+ "DBPORT",
+ "influxdb",
+ "serie"
+ ]
}
diff --git a/README.md b/README.md
index af77240..7e45e4c 100644
--- a/README.md
+++ b/README.md
@@ -9,20 +9,56 @@ mkdir build && cd build
cmake .. && make
```
+### InfluxDB installation
+
+```bash
+# openSUSE installation instructions
+# For other distro, see docs: https://portal.influxdata.com/downloads
+wget https://dl.influxdata.com/influxdb/releases/influxdb-1.5.1.x86_64.rpm
+sudo zypper in ./influxdb-1.5.1.x86_64.rpm
+# ignore warnings and force install
+
+sudo systemctl daemon-reload
+sudo systemctl start influxdb
+sudo systemctl status influxdb
+```
+
+You may also install useful tool named chronograf (Time-Series Data Visualization)
+```bash
+wget https://dl.influxdata.com/chronograf/releases/chronograf-1.4.4.2.x86_64.rpm
+sudo zypper in shadow
+sudo zypper in ./chronograf-1.4.4.2.x86_64.rpm
+# ignore warnings and force install
+```
+
## Usage
Typical example to write in a TimeSeries DB from source project directory:
```bash
-$ cd build/package/ && /opt/AGL/bin/afb-daemon --workdir=. --name=afbd-harvester --ldpaths=lib --roothttp=. --tracereq=common --token=1 -vvv
+$ cd build/ && /opt/AGL/bin/afb-daemon --workdir=./package --name=afbd-harvester --ldpaths=lib --roothttp=. --tracereq=common --token=1 -vvv
[...]
$ afb-client-demo ws://localhost:1234/api?token=1
harvester auth
-ON-REPLY 1:harvester/write: {"jtype":"afb-reply","request":{"status":"success", "uuid":"03dc89fb-88b4-4204-ba9b-13dded3c38ab"}}
+ON-REPLY 1:harvester/auth: {"jtype":"afb-reply","request":{"status":"success", "uuid":"03dc89fb-88b4-4204-ba9b-13dded3c38ab"}}
harvester write {"metric": [{"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 0},"timestamp": 1526048390725229811}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 1},"timestamp": 1526048590732571963}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 2},"timestamp": 1526048790741053301}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 3},"timestamp": 1526049390746492374}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 4},"timestamp": 1526049590753850373}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 5},"timestamp": 1526049790760449841}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 6},"timestamp": 1526049990768334799}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 7},"timestamp": 1526052290774058754}, {"name": "engine_speed","metadata": {"source": "my_source","identity": "claneys"},"values": {"value": 8},"timestamp": 1526055590781866679}]}
-ON-REPLY 2:harvester/write: {"jtype":"afb-reply","request":{"status":"success","info":"Request has been successfully writen"}}
+ON-REPLY 2:harvester/write: {"jtype":"afb-reply","request":{"status":"success","info":"Request has been successfully written"}}
+```
+
+```bash
+afb-client-demo -H ws://localhost:1234/api?token=1 harvester write '{"metric": [{"name": "engine_speed", "metadata": {"source": "my_source","identity": "claneys"}, "values": {"value": 10}, "timestamp": 1526065590781866679}]}'
+ON-REPLY 1:harvester/write: OK
+{
+ "jtype":"afb-reply",
+ "request":{
+ "status":"success",
+ "info":"Request has been successfully written",
+ "uuid":"24d61c19-469f-4fad-a85b-55f4bac59e8e"
+ }
+}
+afb-client-demo -H ws://localhost:1234/api?token=1 harvester write '{"metric": [{"name": "engine_speed","metadata": {source": "my_source","identity": "claneys"},"values": {"value": 10},"timestamp": 1526065590781866679}]}'
```
## InfluxDB check
@@ -58,10 +94,5 @@ time value_f
Drop measurement:
```bash
-influx
-Connected to http://localhost:8086 version 1.5.1
-InfluxDB shell version: 1.5.1
-> use agl-garner
-Using database agl-garner
-> drop measurement engine_speed
+influx -database 'agl-garner' -execute 'drop measurement engine_speed'
```
diff --git a/src/plugins/influxdb-writer.c b/src/plugins/influxdb-writer.c
index 3cf37d7..aaa8991 100644
--- a/src/plugins/influxdb-writer.c
+++ b/src/plugins/influxdb-writer.c
@@ -28,7 +28,7 @@ void influxdb_write_curl_cb(void *closure, int status, CURL *curl, const char *r
switch(rep_code) {
case 204:
AFB_ReqDebug(request, "Request correctly written");
- AFB_ReqSucess(request, NULL, "Request has been successfully writen");
+ AFB_ReqSucess(request, NULL, "Request has been successfully written");
break;
case 400:
AFB_ReqFail(request, "Bad request", result);