-
Notifications
You must be signed in to change notification settings - Fork 0
/
collect-coredns-metrics.sh
executable file
·12 lines (7 loc) · 1.34 KB
/
collect-coredns-metrics.sh
1
2
3
4
5
6
7
METRICS="coredns_build_info coredns_cache_hits_total coredns_cache_size coredns_dns_request_count_total coredns_dns_request_duration_seconds_bucket coredns_dns_request_duration_seconds_count coredns_dns_request_duration_seconds_sum coredns_dns_request_size_bytes_bucket coredns_dns_request_size_bytes_count coredns_dns_request_size_bytes_sum coredns_dns_request_type_count_total coredns_dns_response_rcode_count_total coredns_dns_response_size_bytes_bucket coredns_dns_response_size_bytes_count coredns_dns_response_size_bytes_sum coredns_forward_request_count_total coredns_forward_request_duration_seconds_bucket coredns_forward_request_duration_seconds_count coredns_forward_request_duration_seconds_sum coredns_forward_response_rcode_count_total coredns_health_request_duration_seconds_bucket coredns_health_request_duration_seconds_count coredns_health_request_duration_seconds_sum coredns_kubernetes_dns_programming_duration_seconds_bucket coredns_kubernetes_dns_programming_duration_seconds_count coredns_kubernetes_dns_programming_duration_seconds_sum coredns_panic_count_total coredns_plugin_enabled"
OUTDIR=metrics/coredns
PERIOD=${PERIOD:-6h}
mkdir -p $OUTDIR
for METRIC in $METRICS; do
oc exec -c prometheus -n openshift-monitoring prometheus-k8s-0 -- curl --data-urlencode "query=$METRIC[$PERIOD]" http://localhost:9090/api/v1/query > $OUTDIR/$METRIC
done