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.
This commit is contained in:
parent
4455cb5d84
commit
ad163251fc
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -888,9 +888,7 @@ if test "${enable_plugin_nfacct}" != "no" -a "${have_libnetfilter_acct}" = "yes"
|
|||
-a "${have_libmnl}" = "yes" \
|
||||
-a "${have_nfnetlink_conntrack}" = "yes"; then
|
||||
enable_plugin_nfacct="yes"
|
||||
AC_DEFINE([HAVE_LIBMNL], [1], [libmnl usability])
|
||||
AC_DEFINE([HAVE_LIBNETFILTER_ACCT], [1], [libnetfilter_acct usability])
|
||||
AC_DEFINE([HAVE_LINUX_NETFILTER_NFNETLINK_CONNTRACK_H], [1], [libnetfilter_nfnetlink_conntrack header usability])
|
||||
AC_DEFINE([HAVE_NFACCT], [1], [netfilter accounting usability])
|
||||
OPTIONAL_NFACCT_CFLAGS="${NFACCT_CFLAGS} ${LIBMNL_CFLAGS}"
|
||||
OPTIONAL_NFACCT_LIBS="${NFACCT_LIBS} ${LIBMNL_LIBS}"
|
||||
else
|
||||
|
@ -956,8 +954,6 @@ AC_MSG_CHECKING([if xenstat.plugin should be enabled])
|
|||
if test "${enable_plugin_xenstat}" != "no" -a "${have_libxenstat}" = "yes" -a "${have_libxenlight}" = "yes" -a "${have_libyajl}" = "yes"; then
|
||||
enable_plugin_xenstat="yes"
|
||||
AC_DEFINE([HAVE_LIBXENSTAT], [1], [libxenstat usability])
|
||||
AC_DEFINE([HAVE_LIBXENLIGHT], [1], [libxenlight usability])
|
||||
AC_DEFINE([HAVE_LIBYAJL], [1], [libyajl usability])
|
||||
OPTIONAL_XENSTAT_CFLAGS="${XENLIGHT_CFLAGS} ${YAJL_CFLAGS}"
|
||||
OPTIONAL_XENSTAT_LIBS="-lxenstat ${XENLIGHT_LIBS} ${YAJL_LIBS}"
|
||||
else
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
#define FEAT_CUPS "NO"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBMNL
|
||||
#ifdef HAVE_NFACCT
|
||||
#define FEAT_NFACCT "YES"
|
||||
#else
|
||||
#define FEAT_NFACCT "NO"
|
||||
|
|
Loading…
Reference in New Issue