Thread (8 messages) 8 messages, 4 authors, 2017-03-10

Re: [PATCH v2] proc-info: added collectd-format and host-id options.

flat view

From: Van Haaren, Harry <hidden>
Date: 2017-02-27 15:18:11

Apologies, I reviewed patch v2, but replied to v1 on the mailing list.


For reference, the original reply on v1:
http://dpdk.org/ml/archives/dev/2017-February/058518.html


The same feedback provided here:

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Roman Korynkevych
Sent: Monday, February 27, 2017 2:16 PM
To: dev@dpdk.org
Cc: Korynkevych, RomanX <redacted>
Subject: [dpdk-dev] [PATCH v2] proc-info: added collectd-format and host-id options.

Extended proc-info application to send DPDK port statistics to
STDOUT in the format expected by collectd exec plugin. Added
HOST ID option to identify the host DPDK process is running on
when multiple instance of DPDK are running in parallel. This is
needed for the barometer project in OPNFV.

Signed-off-by: Roman Korynkevych <redacted>

One comment on using hostname retrieval below, but with that fixed in a v3;

Reviewed-by: Harry van Haaren <harry.van.haaren at intel.com>

quoted hunk ↗ jump to hunk
---
 app/proc_info/main.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 121 insertions(+), 5 deletions(-)
diff --git a/app/proc_info/main.c b/app/proc_info/main.c
<snip>
quoted hunk ↗ jump to hunk

+static int
+proc_info_preparse_args(int argc, char **argv)
+{
+	char *prgname = argv[0];
+	int i;
+
+	for (i = 0; i < argc; i++) {
+		/* Print stats or xstats to STDOUT in collectd format */
+		if (!strncmp(argv[i], "--collectd-format", MAX_LONG_OPT_SZ)) {
+			enable_collectd_format = 1;
+			stdout_fd = dup(STDOUT_FILENO);
+			close(STDOUT_FILENO);
+		}
+		if (!strncmp(argv[i], "--host-id", MAX_LONG_OPT_SZ)) {
+			if ((i + 1) == argc) {
+				printf("Invalid host id or not specified\n");
+				proc_info_usage(prgname);
+				return -1;
+			}
+			strncpy(host_id, argv[i+1], sizeof(host_id));
+		}
+	}
+
+	if (!strlen(host_id))
+		strcpy(host_id, "unknown");
+
+	return 0;
+}
+

We should get the machine hostname as a default, IMO better than "unknown". We can fallback to that if the hostname isn't set at all:

if (!strlen(host_id))
     int err = gethostname(host_id, MAX_LONG_OPT_SZ-1);
     if(err)
          strcpy(host_id, "unknown");
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help