prometheus- postgresql -export添加指标到bitnami/kube-prometheus.&



我有一个集群部署:https://bitnami.com/stack/prometheus-operator/helm和https://github.com/prometheus-community/postgres_exporter

如何正确地将自己的指标添加到postgres_export导出的prometheus-operator列表中?

我试过了:

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']

但是它不工作('job_name:'没有添加到Prometheus配置中)。

如果使用Prometheus Operator,请使用servicemonitor

在值下配置以下块。在postgresql -export helm图表中。这允许Prometheus Operator自动读取和配置作业。

serviceMonitor:
# When set true then use a ServiceMonitor to configure scraping
enabled: true
# Set the namespace the ServiceMonitor should be deployed
namespace: <namespace where prometheus operator is deployed.>
# 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: []

最新更新