<p>I have a cluster deployed with:
<a href="https://bitnami.com/stack/prometheus-operator/helm" rel="nofollow noreferrer">https://bitnami.com/stack/prometheus-operator/helm</a>
and
<a href="https://github.com/prometheus-community/postgres_exporter" rel="nofollow noreferrer">https://github.com/prometheus-community/postgres_exporter</a></p>
<p>How to properly add own metrics to the prometheus-operator list of metrics that postgres_exporter exports ?</p>
<p>I tried it that way:</p>
<pre><code>helm upgrade kube-prometheus bitnami/kube-prometheus \
    --set prometheus.additionalScrapeConfigs.enabled=true \
    --set prometheus.additionalScrapeConfigs.type=internal \
    --set prometheus.additionalScrapeConfigs.internal.jobList=
      - job_name: 'prometheus-postgres-exporter' 
        static_configs:
          - targets: ['prometheus-postgres-exporter.default:80']
</code></pre>
<p>but it doesn't work ('job_name:' are not added to the Prometheus Configuration).</p>

stackuser
<p>Use <a href="https://sysdig.com/blog/kubernetes-monitoring-prometheus-operator-part3/" rel="nofollow noreferrer">ServiceMonitors</a> if using Prometheus Operator.</p>
<p>Configure the following block under the values.yaml in the postgres-exporter helm chart.This allows Prometheus Operator to read and configure jobs automatically.</p>
<pre><code>serviceMonitor:
  # When set true then use a ServiceMonitor to configure scraping
  enabled: true
  # Set the namespace the ServiceMonitor should be deployed
  namespace: &lt;namespace where prometheus operator is deployed.&gt;
  # Set how frequently Prometheus should scrape
  interval: 30s
  # Set path to cloudwatch-exporter telemtery-path
  telemetryPath: /metrics
  # Set labels for the ServiceMonitor, use this to define your scrape label for Prometheus Operator
  # labels:
  # Set timeout for scrape
  # timeout: 10s
  # Set of labels to transfer from the Kubernetes Service onto the target
  # targetLabels: []
  # MetricRelabelConfigs to apply to samples before ingestion
  # metricRelabelings: []
</code></pre>
