diff --git a/src/helper/influx-checks.js b/src/helper/influx-checks.js index 1e6db19..2c77ede 100644 --- a/src/helper/influx-checks.js +++ b/src/helper/influx-checks.js @@ -1,5 +1,6 @@ const logger = require.main.require("./helper/logger.js")("influx-checks"); +const Os = require("os"); const { InfluxDB, Point } = require('@influxdata/influxdb-client') const Influx = require('@influxdata/influxdb-client-apis'); @@ -38,7 +39,7 @@ function checkBucket(influxDb, options){ function checkWriteApi(influxDb, options){ return new Promise((resolve, reject) => { const writeApi = influxDb.getWriteApi(options.org, options.bucket); // Get WriteAPI - writeApi.writePoint(new Point("test").tag("ConnectionTest", true).intField("value", 0).timestamp(0)) // Write dummy-point + writeApi.writePoint(new Point("worker_connectionTest").tag("hostname", Os.hostname())) // Write point writeApi.close() .catch((err) => { logger.error("Could not get writeApi:"); @@ -46,23 +47,7 @@ function checkWriteApi(influxDb, options){ reject(); }).then((res) => { logger.debug("Writing ok"); - - // Delete the connection-text-point - new Influx.DeleteAPI(influxDb).postDelete({ - "body": { - "start": 0, - "end": 1, - "predicate": "ConnectionTest==true" - }, - "org": options.org, - "bucket": options.bucket - }) - .catch((err) => { - logger.error("Could not delete ConnectionTest-Point:"); - logger.error(`Error [${err.code}]:`, err.message); - reject(); - }) - .then(resolve()) + resolve(); }); }); }