0

I installed the Prometheus Blackbox Exporter using this instruction set: https://devconnected.com/how-to-install-and-configure-blackbox-exporter-for-prometheus/

When I start the blackbox exporter from the command line it works fine:

/usr/local/bin/blackbox_exporter --config.file=/etc/blackbox/blackbox.yml --web.listen-address=":9115"
level=info ts=2023-05-09T15:18:12.170335169Z caller=main.go:213 msg="Starting blackbox_exporter" version="(version=0.14.0, branch=HEAD, revision=bba7ef76193948a333a5868a1ab38b864f7d968a)"
level=info ts=2023-05-09T15:18:12.17114947Z caller=main.go:226 msg="Loaded config file"
level=info ts=2023-05-09T15:18:12.171355458Z caller=main.go:330 msg="Listening on address" address=:9115

When I try to run it as a service it does not:

systemctl status blackbox_exporter
blackbox_exporter.service - Blackbox Exporter
   Loaded: loaded (/etc/systemd/system/blackbox_exporter.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2023-05-09 15:20:40 GMT; 5s ago
  Process: 22483 ExecStart=/usr/local/bin/blackbox_exporter --config.file /etc/blackbox_exporter/blackbox.yml (code=exited, status=1/FAILURE)
 Main PID: 22483 (code=exited, status=1/FAILURE)

May 09 15:20:40 hostname systemd[1]: Started Blackbox Exporter.
May 09 15:20:40 hostname systemd[1]: blackbox_exporter.service: main process exited, code=exited, status=1/FAILURE
May 09 15:20:40 hostname systemd[1]: Unit blackbox_exporter.service entered failed state.
May 09 15:20:40 hostname systemd[1]: blackbox_exporter.service failed.

I'm running Prometheus on another box, not sure if that will work with the blackbox exporter and Prometheus itself on separate boxes but something I wanted to try. I thought maybe for some reason not having Prometheus locally was causing problems so I tried installing Prometheus locally using this instruction set: https://devconnected.com/how-to-setup-grafana-and-prometheus-on-linux/

Unfortunately I have the same problem. I can fire up Prometheus just fine from the command line but cannot start it using sudo systemctl start prometheus. As I saw this being an issue on some other threads I researched, I'll also mention that SELinux is disabled on this particular machine. Thoughts anyone? TIA!

2 Answers 2

0

The command that you say works:

/usr/local/bin/blackbox_exporter --config.file=/etc/blackbox/blackbox.yml --web.listen-address=":9115"

What's inside the service definition:

ExecStart=/usr/local/bin/blackbox_exporter --config.file /etc/blackbox_exporter/blackbox.yml

Look carefully. The path to the config file is not the same. Does a directory /etc/blackbox_exporter even exist? Maybe not, and this is your problem. Plus, you may need to add some options like 9115 port unless it's the default.

You could edit the file /etc/systemd/system/blackbox_exporter.service to adapt service definition, then run systemctl daemon-reload, and try to start your service again.

0

It ended up being that something didn't like the command being configured in the config file blackbox.service in this way as per the directions:

ExecStart=/usr/local/bin/blackbox_exporter \
  --config.file=/etc/blackbox/blackbox.yml \
  --web.listen-address=":9115"

When I changed the config file to this it ended up working:

ExecStart=/usr/local/bin/blackbox_exporter \
  --config.file=/etc/blackbox/blackbox.yml \
  --web.listen-address=127.0.0.1:9115

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .