Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prometheus cannot start if local host name contains whitespace #4773

Open
jdickey opened this Issue Oct 23, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@jdickey
Copy link

jdickey commented Oct 23, 2018

Proposal

It's fairly common on Macs (at least) to have spaces embedded in the host name. During system setup, mine got set as "Jeff's iMac", for example; I've seen this on many other Macs with many other people over the years. I would expect that a significant number of your candidate users are on Macs, at least for development; therefore, as things now stand, they cannot even run the Getting Started tutorial.

I believe it's unreasonable to expect people to change hostnames on systems they've been using, often for years, for the convenience of one software system, no matter how potentially useful.

Use case. Why is this important?

“Nice to have” is not a good use case. :)

Nowhere that I saw on the main Prometheus Web page does it indicate that Macs are not supported; indeed, your Download page includes tarballs for Darwin (Mac), Linux, and Windows. In the absence of documentation indicating otherwise, a reasonable user would expect the basic function of the system to be identical across all three systems. It clearly is not, which is mind-boggling for such an apparently mature package.

Bug Report

What did you do?

As laid out in the Getting Started tutorial, I created (and copied) the example prometheus.yml file, and then ran

/tmp/q % prometheus --config.file=prometheus.yml
parse external URL "": parse http://Jeff's iMac:9090/: invalid character " " in host name
/tmp/q %

What did you expect to see?

I expected that the Prometheus server would start accepting connections on http://localhost:9090 as described in the tutorial.

What did you see instead? Under which circumstances?

The error message quoted above: parse external URL "": parse http://Jeff's iMac:9090/: invalid character " " in host name

Environment

  • System information:

    insert output of uname -srm here

    Darwin 17.7.0 x86_64

  • Prometheus version:

    insert output of prometheus --version here

	  prometheus, version 2.4.3 (branch: non-git, revision: non-git)
	  build user:       brew@HighSierra-2.local
	  build date:       20181004-10:23:00
	  go version:       go1.11.1
  • Alertmanager version:

    insert output of alertmanager --version here (if relevant to the issue)

  • Prometheus configuration file:

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets: ['localhost:9090']
  • Alertmanager configuration file:
insert configuration here (if relevant to the issue)

Not known.

  • Logs:
insert Prometheus and Alertmanager logs relevant to the issue here

No logs separate from error output quoted above found on system.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 23, 2018

Per RFCs 1123 2.2.1 and RFC 952 1 which it references, it is not valid to have spaces in a hostname. This is a bug in your OS that it permits you to set an invalid hostname.

@jdickey

This comment has been minimized.

Copy link
Author

jdickey commented Oct 23, 2018

Try reading RFC 761 sometime; it might adjust your attitude.

In principle and in the letter of the RFC you cite (which itself may have a bug), that may be true, but for very nearly 40 years, Postel's Law as stated in RFC 761 has encouraged us to "be conservative in what you do; be liberal in what you accept". By that standard, this is most definitely a defect, since it invalidates a large number of otherwise perfectly-functional development systems.

But then again, as someone who first got into Linux when version 1.0 of the kernel was new and shiny (circa 1994) and ran a business on Linux for more than ten years, the high-and-mighty users-are-always-wrong attitude is why the "Year of the Linux Desktop" was always 5-10 years in the future, until it was clearly a decade or more in an alternate past.

It really depends on what you think Prometheus is supposed to be. If it's a toy or a hobby, carry on; but to be taken seriously as a tool in the real world outside the Linux-geek echo chamber, adjustments are necessary.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 23, 2018

Prometheus needs a valid external URL to work, and the usual default isn't working due to the invalid hostname. I'd suggest trying setting --web.external-url manually.

@jdickey

This comment has been minimized.

Copy link
Author

jdickey commented Oct 23, 2018

Ah. Thanks; that helps. I'll poke at that, then 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.