I've installed the grafana/k8s-monitoring
Helm chart on my minikube
cluster on my physical server (namespace rweather
). I've also installed a single PostgreSQL database on that same node, namespace psql
.
Following this guide from Grafana, I've used:
helm get values grafana-k8s-monitoring -n rweather > current-values.yaml
to export my current values.yaml
, and insert the recommended snippet at the top (no top-level tag collision happens):
alloy:
configs:
integrations:
enabled: true
metrics:
enabled: true
logs:
enabled: true
alloy-metrics:
enabled: true
extraConfig: |-
prometheus.exporter.postgres "postgres" {
data_source_names = ["postgresql://grafanareader:<redacted-pass>@postgres-rairquality-postgresql.psql.svc.cluster.local:5432/rairquality"]
}
prometheus.scrape "postgres" {
targets = prometheus.exporter.postgres.postgres.targets
job_name = "integrations/postgres_exporter"
forward_to = [prometheus.relabel.postgres.receiver]
}
prometheus.relabel "postgres" {
rule {
replacement = "postgres-rairquality-postgresql.psql.svc.cluster.local"
target_label = "instance"
}
forward_to = [prometheus.remote_write.grafana_cloud_metrics.receiver]
}
podLogs:
enabled: true
extraDiscoveryRules: |-
rule {
source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_label_app_kubernetes_io_instance"]
separator = ":"
regex = "psql:postgres-rairquality"
replacement = "postgres"
target_label = "integration"
}
rule {
source_labels = ["integration"]
regex = "postgres"
replacement = "postgres-rairquality-postgresql.psql.svc.cluster.local"
target_label = "instance"
}
rule {
source_labels = ["integration"]
regex = "postgres"
replacement = "integrations/postgres_exporter"
target_label = "job"
}
and use:
helm upgrade grafana-k8s-monitoring grafana/k8s-monitoring -n rweather -f current-values.yaml
to upgrade the chart.
I also force restart all pods, as well as double-check the values.yaml
file after the upgrade command is finished.
However, on Grafana Cloud, the only notice I've gotten is: "No metrics were found for this integration." I've checked the pod logs (especially the alloy
pod) and found no logs related to the connection to the DB. Overall, I don't know what went wrong since there're no further indicators anywhere; it's also likely that I misunderstood the guide.
Edit: I fot to mention this, but the problem is I can't get logs & metrics to work from the PostgreSQL integration - using it as a datasource works just fine.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744375742a4571177.html
评论列表(0条)