From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <harry.van.haaren@intel.com>
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 08DE48DA2
 for <dev@dpdk.org>; Mon, 27 Feb 2017 16:18:11 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga104.jf.intel.com with ESMTP; 27 Feb 2017 07:18:10 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.35,215,1484035200"; d="scan'208";a="1116150712"
Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75])
 by fmsmga001.fm.intel.com with ESMTP; 27 Feb 2017 07:18:10 -0800
Received: from irsmsx102.ger.corp.intel.com ([169.254.2.230]) by
 IRSMSX153.ger.corp.intel.com ([169.254.9.160]) with mapi id 14.03.0248.002;
 Mon, 27 Feb 2017 15:18:09 +0000
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: "Korynkevych, RomanX" <romanx.korynkevych@intel.com>, "dev@dpdk.org"
 <dev@dpdk.org>
CC: "Korynkevych, RomanX" <romanx.korynkevych@intel.com>
Thread-Topic: [dpdk-dev] [PATCH v2] proc-info: added collectd-format and
 host-id	options.
Thread-Index: AQHSkQQnjXFsjINyhkm8YFoZg8WUWaF89tfQ
Date: Mon, 27 Feb 2017 15:18:08 +0000
Message-ID: <E923DB57A917B54B9182A2E928D00FA6129F5FD0@IRSMSX102.ger.corp.intel.com>
References: <1487955140-32598-1-git-send-email-romanx.korynkevych@intel.com>
 <1488204982-32291-1-git-send-email-romanx.korynkevych@intel.com>
In-Reply-To: <1488204982-32291-1-git-send-email-romanx.korynkevych@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTQ5NzE5MGUtZWRiNy00MmM2LWIyMjktMDJjZTcyODJjNjI0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjdjZTNSWFF0elZLSHJESUQzcTNxK01xTEdBR3NnV0NUanRQeHBvNEFkKzA9In0=
x-ctpclassification: CTP_IC
x-originating-ip: [163.33.239.182]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2] proc-info: added collectd-format and
 host-id	options.
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 27 Feb 2017 15:18:12 -0000

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 <romanx.korynkevych@intel.com>
> Subject: [dpdk-dev] [PATCH v2] proc-info: added collectd-format and host-=
id options.
>=20
> 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.
>=20
> Signed-off-by: Roman Korynkevych <romanx.korynkevych@intel.com>


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>


> ---
>  app/proc_info/main.c | 126 +++++++++++++++++++++++++++++++++++++++++++++=
++++--
>  1 file changed, 121 insertions(+), 5 deletions(-)
>=20
> diff --git a/app/proc_info/main.c b/app/proc_info/main.c

<snip>

>=20
> +static int
> +proc_info_preparse_args(int argc, char **argv)
> +{
> +	char *prgname =3D argv[0];
> +	int i;
> +
> +	for (i =3D 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 =3D 1;
> +			stdout_fd =3D dup(STDOUT_FILENO);
> +			close(STDOUT_FILENO);
> +		}
> +		if (!strncmp(argv[i], "--host-id", MAX_LONG_OPT_SZ)) {
> +			if ((i + 1) =3D=3D 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 =3D gethostname(host_id, MAX_LONG_OPT_SZ-1);
     if(err)
          strcpy(host_id, "unknown");