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
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
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