pcp
[Top] [All Lists]

Re: PCP versions of console tools - Next Steps

To: Ryan Doyle <ryan@xxxxxxxxxxxx>
Subject: Re: PCP versions of console tools - Next Steps
From: Sitaram Shelke <sitaramshelke@xxxxxxxxx>
Date: Wed, 11 May 2016 19:24:35 +0530
Cc: mgoodwin@xxxxxxxxxx, Nathan Scott <nathans@xxxxxxxxxx>, pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=IwPLNhqwFmCxfmWpZKCORVfy9g2GYk2ST2cKy8lx010=; b=FqfB08BYFLoAJeeheTIPWxnNaA6OOxpeR+HMPubKl5Ufz35N5D/KMDgdOdgwAeVEov tMsRgbj7+/+dIHGJthK2ANIkPqK+igjh8qGQBbnh+sBuW9iSzIbkbmndG6s+LTlAO3cu bTmr6s4x2d+TRng1zcIM2MOu6VfoU4zb/HEt+CD+NSabqCEltNvj/xwnWS9EAx2f0pir s5IePj4xssJzVEDn+oVG6MyHg6T9LylvcW1On5yw2KZl41Pzr8b+bqo9VjrPVzTNKZXC hhabrRYzvXHDH8JmDONuxbOw74Mkoqjm3j/r9+/zwLl3dDxktK2ovT2upRUFZSOZ23lG 8glA==
In-reply-to: <573302F7.5@xxxxxxxxxxxx>
References: <CAHnM1zzTfNgt4Hsgt_Pgq7M-yz+ewd_FehB+QMxixE1MFfKOvA@xxxxxxxxxxxxxx> <572F065E.20601@xxxxxxxxxxxx> <CAHnM1zzfB6H=-oz3HnsvByGSih6Ktj9Zo3cr-kGM5DE4npa60g@xxxxxxxxxxxxxx> <573067F5.9040409@xxxxxxxxxxxx> <CAHnM1zxDgpxK2m5AQ=pL8Dwz1nydtW36ZJC8wkj9axYDdaMiMg@xxxxxxxxxxxxxx> <57307EA4.1070204@xxxxxxxxxxxx> <CAHnM1zxJj8c6A18YUmjDXDJvc_Nwb=MwzxkCAfwUE3=OGXt25w@xxxxxxxxxxxxxx> <573302F7.5@xxxxxxxxxxxx>
Hello Ryan,
Thanks for the input :)
I have merged the PR and updated the code to print pids and external names. I again used the names that were already derived from pmDesc.
Also, I stripped off the options from the names to have short, readable name by simple omiting anything after a whitespace followed by dash. I have added the output in Readme.
Now I have put the doing card in 'For Review'.Â
Once this is done will move to 'pmFetchGroup' task.
Regards,
Sitaram

On Wed, May 11, 2016 at 3:31 PM, Ryan Doyle <ryan@xxxxxxxxxxxx> wrote:
Hi Sitaram

On 11/05/16 16:06, Sitaram Shelke wrote:

I have added some code to https://github.com/sitaramshelke/pmapi-procinfo .
I was able to print all pids in instances of the metric
'proc.psinfo.pid'Â using the normal approach that we used in the
previous example but I could not figure out the way to print external
names of those instances. For example, '024999 bash' for pid 24999.
So I used pmGetInDom() for this. Using this I was able to get pids as
well as names for those instances.
But I want to know is it the right way?

pmGetInDom is the right way to get a internal instance ID to external instance name mapping. The variable you've called "pidlist" on line 30 is actually the internal instance ID. It just to happens that it uses the same ID as the PID (which does make sense).

I've sent you a pull request that shows you how you can get the external instance name from a pmResult (by looking up information in the pmGetInDom call).

It's not the most efficient lookup (it ends up O(n^2)) and not something you would want to do with every pmFetch() call but its good enough for this example.

Also, the pmNameInDom() function could be used to lookup the external instance name from an internal instance ID but we would be doing an API call for each instance in the pmResult.

Lastly, I've moved the card you are working on now to "Doing" on the Wekan board. You're free to move these around too of course so there is no need to wait for me.

Cheers!
Ryan



--
-sitaram
<Prev in Thread] Current Thread [Next in Thread>