summaryrefslogtreecommitdiffstats
path: root/collectors/nfacct.plugin/plugin_nfacct.c
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/nfacct.plugin/plugin_nfacct.c')
-rw-r--r--collectors/nfacct.plugin/plugin_nfacct.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/collectors/nfacct.plugin/plugin_nfacct.c b/collectors/nfacct.plugin/plugin_nfacct.c
index 430ceab52..a788d1a03 100644
--- a/collectors/nfacct.plugin/plugin_nfacct.c
+++ b/collectors/nfacct.plugin/plugin_nfacct.c
@@ -18,6 +18,8 @@
#define NETDATA_CHART_PRIO_NETFILTER_PACKETS 8906
#define NETDATA_CHART_PRIO_NETFILTER_BYTES 8907
+#define NFACCT_RESTART_EVERY_SECONDS 86400 // restart the plugin every this many seconds
+
static inline size_t mnl_buffer_size() {
long s = MNL_SOCKET_BUFFER_SIZE;
if(s <= 0) return 8192;
@@ -760,6 +762,8 @@ int main(int argc, char **argv) {
error_log_errors_per_period = 100;
error_log_throttle_period = 3600;
+ log_set_global_severity_for_external_plugins();
+
// ------------------------------------------------------------------------
// parse command line parameters
@@ -852,7 +856,7 @@ int main(int argc, char **argv) {
if(unlikely(netdata_exit)) break;
if(debug && iteration)
- fprintf(stderr, "nfacct.plugin: iteration %zu, dt %llu usec\n"
+ fprintf(stderr, "nfacct.plugin: iteration %zu, dt %"PRIu64" usec\n"
, iteration
, dt
);
@@ -879,9 +883,11 @@ int main(int argc, char **argv) {
fflush(stdout);
- // restart check (14400 seconds)
- if(now_monotonic_sec() - started_t > 14400) break;
+ if (now_monotonic_sec() - started_t > NFACCT_RESTART_EVERY_SECONDS) {
+ collector_info("NFACCT reached my lifetime expectancy. Exiting to restart.");
+ fprintf(stdout, "EXIT\n");
+ fflush(stdout);
+ exit(0);
+ }
}
-
- collector_info("NFACCT process exiting");
}