我正在使用 prometheus 和 raspberrypi 设置监控blackbox_exporter
。我正尝试通过 systemd 运行导出器。
我有一个名为的用户blackbox
:
/etc/passwd
:
blackbox:x:999:995::/home/blackbox:/bin/false
sudo vim /etc/systemd/system/blackbox.service
:
[Unit]
Description=Blackbox Exporter Service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=blackbox
Group=blackbox
ExecStart=/home/pi/blackbox/blackbox_exporter --config.file==/home/pi/blackbox/blackbox.yml
[Install]
WantedBy=multi-user.target
错误:
Aug 10 17:02:51 monitor blackbox_exporter[1783]: level=error ts=2021-08-10T16:02:51.364Z caller=main.go:228 msg="Error loading config" err="error reading config file: open =/home/pi/blackbox/blackbox.yml: no such file or directory"
但文件在那里:
ls -l blackbox
total 15496
-rwxrwxrwx 1 blackbox blackbox 15847084 May 10 13:59 blackbox_exporter
-rwxrwxrwx 1 blackbox blackbox 672 Aug 5 18:57 blackbox.yml
-rwxrwxrwx 1 blackbox blackbox 11357 May 10 14:04 LICENSE
-rwxrwxrwx 1 blackbox blackbox 94 May 10 14:04 NOTICE
答案1
打字错误,谢谢 user1686。我复制了路径并做了cat path/to/file
, 和所有操作。当然,我查看了双等号而没有处理它。