Monitor GitLab on an external Prometheus Server


On my self-hosted GitLab instance, I can monitor these metrics exposed with this URL:

I have a separate external Prometheus server running, and I would like to add these metrics on it.

In the prometheus.yml file, I added this:

  - job_name: "gitlab"
    metrics_path: "/-/metrics"
    scheme: https
    scrape_interval: "5s"
        type: Bearer
        credentials: mytoken
          insecure_skip_verify: true
      - targets:
          - ""
          name: "GitLab"

and restarted Prometheus.

It does not work. In the UI of Prometheus, it says ‘server returned HTTP status 404 Not Found’ for this endpoint.

Is there something wrong in my job configuration?

The docs mention that you need to explicitly allow the IP address of the external Prometheus server to access the GitLab /metrics endpoint. Suggest checking if set.

Thank you for the answer @dnsmichi. I explicitly allowed the IP address of the VM where Prometheus runs and nothing changes.

I also ran curl on the terminal of this VM and nothing happens as well, although it works when I put the URL in my browser.

I assume I need to change some network settings in order for this to work, but I fail to see which exactly. Port 443 is open between the two Vms.