简体   繁体   English

启动prometheus服务时遇到错误

[英]Facing error when starting prometheus service

I am using the following tutorial url I am new to prometheus.我正在使用以下教程url我是普罗米修斯的新手。

error as follows: Failed to start prometheus.service: Unit prometheus.service has a bad unit file setting.报错如下: Failed to start prometheus.service: Unit prometheus.service has a bad unit file setting。

Trace as follows:跟踪如下:

systemctl status prometheus.service 
○ prometheus.service - Prometheus Server
     Loaded: bad-setting (Reason: Unit prometheus.service has a bad unit file setting.)
     Active: inactive (dead)
       Docs: https://prometheus.io/docs/introduction/overview/

Sep 26 02:17:00 fedora systemd[1]: /etc/systemd/system/prometheus.service:13: Neither a valid executable name nor an absolute path: ~/prometheus/prometheus
Sep 26 02:17:00 fedora systemd[1]: prometheus.service: Unit configuration has fatal error, unit will not be started.
Sep 26 02:19:00 fedora systemd[1]: /etc/systemd/system/prometheus.service:13: Neither a valid executable name nor an absolute path: ~/prometheus/prometheus
Sep 26 02:19:00 fedora systemd[1]: prometheus.service: Unit configuration has fatal error, unit will not be started.
Sep 26 02:20:34 fedora systemd[1]: /etc/systemd/system/prometheus.service:13: Neither a valid executable name nor an absolute path: ~/prometheus/prometheus
Sep 26 02:20:34 fedora systemd[1]: prometheus.service: Unit configuration has fatal error, unit will not be started.
Sep 26 02:23:48 fedora systemd[1]: /etc/systemd/system/prometheus.service:13: Neither a valid executable name nor an absolute path: ~/prometheus/prometheus
Sep 26 02:23:48 fedora systemd[1]: prometheus.service: Unit configuration has fatal error, unit will not be started.

prometheus.service file as follows: prometheus.service文件如下:

[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target

[Service]
User=root
Restart=on-failure

#Change this line if you download the 
#Prometheus on different path user

ExecStart=~/prometheus/prometheus --storage.tsdb.path=/var/lib/prometheus/data/ --web.external-url=http://myurl.com:9090

[Install]
WantedBy=multi-user.target

You need to use an absolute path in prometheus.service file:您需要在 prometheus.service 文件中使用绝对路径:

ExecStart=/xxx/yyy/zzz/prometheus/prometheus ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM