pcp
[Top] [All Lists]

Re: [pcp] [PATCH] PCP pidstat PMDA

To: myllynen@xxxxxxxxxx, Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: [pcp] [PATCH] PCP pidstat PMDA
From: Martins Innus <minnus@xxxxxxxxxxx>
Date: Tue, 21 Apr 2015 13:01:48 -0400
Cc: pcp developers <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <5534EBA8.4030509@xxxxxxxxxx>
References: <5534C680.2020709@xxxxxxxxxx> <493537984.3276058.1429528962326.JavaMail.zimbra@xxxxxxxxxx> <5534EBA8.4030509@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
Marko,

On 4/20/15 8:06 AM, Marko Myllynen wrote:

Those new hotproc.* metrics do allow both a configuration file-based
mechanism (like this new PMDA) & also support a very dynamic pmstore
update model too, like:

# pmstore hotproc.control.config 'fname = "java"'

to set the process filtering on-the-fly (the above syntax may not be
100% correct, thats just from memory - it'll be close though).
Ok, I wasn't aware of this, would be great to know how to do that, the
above example doesn't seem to work and the pmdahotproc.1 man isn't
really that helpful.

I had an off by one error for the fname parameter in the pmda which should be fixed by:



diff --git a/src/pmdas/linux_proc/proc_pid.c b/src/pmdas/linux_proc/proc_pid.c
index 3cbeb17..6ea6c79 100644
--- a/src/pmdas/linux_proc/proc_pid.c
+++ b/src/pmdas/linux_proc/proc_pid.c
@@ -642,7 +642,7 @@ hotproc_eval_procs(void)

            strncpy(vars.fname, cmd, sizeof(vars.fname));
            if (len < sizeof(vars.fname))
-               vars.fname[len] = '\0';
+               vars.fname[len-1] = '\0';
            vars.fname[sizeof(vars.fname) - 1] = '\0';
        }




So you could do something similar to this:

[vagrant@centos65 linux_proc]$ sudo pmstore hotproc.control.config 'fname == "mingetty"'
...update info displayed.....
[vagrant@centos65 linux_proc]$ pminfo -f hotproc.id.uid

hotproc.id.uid
    inst [1134 or "001134 /sbin/mingetty /dev/tty1"] value 0
    inst [1136 or "001136 /sbin/mingetty /dev/tty2"] value 0
    inst [1138 or "001138 /sbin/mingetty /dev/tty3"] value 0
    inst [1141 or "001141 /sbin/mingetty /dev/tty4"] value 0
    inst [1147 or "001147 /sbin/mingetty /dev/tty5"] value 0
    inst [1149 or "001149 /sbin/mingetty /dev/tty6"] value 0

As with proc in general, the amount of information returned will depend on your privilege. All metrics that are available for proc should be there for hotproc. I will work on beefing up the docs. In general, I just took what I could find from the old implementation, but it does need some additions.

Martins

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