From a4e8b6a17640e1eaec51801fd0f61aef4cd287d9 Mon Sep 17 00:00:00 2001 From: Yoga Ramalingam Date: Mon, 7 Dec 2015 10:09:08 -0500 Subject: [PATCH] interface plugin: Add UniqueName config property. Issue: #1416 --- src/interface.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/interface.c b/src/interface.c index c3f5d40a..d9a0db3a 100644 --- a/src/interface.c +++ b/src/interface.c @@ -89,6 +89,7 @@ static const char *config_keys[] = static int config_keys_num = 2; static ignorelist_t *ignorelist = NULL; +static _Bool unique_name = 0; #ifdef HAVE_LIBKSTAT #define MAX_NUMIF 256 @@ -113,6 +114,11 @@ static int interface_config (const char *key, const char *value) invert = 0; ignorelist_set_invert (ignorelist, invert); } + else if (strcasecmp (key, "UniqueName") == 0) + { + if (IS_TRUE (value)) + unique_name = 1; + } else { return (-1); @@ -295,7 +301,10 @@ static int interface_read (void) if (kstat_read (kc, ksp[i], NULL) == -1) continue; - snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module, ksp[i]->ks_instance, ksp[i]->ks_name); + if (unique_name) + snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module, ksp[i]->ks_instance, ksp[i]->ks_name); + else + snprintf(iname, sizeof(iname), "%s", ksp[i]->ks_name); /* try to get 64bit counters */ rx = get_kstat_value (ksp[i], "rbytes64"); -- 2.11.0