|
|
@ -14,6 +14,7 @@ const { RegexBlockStream } = require("./streamHandler/RegexBlockStream.js");
|
|
|
|
const { PacketStreamFactory } = require("./streamHandler/PacketStreamFactory.js");
|
|
|
|
const { PacketStreamFactory } = require("./streamHandler/PacketStreamFactory.js");
|
|
|
|
const { PacketInfluxPointFactory } = require("./streamHandler/PacketInfluxPointFactory.js");
|
|
|
|
const { PacketInfluxPointFactory } = require("./streamHandler/PacketInfluxPointFactory.js");
|
|
|
|
const { InfluxPointWriter } = require("./streamHandler/InfluxPointWriter.js");
|
|
|
|
const { InfluxPointWriter } = require("./streamHandler/InfluxPointWriter.js");
|
|
|
|
|
|
|
|
const { InfluxDbLineProtocolWriter } = require("./streamHandler/InfluxDbLineProtocolWriter.js");
|
|
|
|
|
|
|
|
|
|
|
|
const userHelper = require("./helper/userHelper.js");
|
|
|
|
const userHelper = require("./helper/userHelper.js");
|
|
|
|
|
|
|
|
|
|
|
@ -42,6 +43,8 @@ if(errorMsg){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
(async function() {
|
|
|
|
(async function() {
|
|
|
|
|
|
|
|
let pointWriter;
|
|
|
|
|
|
|
|
if(!env.USE_INFLUXDB_LINEPROTOCOL){
|
|
|
|
logger.info("Setup Influx..");
|
|
|
|
logger.info("Setup Influx..");
|
|
|
|
const influxDb = new InfluxDB({url: env.INFLUX_URL, token: env.INFLUX_TOKEN});
|
|
|
|
const influxDb = new InfluxDB({url: env.INFLUX_URL, token: env.INFLUX_TOKEN});
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +69,15 @@ if(errorMsg){
|
|
|
|
logger.debug("Get WriteApi & set default-hostname to", `'${env.HOSTNAME}'`);
|
|
|
|
logger.debug("Get WriteApi & set default-hostname to", `'${env.HOSTNAME}'`);
|
|
|
|
const influxWriteApi = influxDb.getWriteApi(env.INFLUX_ORG, env.INFLUX_BUCKET, "us");
|
|
|
|
const influxWriteApi = influxDb.getWriteApi(env.INFLUX_ORG, env.INFLUX_BUCKET, "us");
|
|
|
|
//influxWriteApi.useDefaultTags({"hostname": env.HOSTNAME});
|
|
|
|
//influxWriteApi.useDefaultTags({"hostname": env.HOSTNAME});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pointWriter = new InfluxPointWriter(influxWriteApi);
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Influx ok");
|
|
|
|
logger.info("Influx ok");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
logger.info("Setup Influxdb-LineProtocol..");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Starting tcpdump..");
|
|
|
|
logger.info("Starting tcpdump..");
|
|
|
|
const TCPDUMP_BASECMD = "tcpdump -vvv -e -n -X -s0 -i";
|
|
|
|
const TCPDUMP_BASECMD = "tcpdump -vvv -e -n -X -s0 -i";
|
|
|
|