ibotty / golang-github-prometheus-node_exporter

MIT License
11 stars 6 forks source link

Service Starts should start after Network #5

Closed juame closed 6 years ago

juame commented 6 years ago

Hi

The unit always failed to start during boot on RHEL7.4:

$ systemctl status node_exporter
 node_exporter.service - Node Exporter
   Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2018-06-04 12:59:38 CEST; 2min 43s ago
  Process: 990 ExecStart=/usr/sbin/node_exporter $OPTIONS (code=exited, status=1/FAILURE)
 Main PID: 990 (code=exited, status=1/FAILURE)

After adding After=network.target to /usr/lib/systemd/system/node_exporter.service it seems to start at boot:

[Unit]
Description=Node Exporter
After=network.target

Does anyone else having the same issue? Thanks!

juame commented 6 years ago

Maybe this is caused by --web.listen-address= in OPTIONS of /etc/sysconfig/node_exporter (added by us).

ibotty commented 6 years ago

Sorry, I missed that issue. I don't know, why I did not get any email from github. Anyway.

I am pretty sure that it ought to work before network comes up if it listens on 0.0.0.0 (i.e. all interfaces). If am reluctant to add After=network-online.target, because I feel it might not be necessary.

You can add that service config part in /etc/systemd/system/node_exporter.service.d/01-after-network.conf so that you don't have to worry about updates.

Please reopen (or comment), if other are having the same problem!

juame commented 6 years ago

Thanks for the answer and providing a way how to configure this, @ibotty. I‘m going to configure it like you proposed.