All sources should have singular names.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/sources/disk.h \
src/daemon/sources/hostapd.c \
src/daemon/sources/hostapd.h \
- src/daemon/sources/interfaces.c \
- src/daemon/sources/interfaces.h \
+ src/daemon/sources/interface.c \
+ src/daemon/sources/interface.h \
src/daemon/sources/ipfrag4.c \
src/daemon/sources/ipfrag4.h \
src/daemon/sources/iptables.c \
ENABLE_SOURCE([df])
ENABLE_SOURCE([disk])
ENABLE_SOURCE([hostapd])
-ENABLE_SOURCE([interfaces], [$have_libnl3 $have_libnl3_route])
+ENABLE_SOURCE([interface], [$have_libnl3 $have_libnl3_route])
ENABLE_SOURCE([ipfrag4])
ENABLE_SOURCE([iptables], [$have_libiptc])
ENABLE_SOURCE([legacy-gateway-latency4], [$have_libnl3 $have_libnl3_route])
df: ${build_source_df}
disk: ${build_source_disk}
hostapd: ${build_source_hostapd}
- interfaces: ${build_source_interfaces}
+ interface: ${build_source_interface}
ipfrag4: ${build_source_ipfrag4}
iptables: ${build_source_iptables}
legacy-gateway-latency4: ${build_source_legacy_gateway_latency4}
int r;
// Require the source
- r = td_graph_require_source(graph, args, "interfaces", object);
+ r = td_graph_require_source(graph, args, "interface", object);
if (r < 0)
return r;
#include "sources/df.h"
#include "sources/disk.h"
#include "sources/hostapd.h"
-#include "sources/interfaces.h"
+#include "sources/interface.h"
#include "sources/ipfrag4.h"
#include "sources/iptables.h"
#include "sources/legacy-gateway-latency4.h"
&hostapd_source,
#endif /* BUILD_SOURCE_HOSTAPD */
-#ifdef BUILD_SOURCE_INTERFACES
- &interfaces_source,
-#endif /* BUILD_SOURCE_INTERFACES */
+#ifdef BUILD_SOURCE_INTERFACE
+ &interface_source,
+#endif /* BUILD_SOURCE_INTERFACE */
#ifdef BUILD_SOURCE_IPFRAG4
&ipfrag4_source,
# #
#############################################################################*/
-#ifdef BUILD_SOURCE_INTERFACES
+#ifdef BUILD_SOURCE_INTERFACE
#include <errno.h>
#include <limits.h>
#include "../time.h"
#include "interfaces.h"
-typedef struct interfaces_stats {
+typedef struct interface_stats {
const char* field;
rtnl_link_stat_id_t id;
} interfaces_stats;
-static const interfaces_stats stats[] = {
+static const interface_stats stats[] = {
// Packets Received/Sent
{ "rx_packets", RTNL_LINK_RX_PACKETS },
{ "tx_packets", RTNL_LINK_TX_PACKETS },
{ NULL },
};
-static void interfaces_link_callback(struct nl_object* object, void* data) {
+static void interface_link_callback(struct nl_object* object, void* data) {
struct rtnl_link* link = (struct rtnl_link*)object;
td_metrics* metrics = NULL;
td_source* source = data;
goto ERROR;
// Collect all stats
- for (const interfaces_stats* stat = stats; stat->field; stat++) {
+ for (const interface_stats* stat = stats; stat->field; stat++) {
// Fetch the value
value = rtnl_link_get_stat(link, stat->id);
td_metrics_unref(metrics);
}
-static int interfaces_heartbeat(td_ctx* ctx, td_source* source) {
+static int interface_heartbeat(td_ctx* ctx, td_source* source) {
struct nl_cache* links = NULL;
int r;
}
// Walk through all interfaces
- nl_cache_foreach(links, interfaces_link_callback, source);
+ nl_cache_foreach(links, interface_link_callback, source);
ERROR:
if (links)
return r;
}
-const td_source_impl interfaces_source = {
- .name = "interfaces",
+const td_source_impl interface_source = {
+ .name = "interface",
// RRD Data Sources
.rrd_dss = {
},
// Methods
- .heartbeat = interfaces_heartbeat,
+ .heartbeat = interface_heartbeat,
};
-#endif /* BUILD_SOURCE_INTERFACES */
+#endif /* BUILD_SOURCE_INTERFACE */
# #
#############################################################################*/
-#ifndef TELEMETRY_SOURCE_INTERFACES_H
-#define TELEMETRY_SOURCE_INTERFACES_H
-#ifdef BUILD_SOURCE_INTERFACES
+#ifndef TELEMETRY_SOURCE_INTERFACE_H
+#define TELEMETRY_SOURCE_INTERFACE_H
+#ifdef BUILD_SOURCE_INTERFACE
#include "../source.h"
-extern const td_source_impl interfaces_source;
+extern const td_source_impl interface_source;
-#endif /* BUILD_SOURCE_INTERFACES */
-#endif /* TELEMETRY_SOURCE_INTERFACES_H */
+#endif /* BUILD_SOURCE_INTERFACE */
+#endif /* TELEMETRY_SOURCE_INTERFACE_H */