Для управления добавить при запуске:
--web.enable-admin-api
Удалить все метрики:
curl -X POST -g 'http://172.0.0.1:9090/api/v2/admin/tsdb/delete_series?match[]={__name__=~".+"}' curl -X POST -g 'http://172.0.0.1:9090/api/v2/admin/tsdb/clean_tombstones'
Удалить все временные сегменты WAL:
rm -r /prometheus/wal/checkpoint.*.tmp
Удалить весь WAL:
rm -r /prometheus/wal/*
https://www.shellhacks.com/prometheus-delete-time-series-metrics/
https://help.sap.com/viewer/3f4043064eed446a895bc8ba7e61dc83/2.7.latest/en-US/8c69c688050845f9a0f15066ceb6170d.html - Handle Corrupt Prometheus Write-Ahead Log (WAL)
https://help.sap.com/viewer/3f4043064eed446a895bc8ba7e61dc83/2.7.latest/en-US/a432865bd9164d768bf0e9bf0d13f399.html - Change the Prometheus Retention Size and Time
Показать ресурс prometheus в yaml формате:
kubectl get prometheus cluster-monitoring-prometh-prometheus -o=yaml
Включить администрирование через api:
kubectl get prometheus cluster-monitoring-prometh-prometheus -o=yaml | sed 's/enableAdminAPI: false/enableAdminAPI: true/' | kubectl replace -f -
Показать custom resource (kind:) ServiceMonitor:
kubectl get servicemonitors.monitoring.coreos.com/cluster-monitoring-prometh-kubelet -o yaml
Показать аргументы запуска контейнера prometheus в pod prometheus-cluster-monitoring-prometh-prometheus-0:
kubectl get pod prometheus-cluster-monitoring-prometh-prometheus-0 -o=json | jq -r '.spec.containers[] | select( ."name" == "prometheus" ).args'
Послать команду в контейнер prometheus pod'а prometheus-prometheus-operator-prometheus-0:
kubectl -n monitoring exec prometheus-cluster-monitoring-prometh-prometheus-0 -c prometheus -- \ sh -c 'prometheus --version'
https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md - API Docs
https://github.com/prometheus-community/helm-charts/tree/main/charts - Helm charts
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack - collection of Kubernetes manifests