summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2021-02-25 14:29:41 +0200
committerGitHub <noreply@github.com>2021-02-25 14:29:41 +0200
commitad163251fca6056b3f88221cfc8f246ce1df3feb (patch)
treef64ad051b098c809a2ef155fc6a2610b0e517c1a /collectors
parent4455cb5d847a30f6ee9aa86bfc77637c83eb1f20 (diff)
Remove unreachable #else directives in plugins. (#10523)
They are unreachable because Makefile.am will conditionally include the relevant source files iff the #ifdef's argument is defined in configure.ac.
Diffstat (limited to 'collectors')
-rw-r--r--collectors/cups.plugin/cups_plugin.c14
-rw-r--r--collectors/freeipmi.plugin/freeipmi_plugin.c10
-rw-r--r--collectors/nfacct.plugin/plugin_nfacct.c57
-rw-r--r--collectors/xenstat.plugin/xenstat_plugin.c20
4 files changed, 12 insertions, 89 deletions
diff --git a/collectors/cups.plugin/cups_plugin.c b/collectors/cups.plugin/cups_plugin.c
index dc86437557..a80930e4db 100644
--- a/collectors/cups.plugin/cups_plugin.c
+++ b/collectors/cups.plugin/cups_plugin.c
@@ -7,6 +7,7 @@
*/
#include "../../libnetdata/libnetdata.h"
+#include <cups/cups.h>
#include <limits.h>
// callback required by fatal()
@@ -45,10 +46,6 @@ static int debug = 0;
static int netdata_update_every = 1;
static int netdata_priority = 100004;
-
-#ifdef HAVE_CUPS
-#include <cups/cups.h>
-
http_t *http; // connection to the cups daemon
/*
@@ -468,12 +465,3 @@ int main(int argc, char **argv) {
httpClose(http);
info("CUPS process exiting");
}
-
-#else // !HAVE_CUPS
-
-int main(int argc, char **argv)
-{
- fatal("cups.plugin is not compiled.");
-}
-
-#endif // !HAVE_CUPS
diff --git a/collectors/freeipmi.plugin/freeipmi_plugin.c b/collectors/freeipmi.plugin/freeipmi_plugin.c
index bd3c533cad..8229f55c1b 100644
--- a/collectors/freeipmi.plugin/freeipmi_plugin.c
+++ b/collectors/freeipmi.plugin/freeipmi_plugin.c
@@ -26,8 +26,6 @@
#include <unistd.h>
#include <sys/time.h>
-#ifdef HAVE_FREEIPMI
-
#define IPMI_PARSE_DEVICE_LAN_STR "lan"
#define IPMI_PARSE_DEVICE_LAN_2_0_STR "lan_2_0"
#define IPMI_PARSE_DEVICE_LAN_2_0_STR2 "lan20"
@@ -1861,11 +1859,3 @@ int main (int argc, char **argv) {
if(now_monotonic_sec() - started_t > 14400) exit(0);
}
}
-
-#else // !HAVE_FREEIPMI
-
-int main(int argc, char **argv) {
- fatal("freeipmi.plugin is not compiled.");
-}
-
-#endif // !HAVE_FREEIPMI
diff --git a/collectors/nfacct.plugin/plugin_nfacct.c b/collectors/nfacct.plugin/plugin_nfacct.c
index 996070f1ca..acdd0586d9 100644
--- a/collectors/nfacct.plugin/plugin_nfacct.c
+++ b/collectors/nfacct.plugin/plugin_nfacct.c
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "../../libnetdata/libnetdata.h"
+#include <linux/netfilter/nfnetlink_conntrack.h>
+#include <libmnl/libmnl.h>
+#include <libnetfilter_acct/libnetfilter_acct.h>
#define PLUGIN_NFACCT_NAME "nfacct.plugin"
@@ -13,9 +16,6 @@
#define NETDATA_CHART_PRIO_NETFILTER_PACKETS 8906
#define NETDATA_CHART_PRIO_NETFILTER_BYTES 8907
-#ifdef HAVE_LIBMNL
-#include <libmnl/libmnl.h>
-
static inline size_t mnl_buffer_size() {
long s = MNL_SOCKET_BUFFER_SIZE;
if(s <= 0) return 8192;
@@ -50,25 +50,13 @@ int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *
// required by get_system_cpus()
char *netdata_configured_host_prefix = "";
-
-// Variables
-
+// variables
static int debug = 0;
-
static int netdata_update_every = 1;
-// ----------------------------------------------------------------------------
-// DO_NFSTAT - collect netfilter connection tracker statistics via netlink
-// example: https://github.com/formorer/pkg-conntrack-tools/blob/master/src/conntrack.c
-
-#ifdef HAVE_LINUX_NETFILTER_NFNETLINK_CONNTRACK_H
-#define DO_NFSTAT 1
-
#define RRD_TYPE_NET_STAT_NETFILTER "netfilter"
#define RRD_TYPE_NET_STAT_CONNTRACK "netlink"
-#include <linux/netfilter/nfnetlink_conntrack.h>
-
static struct {
int update_every;
char *buf;
@@ -530,16 +518,6 @@ static void nfstat_send_metrics() {
printf("END\n");
}
-#endif // HAVE_LINUX_NETFILTER_NFNETLINK_CONNTRACK_H
-
-
-// ----------------------------------------------------------------------------
-// DO_NFACCT - collect netfilter accounting statistics via netlink
-
-#ifdef HAVE_LIBNETFILTER_ACCT
-#define DO_NFACCT 1
-
-#include <libnetfilter_acct/libnetfilter_acct.h>
struct nfacct_data {
char *name;
@@ -760,8 +738,6 @@ static void nfacct_send_metrics() {
printf("END\n");
}
-#endif // HAVE_LIBNETFILTER_ACCT
-
static void nfacct_signal_handler(int signo)
{
exit((signo == SIGPIPE)?1:0);
@@ -866,15 +842,13 @@ int main(int argc, char **argv) {
else if(freq)
error("update frequency %d seconds is too small for NFACCT. Using %d.", freq, netdata_update_every);
-#ifdef DO_NFACCT
- if(debug) fprintf(stderr, "nfacct.plugin: calling nfacct_init()\n");
+ if (debug)
+ fprintf(stderr, "nfacct.plugin: calling nfacct_init()\n");
int nfacct = !nfacct_init(netdata_update_every);
-#endif
-#ifdef DO_NFSTAT
- if(debug) fprintf(stderr, "nfacct.plugin: calling nfstat_init()\n");
+ if (debug)
+ fprintf(stderr, "nfacct.plugin: calling nfstat_init()\n");
int nfstat = !nfstat_init(netdata_update_every);
-#endif
// ------------------------------------------------------------------------
// the main loop
@@ -899,7 +873,6 @@ int main(int argc, char **argv) {
, dt
);
-#ifdef DO_NFACCT
if(likely(nfacct)) {
if(debug) fprintf(stderr, "nfacct.plugin: calling nfacct_collect()\n");
nfacct = !nfacct_collect();
@@ -909,9 +882,7 @@ int main(int argc, char **argv) {
nfacct_send_metrics();
}
}
-#endif
-#ifdef DO_NFSTAT
if(likely(nfstat)) {
if(debug) fprintf(stderr, "nfacct.plugin: calling nfstat_collect()\n");
nfstat = !nfstat_collect();
@@ -921,7 +892,6 @@ int main(int argc, char **argv) {
nfstat_send_metrics();
}
}
-#endif
fflush(stdout);
@@ -931,14 +901,3 @@ int main(int argc, char **argv) {
info("NFACCT process exiting");
}
-
-#else // !HAVE_LIBMNL
-
-int main(int argc, char **argv) {
- (void)argc;
- (void)argv;
-
- fatal("nfacct.plugin is not compiled.");
-}
-
-#endif // !HAVE_LIBMNL
diff --git a/collectors/xenstat.plugin/xenstat_plugin.c b/collectors/xenstat.plugin/xenstat_plugin.c
index 647ac1db77..a322dd1c11 100644
--- a/collectors/xenstat.plugin/xenstat_plugin.c
+++ b/collectors/xenstat.plugin/xenstat_plugin.c
@@ -2,6 +2,9 @@
#include "../../libnetdata/libnetdata.h"
+#include <xenstat.h>
+#include <libxl.h>
+
#define PLUGIN_XENSTAT_NAME "xenstat.plugin"
#define NETDATA_CHART_PRIO_XENSTAT_NODE_CPUS 30001
@@ -62,15 +65,9 @@ int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *
char *netdata_configured_host_prefix = "";
// Variables
-
static int debug = 0;
-
static int netdata_update_every = 1;
-#ifdef HAVE_LIBXENSTAT
-#include <xenstat.h>
-#include <libxl.h>
-
struct vcpu_metrics {
unsigned int id;
@@ -1093,14 +1090,3 @@ int main(int argc, char **argv) {
xenstat_uninit(xhandle);
info("XENSTAT process exiting");
}
-
-#else // !HAVE_LIBXENSTAT
-
-int main(int argc, char **argv) {
- (void)argc;
- (void)argv;
-
- fatal("xenstat.plugin is not compiled.");
-}
-
-#endif // !HAVE_LIBXENSTAT