Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prometheus target for Routers #2

Open
sayeedc opened this issue Oct 28, 2020 · 2 comments
Open

Prometheus target for Routers #2

sayeedc opened this issue Oct 28, 2020 · 2 comments

Comments

@sayeedc
Copy link

sayeedc commented Oct 28, 2020

I setup a separate prometheus instance to scrape the targets for haproxy, but wasn't able to pull any data. Can provide the prometheus config that's required for this setup?

@luszczynski
Copy link
Owner

Hey @sayeedc,

If you take a look at the Prometheus CR [1] you will see all the details that I used to setup my prometheus instance.
Are you facing any kind of error?

[1] https://github.com/luszczynski/openshift-router-monitoring/blob/master/prometheus-operator-template.yaml#L205

@sayeedc
Copy link
Author

sayeedc commented Nov 4, 2020

Hey @luszczynski

I've got a 401 error when trying to scrape the router metrics from prometheus. I'm using an existing one that's deployed via helm charts, and only need to pull in the HA proxy metrics. To view the kube-state metrics, I actually use the prometheus server in the OCP3.11 cluster monitoring stack as a datasource in my Grafana instance - I can't make modifications to the OCP 3.11 cluster monitoring stack.

I've setup a target on my prometheus server

      - job_name: 'router-apps'
        static_configs:
          - targets:
              - router-apps.default.svc.cluster.local:1936
        basic_auth:
          username: <omitted>
          password: <omitted>

The service monitor is running in the same namespace as my prometheus instance:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    metrics: router-metrics
  name: router-metrics
  namespace: <my-prometheus namespace>
spec:
  endpoints:
  - basicAuth:
      password:
        key: password
        name: servicemonitor-auth
      username:
        key: username
        name: servicemonitor-auth
    interval: 5s
    path: /metrics
    port: monitoring
    scheme: http
  namespaceSelector:
    matchNames:
    - default
  selector:
    matchLabels:
      app: router-apps

I can curl the metrics on the router-apps using the same credentials from within the prometheus pod, but there's something missing on the target settings that's not allowing prometheus to scrape the same endpoint. What am I missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants