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

Unable to use DNS service discovery for alertmanagers #3877

Closed
wwmtsr opened this Issue Feb 21, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@wwmtsr
Copy link

wwmtsr commented Feb 21, 2018

Hi Prometheus team,

It's totally possible that it's me doing something wrong, but I already read docs a couple of times and haven't found a way how to configure DNS service for alertmanagers (it works just fine for scraping though).

What did you do?
Trying to configure Prometheus talk to Alertmanager
What did you expect to see?
Prometheus server starts and can talk to confgured alertmanagers
What did you see instead? Under which circumstances?
Trying to start Prometheus server with command line like
prometheus --config.file=./conf/prometheus.yml
fails with error
level=error ts=2018-02-21T19:00:56.682964843Z caller=main.go:579 err="Error loading config couldn't load configuration (--config.file=./conf/prometheus.yml): parsing YAML file ./conf/prometheus.yml: yaml: unmarshal errors:\n line 22: cannot unmarshal !!map into []*config.AlertmanagerConfig"
Environment

  • System information:
    Linux 3.10.0-514.26.2.el7.x86_64 x86_64

  • Prometheus version:
    prometheus, version 2.1.0 (branch: HEAD, revision: 85f23d8)
    build user: root@6e784304d3ff
    build date: 20180119-12:01:23
    go version: go1.9.2

  • Alertmanager version:
    alertmanager, version 0.14.0 (branch: HEAD, revision: 30af4d051b37ce817ea7e35b56c57a0e2ec9dbb0)
    build user: root@37b6a49ebba9
    build date: 20180213-08:16:42
    go version: go1.9.2

  • Prometheus configuration file:

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    monitor: 'example-monitor'

scrape_configs:
  - job_name: 'prometheus_servers'
    dns_sd_configs:
      - names:
        - 'monitoring.example.com'
        type: 'A'
        port: 9090
  - job_name: 'pushgateway_servers'
    dns_sd_configs:
      - names:
        - 'monitoring.example.com'
        type: 'A'
        port: 9091
alerting:
  alertmanagers:
    dns_sd_configs:
      - names:
        - 'monitoring.example.com'
        type: 'A'
        port: 9093
  • Alertmanager configuration file:
global:
  smtp_smarthost: 'localhost:25'
  smtp_require_tls: false
  smtp_from: notify@example.com

templates:
- '/etc/alertmanager/template/*.tmpl'

route:
  group_by: ['alertname', 'service']
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 3h
  receiver: emails

inhibit_rules:
- source_match:
    severity: 'critical'
  target_match:
    severity: 'warning'
  equal: ['alertname', 'service']

receivers:
- name: 'emails'
  email_configs:
  - to: notify@example.com
  • Logs:
level=info ts=2018-02-21T19:37:45.274803375Z caller=main.go:225 msg="Starting Prometheus" version="(version=2.1.0, branch=HEAD, revision=85f23d82a045d103ea7f3c89a91fba4a93e6367a)"
level=info ts=2018-02-21T19:37:45.274943273Z caller=main.go:226 build_context="(go=go1.9.2, user=root@6e784304d3ff, date=20180119-12:01:23)"
level=info ts=2018-02-21T19:37:45.274965069Z caller=main.go:227 host_details="(Linux 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 monitoring-215997649-1-325254151 (none))"
level=info ts=2018-02-21T19:37:45.274980971Z caller=main.go:228 fd_limits="(soft=1024, hard=4096)"
level=info ts=2018-02-21T19:37:45.278381256Z caller=main.go:499 msg="Starting TSDB ..."
level=info ts=2018-02-21T19:37:45.279369553Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2018-02-21T19:37:45.522634302Z caller=main.go:509 msg="TSDB started"
level=info ts=2018-02-21T19:37:45.522708601Z caller=main.go:585 msg="Loading configuration file" filename=./conf/prometheus.yml
level=info ts=2018-02-21T19:37:45.523696116Z caller=main.go:386 msg="Stopping scrape discovery manager..."
level=info ts=2018-02-21T19:37:45.523717367Z caller=main.go:400 msg="Stopping notify discovery manager..."
level=info ts=2018-02-21T19:37:45.523726456Z caller=main.go:424 msg="Stopping scrape manager..."
level=info ts=2018-02-21T19:37:45.523747952Z caller=main.go:396 msg="Notify discovery manager stopped"
level=info ts=2018-02-21T19:37:45.523886299Z caller=main.go:382 msg="Scrape discovery manager stopped"
level=info ts=2018-02-21T19:37:45.524366304Z caller=manager.go:59 component="scrape manager" msg="Starting scrape manager..."
level=info ts=2018-02-21T19:37:45.524482622Z caller=manager.go:460 component="rule manager" msg="Stopping rule manager..."
level=info ts=2018-02-21T19:37:45.524501961Z caller=main.go:418 msg="Scrape manager stopped"
level=info ts=2018-02-21T19:37:45.524512223Z caller=manager.go:466 component="rule manager" msg="Rule manager stopped"
level=info ts=2018-02-21T19:37:45.524527531Z caller=notifier.go:493 component=notifier msg="Stopping notification manager..."
level=info ts=2018-02-21T19:37:45.524547713Z caller=main.go:570 msg="Notifier manager stopped"
level=error ts=2018-02-21T19:37:45.524567019Z caller=main.go:579 err="Error loading config couldn't load configuration (--config.file=./conf/prometheus.yml): parsing YAML file ./conf/prometheus.yml: yaml: unmarshal errors:\n  line 22: cannot unmarshal !!map into []*config.AlertmanagerConfig"
level=info ts=2018-02-21T19:37:45.524635492Z caller=main.go:581 msg="See you next time!"
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Feb 21, 2018

You're missing a hyphen before dns_sd_configs.

It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

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