I'm afraid it is more than just GetPort() ... we try and get the fqdn of
the pmcd host in several places ...
* GetPort() - to be written to the port map file (/tmp/pmlogger/*
in unix-land)
* sendstatus() - for response to a pmlc "status" request
* do_preamble() - for the "fake" initial pmResult that contains
the metrics pmcd.pmlogger.host, pmcd.pmlogger.port and
pmcd.pmlogger.archive from pmlogger (not pmcd)
So, one option could be for -H to disable all of the gethostname() and
gethostbyname() calls and use the -h from the command line (or
"localhost" by default) without translation.
This would still leave the messy question of what to do with -P? You
cannot have -h with -P, and -P needs to be able to talk to pmcd on the
local host, so should -P imply "localhost" with -H, or the result of
gethostname() without -H?
But before exploring that, in your dns-free environment, what does
gethostbyname("localhost") return?
And I assume pcp -h localhost works as expected, correct?
On Sun, 2010-04-11 at 11:06 +1000, Max Matveev wrote:
> On Sat, 10 Apr 2010 07:15:50 +1000, Ken McDonell wrote:
>
> kenj> Yep, pretty close to my patch (no man page from me either) ... I just
> kenj> went for the -H as a flag, rather than -H hostname (which is the same
> as
> kenj> -h hostname, unless hostname happens to be localhost).
> I can live with H being a flag, but I really like to remove
> gethostbyname from GetPort - it's just another place where pmlogger is
> trying to second-guess user's input and yet another place when it can
> go wrong.
>
> kenj> But more importantly your source and mine don't match without the
> kenj> patch ... I don't have archive_host[] in my source, it uses local[]
> kenj> there and there is no second test for pmcd_host being NULL, no
> strncmp()
> kenj> in an else branch ... ???
> That's because patch was on top of the earlier change I've made which is
> available from
>
> http://oss.sgi.com/cgi-bin/gitweb.cgi?p=makc/pcp;a=shortlog;h=refs/heads/pmlogger
>
> It includes using different names for __pmLogCreate() and for the
> pmNewConext and not trying to resolve the name when creating a map
> file.
>
> And strncmp is a brain-fart - I'm surpised that the stuff works.
>
> max
|