This is an automated email from the ASF dual-hosted git repository.
eze pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 8a75b7c Adding lower_ support to stats and bonding_slave data points
for port status (#7560)
8a75b7c is described below
commit 8a75b7c8888811a38f352e389a58dad1807a6bbf
Author: Evan Zelkowitz <[email protected]>
AuthorDate: Thu Feb 25 15:26:26 2021 -0700
Adding lower_ support to stats and bonding_slave data points for port
status (#7560)
---
plugins/experimental/system_stats/system_stats.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/plugins/experimental/system_stats/system_stats.c
b/plugins/experimental/system_stats/system_stats.c
index f8b5104..f15cc87 100644
--- a/plugins/experimental/system_stats/system_stats.c
+++ b/plugins/experimental/system_stats/system_stats.c
@@ -61,9 +61,15 @@
#define NET_STATS_DIR "/sys/class/net"
#define STATISTICS_DIR "statistics"
-// Used for matching to slave symlinks in a bonded interface
+// Used for matching to slave (old name) and lower (new name) symlinks
+// in a bonded interface
// This way we can report things like plugin.net.bond0.slave_dev1.speed
#define SLAVE "slave_"
+#define LOWER "lower_"
+
+// Dir name for slave/lower interfaces that are bond members. This dir houses
+// port information we may want such as the up/down streams port state
+#define BONDING_SLAVE_DIR "bonding_slave"
static int
statAdd(const char *name, TSRecordDataType record_type, TSMutex create_mutex)
@@ -174,10 +180,16 @@ setBondingStat(TSMutex stat_creation_mutex, const char
*interface)
DIR *localdir = opendir(infdir);
while ((dent = readdir(localdir)) != NULL) {
- if (strncmp(SLAVE, dent->d_name, strlen(SLAVE)) == 0 && (dent->d_type ==
DT_LNK)) {
- // We have a symlink starting with slave, get its speed
+ if (((strncmp(SLAVE, dent->d_name, strlen(SLAVE)) == 0) || (strncmp(LOWER,
dent->d_name, strlen(LOWER)) == 0)) &&
+ (dent->d_type == DT_LNK)) {
+ // We have a symlink starting with slave or lower, get its speed
setNetStat(stat_creation_mutex, interface, "speed", dent->d_name, true);
}
+
+ if (strncmp(BONDING_SLAVE_DIR, dent->d_name, strlen(BONDING_SLAVE_DIR)) ==
0 && (dent->d_type != DT_LNK)) {
+ setNetStat(stat_creation_mutex, interface, "ad_actor_oper_port_state",
dent->d_name, false);
+ setNetStat(stat_creation_mutex, interface, "ad_partner_oper_port_state",
dent->d_name, false);
+ }
}
closedir(localdir);