prometheus-community/helm-charts

[prometheus] How to enable Service Monitor

jackchuong opened this issue · 3 comments

Is your feature request related to a problem ?

Hi all,
I installed prometheus , grafana by individual charts : prometheus-community/prometheus , grafana/grafana
I want to enable Service Monitor for prometheus like below

prometheus:
  prometheusSpec:
    podMonitorSelectorNilUsesHelmValues: false
    serviceMonitorSelectorNilUsesHelmValues: false
    serviceMonitorSelector:
      matchLabels:
      mykey: myvalue

Is this possible ? Or I have to use prometheus-community/kube-prometheus-stack and set grafana.enabled to false ?

Describe the solution you'd like.

prometheus-community/prometheus values support option to enable Service Monitor

Describe alternatives you've considered.

I don't know.

Additional context.

No response

Is this possible ?

No, it is not. ServiceMonitor is a concept and a custom resource of Prometheus operator. You'd need to deploy Prometheus operator and let it create and manage a Prometheus instance. Service monitors can then be used, amongst other resources, to construct scrape configuration of that Prometheus instance.

The prometheus chart brings a standalone Prometheus server that has to be configured through traditional means supported by the chart.

@jackchuong I have an issue similar to yours. I need to install serviceMonitor to scrap my trivy-operator metrics but i already have the standalone prometheus. I am wondering do you have a way to go about this? or if anyone know how to best approach this without switching to the kube-prometheus-stack?

@suhaad79 no , for now, you have to switch to kube-prometheus-stack or prometheus operator