prometheus.service: Failed with result 'exit-code'

11,932 views
Skip to first unread message

Vanshika Sahgal

unread,
May 27, 2022, 6:44:43 AM5/27/22
to Prometheus Users
/$ systemctl status prometheus
● prometheus.service - Prometheus
     Loaded: loaded (/etc/systemd/system/prometheus.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2022-05-27 14:28:34 IST; 29min ago
   Main PID: 5676 (code=exited, status=2)

May 27 14:28:34 vanshika systemd[1]: Started Prometheus.
May 27 14:28:34 vanshika prometheus[5676]: ts=2022-05-27T08:58:34.729Z caller=main.go:450 level=error msg="Error loading config (--config.file=/etc/prometheus/prometheus.yml)" file=/etc/prometheus/prome>
May 27 14:28:34 vanshika systemd[1]: prometheus.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 27 14:28:34 vanshika systemd[1]: prometheus.service: Failed with result 'exit-code'.

Can anyone please help why this is happening?
Screenshot 2022-05-27 145919.jpg

Mohammed Reehan

unread,
May 27, 2022, 6:55:21 AM5/27/22
to Vanshika Sahgal, Prometheus Users
can the config file.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/bd9bc9a8-0c24-4435-9245-fa1dab2ec258n%40googlegroups.com.


--
Mohammed Rehan

Mohammed Reehan

unread,
May 27, 2022, 6:55:28 AM5/27/22
to Vanshika Sahgal, Prometheus Users
*Check the config file please

On Fri, May 27, 2022 at 4:14 PM Vanshika Sahgal <vanshik...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/bd9bc9a8-0c24-4435-9245-fa1dab2ec258n%40googlegroups.com.


--
Mohammed Rehan

Vanshika Sahgal

unread,
May 27, 2022, 6:59:04 AM5/27/22
to Prometheus Users
What should the config file be like and how to check it ?

Brian Candler

unread,
May 27, 2022, 9:22:55 AM5/27/22
to Prometheus Users
systemctl status prometheus -l --no-pager    # so you don't get truncated lines
journalctl -eu prometheus    # scroll sideways if necessary

promtool check config /etc/prometheus/prometheus.yml

(you may have to give explicit /path/to/promtool if it's not in your $PATH)

Vanshika Sahgal

unread,
May 28, 2022, 12:27:37 AM5/28/22
to Prometheus Users
yeah, it finally worked. The paths were creating an issue and the prometheus user as well. Is it of importance?

Brian Candler

unread,
May 28, 2022, 3:52:03 AM5/28/22
to Prometheus Users
On Saturday, 28 May 2022 at 05:27:37 UTC+1 Vanshika Sahgal wrote:
yeah, it finally worked. The paths were creating an issue and the prometheus user as well. Is it of importance?

I don't know what you mean. Describe what you had to do with "the paths" and "the prometheus user" and maybe we can comment whether it is important or not.

If you ended up running prometheus as root (say), then that's a really bad idea - for any software in general, not just prometheus.

Haldun Alımlı

unread,
Feb 1, 2023, 3:28:03 AM2/1/23
to Prometheus Users
Hello,
I ran into same problem starting prometheus service. Running the prometheus from the command line reveals the cause.

# sudo -u prometheus /usr/local/bin/prometheus   --config.file=/etc/prometheus/prometheus.yml   --storage.tsdb.path=/var/lib/prometheus   --storage.tsdb.retention.time=30d   --storage.tsdb.retention.size=0   --web.console.libraries=/etc/prometheus/console_libraries   --web.console.templates=/etc/prometheus/consoles   --web.listen-address=:9090   --web.external-url=
level=error ts=2023-01-30T08:27:05.043Z caller=main.go:290 msg="Error loading config (--config.file=/etc/prometheus/prometheus.yml)" err="open /etc/prometheus/prometheus.yml: permission denied"

This was clearly a permissions problem. I fixed it using chmod but in case SELinux is enabled on the node, you may need to check file contexts.
Reply all
Reply to author
Forward
0 new messages