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

When bad configuration defined prometheus should exit with non zero exit-code. #4293

Closed
k0ste opened this Issue Jun 20, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@k0ste
Copy link

k0ste commented Jun 20, 2018

Bug Report

What did you do?

Prometheus config have a error.

What did you expect to see?

Startup failed -> non zero exit-code.
This is important for automation tools and systemd.

What did you see instead? Under which circumstances?

Startup failed -> zero exit-code.

Environment

  • System information:
Linux 4.11.12-1-nfcustom x86_64
  • Prometheus version:
prometheus, version 2.3.1 (branch: non-git, revision: non-git)
  build user:       someman@linux01
  build date:       20180620-05:11:40
  go version:       go1.10.3
  • Prometheus configuration file:
- mybad:
  • Logs:
[root@linux01 prometheus]# prometheus 
level=info ts=2018-06-20T05:43:40.583393016Z caller=main.go:222 msg="Starting Prometheus" version="(version=2.3.1, branch=non-git, revision=non-git)"
level=info ts=2018-06-20T05:43:40.583468472Z caller=main.go:223 build_context="(go=go1.10.3, user=someman@linux01, date=20180620-05:11:40)"
level=info ts=2018-06-20T05:43:40.58386063Z caller=main.go:224 host_details="(Linux 4.11.12-1-nfcustom #1 SMP PREEMPT Fri Nov 3 13:29:36 +07 2017 x86_64 linux01 (none))"
level=info ts=2018-06-20T05:43:40.584102954Z caller=main.go:225 fd_limits="(soft=1024, hard=4096)"
level=info ts=2018-06-20T05:43:40.585073298Z caller=main.go:514 msg="Starting TSDB ..."
level=info ts=2018-06-20T05:43:40.585125536Z caller=web.go:415 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2018-06-20T05:43:40.593193403Z caller=main.go:524 msg="TSDB started"
level=info ts=2018-06-20T05:43:40.593257652Z caller=main.go:603 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2018-06-20T05:43:40.593524321Z caller=main.go:402 msg="Stopping scrape discovery manager..."
level=info ts=2018-06-20T05:43:40.59355105Z caller=main.go:416 msg="Stopping notify discovery manager..."
level=info ts=2018-06-20T05:43:40.593566994Z caller=main.go:438 msg="Stopping scrape manager..."
level=info ts=2018-06-20T05:43:40.593598464Z caller=main.go:412 msg="Notify discovery manager stopped"
level=info ts=2018-06-20T05:43:40.593743405Z caller=manager.go:464 component="rule manager" msg="Stopping rule manager..."
level=info ts=2018-06-20T05:43:40.593810228Z caller=manager.go:470 component="rule manager" msg="Rule manager stopped"
level=info ts=2018-06-20T05:43:40.594547611Z caller=main.go:398 msg="Scrape discovery manager stopped"
level=info ts=2018-06-20T05:43:40.594595131Z caller=main.go:432 msg="Scrape manager stopped"
level=info ts=2018-06-20T05:43:40.593827729Z caller=notifier.go:512 component=notifier msg="Stopping notification manager..."
level=info ts=2018-06-20T05:43:40.594785248Z caller=main.go:588 msg="Notifier manager stopped"
level=error ts=2018-06-20T05:43:40.594809317Z caller=main.go:597 err="Error loading config couldn't load configuration (--config.file=prometheus.yml): parsing YAML file prometheus.yml: yaml: unmarshal errors:\n  line 1: cannot unmarshal !!seq into config.plain"
level=info ts=2018-06-20T05:43:40.594922161Z caller=main.go:599 msg="See you next time!"


[root@linux01 prometheus]# echo $?
0

promtools works fine:

[root@linux01 prometheus]# promtool check config /etc/prometheus/prometheus.yml 
Checking /etc/prometheus/prometheus.yml
  FAILED: parsing YAML file /etc/prometheus/prometheus.yml: yaml: unmarshal errors:
  line 1: cannot unmarshal !!seq into config.plain

[root@linux01 prometheus]# echo $?
1
@mikeykhalil

This comment has been minimized.

Copy link
Contributor

mikeykhalil commented Jun 20, 2018

I will take a look at this one tonight if nobody has put up a PR by then. I have never contributed to this project, so it may take me sometime to get my environment setup and get accustomed to the repo, but the fix seems like it would be pretty straight forward.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jun 20, 2018

Great! If you've any questions we're in #prometheus-dev on freenode.

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