我正在尝试根据教程启动一项服务:
Description=Prometheus Time Series Collection and Processing Server
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries\
--web.listen-address="0.0.0.0:9091"
[Install]
WantedBy=multi-user.target
但每次我收到Failed to enable unit: File prometheus.service: Invalid argument
日志时:
systemd[1]: /etc/systemd/system/prometheus.service:10: Ignoring unknown escape sequences: "\"
systemd[1]: /etc/systemd/system/prometheus.service:11: Missing '='.
我在 nano 和 vi 中都尝试过。
答案1
启动 Prometheus 的命令应该是:
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.listen-address="0.0.0.0:9091"
登记=
入住--config-file
并--storage.tsdb.path
。并删除尾随空格