summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9a34b41)
raw | patch | inline | side by side (parent: 9a34b41)
author | Maryam Tahhan <maryam.tahhan@intel.com> | |
Tue, 14 Feb 2017 18:34:15 +0000 (18:34 +0000) | ||
committer | Maryam Tahhan <maryam.tahhan@intel.com> | |
Tue, 14 Feb 2017 18:34:15 +0000 (18:34 +0000) |
Fix the shared memory object name so that it's configurable. This way multiple
DPDK applications running in containers can be monitored at the same time
(assuming collectd is also running in that container).
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
DPDK applications running in containers can be monitored at the same time
(assuming collectd is also running in that container).
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/dpdkstat.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 982cba9f32eaac594252c52aab7c314d9930c277..8c5f1e3e49eff314d2b8f084be4b266fec434c2d 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# ProcessType "secondary"
# FilePrefix "rte"
# </EAL>
+# SharedMemObj "dpdk_collectd_stats_0"
# EnabledPortMask 0xffff
# PortName "interface1"
# PortName "interface2"
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 9b32a7811ebfa2a9c7a90ea95a625df370798cb8..a733aa8175b666e9646705828f982fe83100d26a 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
FilePrefix "rte"
SocketMemory "1024"
</EAL>
+ SharedMemObj "dpdk_collectd_stats_0"
EnabledPortMask 0xffff
PortName "interface1"
PortName "interface2"
=back
-=over 4
+=over 3
+
+=item B<SharedMemObj> I<Mask>
+A string containing the name of the shared memory object that should be used to
+share stats from the DPDK secondary process to the collectd dpdkstat plugin.
+Defaults to dpdk_collectd_stats if no other value is configured.
=item B<EnabledPortMask> I<Mask>
diff --git a/src/dpdkstat.c b/src/dpdkstat.c
index fd11097628afcce554c3f2ece05796b093c04bb3..4c73eab917770d7527cf1587dc34a45fd9855398 100644 (file)
--- a/src/dpdkstat.c
+++ b/src/dpdkstat.c
#define DPDK_STATS_CTX_GET(a) ((dpdk_stats_ctx_t *)dpdk_helper_priv_get(a))
dpdk_helper_ctx_t *g_hc = NULL;
-
+static char g_shm_name[DATA_MAX_NAME_LEN] = DPDK_STATS_NAME;
+static int dpdk_stats_reinit_helper();
static void dpdk_stats_default_config(void) {
dpdk_stats_ctx_t *ec = DPDK_STATS_CTX_GET(g_hc);
ec->config.interval = plugin_get_interval();
-
for (int i = 0; i < RTE_MAX_ETHPORTS; i++) {
ec->config.port_name[i][0] = 0;
}
return 0;
}
- int ret = dpdk_helper_init(DPDK_STATS_NAME, sizeof(dpdk_stats_ctx_t), &g_hc);
+ int ret = dpdk_helper_init(g_shm_name, sizeof(dpdk_stats_ctx_t), &g_hc);
if (ret != 0) {
char errbuf[ERR_BUF_SIZE];
ERROR("%s: failed to initialize %s helper(error: %s)", DPDK_STATS_PLUGIN,
- DPDK_STATS_NAME, sstrerror(errno, errbuf, sizeof(errbuf)));
+ g_shm_name, sstrerror(errno, errbuf, sizeof(errbuf)));
return ret;
}
dpdk_stats_default_config();
-
return ret;
}
ctx->config.enabled_port_mask = child->values[0].value.number;
DEBUG("%s: Enabled Port Mask 0x%X", DPDK_STATS_PLUGIN,
ctx->config.enabled_port_mask);
+ } else if (strcasecmp("SharedMemObj", child->key) == 0) {
+ cf_util_get_string_buffer(child, g_shm_name,
+ sizeof(g_shm_name));
+ DEBUG("%s: Shared memory object %s", DPDK_STATS_PLUGIN,
+ g_shm_name);
+ dpdk_stats_reinit_helper();
} else if (strcasecmp("EAL", child->key) == 0) {
ret = dpdk_helper_eal_config_parse(g_hc, child);
if (ret)
g_hc = NULL;
int ret;
- ret = dpdk_helper_init(DPDK_STATS_NAME, data_size, &g_hc);
+ ret = dpdk_helper_init(g_shm_name, data_size, &g_hc);
if (ret != 0) {
char errbuf[ERR_BUF_SIZE];
ERROR("%s: failed to initialize %s helper(error: %s)", DPDK_STATS_PLUGIN,
- DPDK_STATS_NAME, sstrerror(errno, errbuf, sizeof(errbuf)));
+ g_shm_name, sstrerror(errno, errbuf, sizeof(errbuf)));
return ret;
}
static int dpdk_stats_init(void) {
DPDK_STATS_TRACE();
-
int ret = 0;
ret = dpdk_stats_preinit();
g_hc = NULL;
if (ret != 0) {
ERROR("%s: failed to cleanup %s helper", DPDK_STATS_PLUGIN,
- DPDK_STATS_NAME);
+ g_shm_name);
return ret;
}