Prometheus.service: Failed with result 'exit-code'. - fresh install, advice wanted

I just installed Promethus on my Raspberry Pi 4 (Raspbian Lite)

After doing so, I ran the command

sudo systemctl status prometheus

This is what it returned:

prometheus.service - Prometheus Server
     Loaded: loaded (/etc/systemd/system/prometheus.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-01-20 02:59:30 AEDT; 39s ago
       Docs: https://prometheus.io/docs/introduction/overview/
    Process: 810 ExecStart=/home/pi/prometheus/prometheus --config.file=/home/pi/prometheus/prometheus.yml --storage.tsdb.path=/home/pi/prometheus/data (code=exited, status=2)
   Main PID: 810 (code=exited, status=2)
        CPU: 480ms

Jan 20 02:59:30 pihole systemd[1]: prometheus.service: Scheduled restart job, restart counter is at 5.
Jan 20 02:59:30 pihole systemd[1]: Stopped Prometheus Server.
Jan 20 02:59:30 pihole systemd[1]: prometheus.service: Start request repeated too quickly.
Jan 20 02:59:30 pihole systemd[1]: prometheus.service: Failed with result 'exit-code'.
Jan 20 02:59:30 pihole systemd[1]: Failed to start Prometheus Server.

I’m just seeking some advice as to how I can resolve this issue.

I would suggest using journalctl to get exact details of the error returned by Prometheus.

However the two common things to check are that the Prometheus user can write to the path specified (/home/pi/prometheus/data) and that the Prometheus YAML file is valid and readable by the Prometheus user (/home/pi/prometheus/prometheus.yml).

I ran the test:

sudo -u pi test -r /home/pi/prometheus/data

and

sudo -u pi test -w /home/pi/prometheus/data

test -r /home/pi/prometheus/data; echo “$?”

returned: 0

test -w /home/pi/prometheus/data; echo “$?”

returned: 0

So it can read the data.

Could you help me diagnose this yaml checker?

Never mind, I followed this and all is working