【问题标题】:Facing error when starting prometheus service启动普罗米修斯服务时遇到错误
【发布时间】:2021-09-26 08:31:57
【问题描述】:

我正在使用以下教程url 我是普罗米修斯的新手。

错误如下: 启动 prometheus.service 失败:单元 prometheus.service 的单元文件设置错误。

跟踪如下:

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 文件如下:

[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

【问题讨论】:

    标签: prometheus


    【解决方案1】:

    你需要在prometheus.service文件中使用绝对路径:

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

    【讨论】:

      猜你喜欢
      • 2019-09-20
      • 1970-01-01
      • 2022-12-06
      • 1970-01-01
      • 2022-01-22
      • 2017-09-03
      • 1970-01-01
      • 2022-10-17
      • 2022-12-02
      相关资源
      最近更新 更多