首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >启动prometheus服务时面临错误

启动prometheus服务时面临错误
EN

Stack Overflow用户
提问于 2021-09-26 08:31:57
回答 1查看 284关注 0票数 0

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

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

追踪情况如下:

代码语言:javascript
复制
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文件如下:

代码语言:javascript
复制
[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
EN

回答 1

Stack Overflow用户

发布于 2021-09-26 17:57:01

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

代码语言:javascript
复制
ExecStart=/xxx/yyy/zzz/prometheus/prometheus ...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69333113

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档