The Prometheus systemd unit contains Wants=network-online.target, After=network-online.target and WantedBy=multi-user.target. When during boot does Prometheus start?
Once the network is up and the system reaches the normal multi-user state, the regular boot target of a server, provided the unit has been enabled.
* Network first, then Prometheus, as part of the normal multi-user boot. *
Wants=network-online.targetpulls in the "network is online" target, so systemd actually waits for the network to be configured.After=network-online.targetsets the order: start Prometheus only after that target is reached. (Wantsalone does not order;Afteralone does not pull it in, so the two belong together.)WantedBy=multi-user.targetin[Install]is whatsystemctl enableacts on: it hooks the unit into the multi-user target, so it starts on every boot.
Other lines worth knowing: User=/Group=prometheus (run unprivileged), Restart=always with RestartSec=10 (restart after a crash after 10 seconds), and ExecReload=/bin/kill -HUP $MAINPID (a SIGHUP makes Prometheus reload its config without a restart).
After creating the file, systemctl daemon-reload makes systemd read it. Then start runs it now and enable makes it start at boot.
Go deeper:
systemd.unit(5) — Linux manual page — Wants=, After= and WantedBy= in full.
systemd — Running services after the network is up — why After= alone is not enough for network-online.target.