Some small fixes.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2024-08-09 11:09:39 +02:00
parent 930aaf9276
commit 762e6d36bf
2 changed files with 4 additions and 7 deletions

View File

@@ -213,7 +213,7 @@ static struct
nDPIsrvd_ull flow_risk_count[NDPI_MAX_RISK - 1 /* NDPI_NO_RISK */]; nDPIsrvd_ull flow_risk_count[NDPI_MAX_RISK - 1 /* NDPI_NO_RISK */];
nDPIsrvd_ull flow_risk_unknown_count; nDPIsrvd_ull flow_risk_unknown_count;
} gauges[2]; } gauges[2]; /* values after InfluxDB push: gauges[0] -= gauges[1], gauges[1] is zero'd afterwards */
} collectd_statistics = {}; } collectd_statistics = {};
struct global_map struct global_map
@@ -421,7 +421,7 @@ static int parse_options(int argc, char ** argv, struct nDPIsrvd_socket * const
static char const usage[] = static char const usage[] =
"Usage: %s " "Usage: %s "
"[-l] [-s host] [-c hostname] [-n collectd-instance-name] [-i interval] [-q]\n\n" "[-l] [-s host] [-c hostname] [-n collectd-instance-name] [-i interval]\n\n"
"\t-l\tLog to console instead of syslog.\n" "\t-l\tLog to console instead of syslog.\n"
"\t-s\tDestination where nDPIsrvd is listening on.\n" "\t-s\tDestination where nDPIsrvd is listening on.\n"
"\t-c\tCollectd hostname.\n" "\t-c\tCollectd hostname.\n"
@@ -430,7 +430,7 @@ static int parse_options(int argc, char ** argv, struct nDPIsrvd_socket * const
"\t \tDefaults to: " DEFAULT_COLLECTD_EXEC_INST "\t \tDefaults to: " DEFAULT_COLLECTD_EXEC_INST
"\n" "\n"
"\t-i\tInterval between print statistics to stdout.\n" "\t-i\tInterval between print statistics to stdout.\n"
"\t \tThis value defaults to the environment variable COLLECTD_INTERVAL.\n"; "\t \tThis value defaults to the environment variable COLLECTD_INTERVAL.\n\n";
while ((opt = getopt(argc, argv, "hls:c:n:i:")) != -1) while ((opt = getopt(argc, argv, "hls:c:n:i:")) != -1)
{ {

View File

@@ -5,7 +5,6 @@
#include <string.h> #include <string.h>
#include <sys/epoll.h> #include <sys/epoll.h>
#include <sys/timerfd.h> #include <sys/timerfd.h>
#include <syslog.h>
#include <ndpi_typedefs.h> #include <ndpi_typedefs.h>
@@ -1622,7 +1621,6 @@ static void sighandler(int signum)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
enum nDPIsrvd_connect_return connect_ret;
int retval = 1, epollfd = -1; int retval = 1, epollfd = -1;
init_logging("nDPIsrvd-influxd"); init_logging("nDPIsrvd-influxd");
@@ -1651,8 +1649,7 @@ int main(int argc, char ** argv)
strerror(errno)); strerror(errno));
} }
connect_ret = nDPIsrvd_connect(sock); if (nDPIsrvd_connect(sock) != CONNECT_OK)
if (connect_ret != CONNECT_OK)
{ {
logger_early(1, "nDPIsrvd socket connect to %s failed!", serv_optarg); logger_early(1, "nDPIsrvd socket connect to %s failed!", serv_optarg);
goto failure; goto failure;