pcp
[Top] [All Lists]

Re: [pcp] pmlogger_check is fooled by localhost

To: Max Matveev <makc@xxxxxxxxx>
Subject: Re: [pcp] pmlogger_check is fooled by localhost
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Wed, 07 Apr 2010 22:08:57 +1000
Cc: pcp@xxxxxxxxxxx
In-reply-to: <19387.65322.68301.468516@xxxxxxxxxxxx>
References: <19387.53537.727368.123975@xxxxxxxxxxxx> <1270603621.15121.79.camel@xxxxxxxxxxxxxxxx> <19387.65322.68301.468516@xxxxxxxxxxxx>
Reply-to: kenj@xxxxxxxxxxxxxxxx
Thanks for the detailed explanation Max.

I was going down the path of pmlogger conditionally doing the remapping
from localhost to whatever gethostname(3) returns, but that gets ugly as
sin when one considers what pmlogger_check would need to do to second
guess pmlogger's behaviour.

So I change my vote ... I think you're original patch suggestion for
pmlogger_check and sticking with localhost in the control file is the
best line of attack.  Could we please have a comment added in
pmlogger_check to explain the rationale?

Cheers, Ken.

On Wed, 2010-04-07 at 13:42 +1000, Max Matveev wrote:
> On Wed, 07 Apr 2010 11:27:01 +1000, Ken McDonell wrote:
> 
>  kenj> The hostname is branded in the archive label and is used later on to
>  kenj> match archives first to merge and then for config files used by tools
>  kenj> like pmie and pmchart and ...
> I understand that...
> 
>  kenj> So not having a unique and real hostname could present something of a
>  kenj> problem for merging archives and using the archives for cross-host
>  kenj> analysis.
> I can get unique hostnames in my setup, I just cannot guarantee that
> I'll be able to map those names to IP addresses which is required for
> -h processing (see below).
> 
>  kenj> Without looking at the code, the patch you're suggesting "doesn't feel
>  kenj> right" ... whatever the control scripts do should be compatible with
>  kenj> pmlogger.
> That's the point - pmlogger_check's processing of the localhost in the
> control file does not match pmlogger' use of localhost, e.g.:
> 
> sonya:~$ cat lhost.ctl 
> $version=1.1
> 
> # === LOGGER CONTROL SPECIFICATIONS ===
> #
> #Host           P?  S?  directory                       args
> 
> # local primary logger
> localhost  n   n   /export/home/makc/pmlogger      -c
> /export/home/makc/conf
> sonya:~$ /usr/libexec/pcp/bin/pmlogger_check -VV -c lhost.ctl 
> [control:1] host="$version=1.1" primary="" socks="" dir="" args=""
> [control:2] host="" primary="" socks="" dir="" args=""
> [control:3] host="#" primary="===" socks="LOGGER" dir="CONTROL"
> args="SPECIFICATIONS ==="
> [control:4] host="#" primary="" socks="" dir="" args=""
> [control:5] host="#Host" primary="P?" socks="S?" dir="directory"
> args="args"
> [control:6] host="" primary="" socks="" dir="" args=""
> [control:7] host="#" primary="local" socks="primary" dir="logger"
> args=""
> [control:8] host="localhost" primary="n" socks="n"
> dir="/export/home/makc/pmlogger" args="-c /export/home/makc/conf"
> Check pmlogger -h localhost ... in /export/home/makc/pmlogger ...
> ... try /var/tmp/pmlogger/7146: match=0 different host, skip
> ... try /var/tmp/pmlogger/8546: match=0 different host, skip
> ... try /var/tmp/pmlogger/9999: match=0 different host, skip
> Restarting pmlogger for host "localhost" ... [process 14013]  done
> Latest folio created for 20100407.13.34
> [control:9] host="" primary="" socks="" dir="" args=""
> sonya:~$ cat /var/tmp/pmlogger/14013 
> 4332
> sonya
> /export/home/makc/pmlogger/20100407.13.34
> sonya:~$ /usr/libexec/pcp/bin/pmlogger_check -c lhost.ctl 
> sonya:~$ /usr/libexec/pcp/bin/pmlogger_check -V -c lhost.ctl 
> Duplicate archive basename ... rename 20100407.13.34.* files to
> 20100407.13.34-01.*
> Restarting pmlogger for host "localhost" ... [process 14160]  done
> Latest folio created for 20100407.13.34
> sonya:~$ cat /var/tmp/pmlogger/14160
> 4334
> sonya
> /export/home/makc/pmlogger/20100407.13.34
> sonya:~$ ps -ef | grep pmlogger
>     makc 14184 10822   0 13:36:35 pts/3       0:00 grep pmlogger
>     makc 14085     1   0 13:34:33 pts/3       0:00 pmlogger -h localhost -c 
> /export/home/makc/conf 20100407.13.34
>     makc 14160     1   0 13:34:39 pts/3       0:00 pmlogger -h localhost -c 
> /export/home/makc/conf 20100407.13.34
>     root  7146     1   0   Mar 30 ?           0:01 
> /usr/libexec/pcp/bin/pmlogger -c conf test.1
>     makc 14013     1   0 13:34:09 pts/3       0:00 pmlogger -h localhost -c 
> /export/home/makc/conf 20100407.13.34
> 
>  kenj> After looking at the code, the status quo would appear to work fine
>  kenj> provided what gethostname(3) returns matches what hostname(1) returns 
> up
>  kenj> to the first `.'.  So in you specific case, what does gethostname(3) 
> and
>  kenj> hostname(1) return?
> Both return 'sonya'
> 
>  kenj> And for extra points, what does uname -n report?
> sonya as well.
> 
> And if I use 'sonya' as hostname, I'm getting
> 
> sonya:~$ /usr/libexec/pcp/bin/pmlogger -h sonya -c conf no.sonya
> sonya:~$ cat pmlogger.log 
> Log for pmlogger on sonya started Wed Apr  7 13:39:19 2010
> 
> pmlogger: Cannot connect to PMCD on host "sonya": No route to host
> 
> Log finished Wed Apr  7 13:39:19 2010
> 
> This is because sonya is not in DNS or /etc/hosts.
> 
> max


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