pcp
[Top] [All Lists]

Re: [pcp] pmlogger_check is fooled by localhost

To: kenj@xxxxxxxxxxxxxxxx
Subject: Re: [pcp] pmlogger_check is fooled by localhost
From: Max Matveev <makc@xxxxxxxxx>
Date: Thu, 15 Apr 2010 16:32:29 +1000
Cc: pcp@xxxxxxxxxxx
In-reply-to: <1271030318.24244.54.camel@xxxxxxxxxxxxxxxx>
References: <19387.53537.727368.123975@xxxxxxxxxxxx> <1270603621.15121.79.camel@xxxxxxxxxxxxxxxx> <19387.65322.68301.468516@xxxxxxxxxxxx> <1270642137.15121.125.camel@xxxxxxxxxxxxxxxx> <19389.24907.135424.300701@xxxxxxxxxxxx> <1270704927.8807.7.camel@xxxxxxxxxxxxxxxx> <19390.53020.92570.731051@xxxxxxxxxxxx> <1270847750.18793.8.camel@bozo-laptop> <19393.8355.508754.477098@xxxxxxxxxxxx> <1271030318.24244.54.camel@xxxxxxxxxxxxxxxx>
On Mon, 12 Apr 2010 09:58:38 +1000, Ken McDonell wrote:

 kenj> I'm afraid it is more than just GetPort() ... we try and get the fqdn of
 kenj> the pmcd host in several places ...
 kenj>       * GetPort() - to be written to the port map file (/tmp/pmlogger/*
 kenj>         in unix-land)
 kenj>       * sendstatus() - for response to a pmlc "status" request
That would work just fine - it will try to get fqdn, fail and return
the name which was fed into the __pmLogCreate (in my case it will be
the name which was used in -h).

 kenj>       * do_preamble() - for the "fake" initial pmResult that contains
 kenj>         the metrics pmcd.pmlogger.host, pmcd.pmlogger.port and
 kenj>         pmcd.pmlogger.archive from pmlogger (not pmcd)
IMO it's worth using the same name which was used in GetPort - just
pass it in instead of trying to get it every time.

 kenj> So, one option could be for -H to disable all of the gethostname() and
 kenj> gethostbyname() calls and use the -h from the command line (or
 kenj> "localhost" by default) without translation.
That would work for me. Ideally I'd put all that stuff into a single
place, do it once at startup and declare that in the environment where
gethostbyname(foo) returns different fqdn results depending on the
time of day or the phase of the moon is just nuts and cannot possible
care about the names, so I can do whatever.

 kenj> This would still leave the messy question of what to do with -P?  You
 kenj> cannot have -h with -P, and -P needs to be able to talk to pmcd on the
 kenj> local host, so should -P imply "localhost" with -H, or the result of
 kenj> gethostname() without -H?
I think it should be status quo - if you're using -P then you must
have a resolvable hostname, -H should apply to -h and be incompatible
with -P.

 kenj> But before exploring that, in your dns-free environment, what does
 kenj> gethostbyname("localhost") return?
It returns "localhost" as fqdn, 127.0.0.1 and, possibly, any other
entires from the 127.0.0.1 line in /etc/hosts.

 kenj> And I assume pcp -h localhost works as expected, correct?
It does - gives me the loggers with the name I've fed into -h.

$ pcp -h localhost
Performance Co-Pilot configuration on localhost:

 platform: SunOS sonya 5.11 snv_111b i86pc
 hardware: 2 cpus, 4 disks, 1015MB RAM
 timezone: EST-10
     pmcd: Version 3.1.0-20100128-1, 4 agents, 2 clients
     pmda: pmcd mmv solaris emmv
 pmlogger: localhost: /export/home/makc/src/pcp/oss/src/pmlogger/mumble
     pmie: sonya: /var/log/pcp/pmie/sonya/pmie.log

max

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