diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | .vscode/launch.json | 3 | ||||
m--------- | app-controller-submodule | 0 | ||||
-rw-r--r-- | src/harvester.c | 10 | ||||
-rw-r--r-- | src/plugins/influxdb-reader.c | 5 | ||||
-rw-r--r-- | src/plugins/influxdb-writer.c | 6 | ||||
-rw-r--r-- | src/plugins/influxdb.c | 6 |
7 files changed, 16 insertions, 17 deletions
diff --git a/.gitmodules b/.gitmodules index 95c929c..0337546 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "afb-helpers"] path = afb-helpers url = https://gerrit.automotivelinux.org/gerrit/p/apps/app-afb-helpers-submodule.git +[submodule "app-controller-submodule"] + path = app-controller-submodule + url = https://gerrit.automotivelinux.org/gerrit/apps/app-controller-submodule diff --git a/.vscode/launch.json b/.vscode/launch.json index 175ba65..61733b5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,7 +18,6 @@ "--verbose", "--verbose", "--verbose"], - "additionalSOLibSearchPath": "${workspaceRoot}/build/package/lib", "stopAtEntry": false, "cwd": "${workspaceRoot}/build/package", "environment": [], @@ -36,7 +35,7 @@ "name": "Resuming_run", "type": "cppdbg", "request": "launch", - "program": "/opt/bin/afb-daemon", + "program": "/opt/AGL/bin/afb-daemon", "args": [ "--rootdir=${workspaceRoot}/build/package/", "--workdir=${workspaceRoot}/build/package/", "--ldpaths=lib", diff --git a/app-controller-submodule b/app-controller-submodule new file mode 160000 +Subproject e8b0b3c3cc9b0453b88d1315822fda5963754ae diff --git a/src/harvester.c b/src/harvester.c index 30ba486..1d4d9a6 100644 --- a/src/harvester.c +++ b/src/harvester.c @@ -48,9 +48,9 @@ void afv_write(struct afb_req req) *metric = NULL; if(wrap_json_unpack(req_args, "{s?s,s?o,so!}", - "host", &host, - "port", &portJ, - "metric", &metric) || ! metric) + "host", &host, + "port", &portJ, + "metric", &metric) || ! metric) afb_req_fail(req, "Failed", "Error processing arguments. Miss metric\ JSON object or malformed"); else { @@ -82,10 +82,10 @@ int init() case INFLUX: tsdb_write = influxdb_write; write_curl_cb = influxdb_write_curl_cb; - if(influxdb_reader(&r_args) != 0) { + /*if(influxdb_reader(&r_args) != 0) { AFB_ERROR("Problem initiating reader timer. Abort"); return ERROR; - } + }*/ break; default: AFB_ERROR("No Time Series Database found. Abort"); diff --git a/src/plugins/influxdb-reader.c b/src/plugins/influxdb-reader.c index b6bef25..a1fa3a0 100644 --- a/src/plugins/influxdb-reader.c +++ b/src/plugins/influxdb-reader.c @@ -91,7 +91,6 @@ static void unpack_metric_from_db(void *ml, json_object *metricJ) wrap_json_array_for_all(columnsJ, fill_key, m_list); wrap_json_array_for_all(valuesJ, fill_n_send_values, m_list); - } static json_object *unpack_series(json_object *seriesJ) @@ -176,7 +175,7 @@ static CURL *make_curl_query_get(const char *url) args[0] = "epoch"; args[1] = "ns"; args[2] = "q"; - strncat(query, "SELECT * FROM /^.*$/", strlen("SELECT * FROM /^.*$/")); + strcat(query, "SELECT * FROM /^.*$/"); args[4] = NULL; length_now = asprintf(&now, "%lu", get_ts()); @@ -192,7 +191,7 @@ static CURL *make_curl_query_get(const char *url) AFB_ERROR("Error writing last_db_read file: %s\n", strerror( errno )); } else { - strncat(query, " WHERE time >= ", strlen(" WHERE time >= ")); + strcat(query, " WHERE time >= "); strncat(query, last_ts, strlen(last_ts)); close(fd_last_read); fd_last_read = openat(rootdir_fd, "last_db_read", O_TRUNC | O_RDWR); diff --git a/src/plugins/influxdb-writer.c b/src/plugins/influxdb-writer.c index fdb1a2a..c21f4fd 100644 --- a/src/plugins/influxdb-writer.c +++ b/src/plugins/influxdb-writer.c @@ -132,15 +132,13 @@ CURL *make_curl_write_post(const char *url, json_object *metricsJ) } } - post_data[i] = NULL; - /* Check that we just do not broke the for loop before trying preparing CURL request object */ curl = i == lpd ? curl_wrap_prepare_post_unescaped(url, NULL, "\n", (const char * const*)post_data) : NULL; free(serie); - /*for(i = 0; i < lpd; i++) - free(post_data[i]);*/ + for(i = 0; i < lpd; i++) + free(post_data[i]); free(post_data); return curl; diff --git a/src/plugins/influxdb.c b/src/plugins/influxdb.c index 27161ab..a98bd2b 100644 --- a/src/plugins/influxdb.c +++ b/src/plugins/influxdb.c @@ -41,11 +41,11 @@ size_t make_url(char *url, size_t l_url, const char *host, const char *port, con port = port ? port : DEFAULT_DBPORT; strncat(url, host, strlen(host)); - strncat(url, ":", 1); + strcat(url, ":"); strncat(url, port, strlen(port)); - strncat(url, "/", 1); + strcat(url, "/"); strncat(url, endpoint, strlen(endpoint)); - strncat(url, "?db="DEFAULT_DB, strlen("?db="DEFAULT_DB)); + strcat(url, "?db="DEFAULT_DB); return strlen(url); } |