Kubernetes metrics scraping regex for Prometheus

148 views
Skip to first unread message

srijeet chatterjee

unread,
Jul 11, 2017, 3:09:06 PM7/11/17
to Prometheus Users
Hi, 
I have a prometheus confgi file for scraping my kubernetes pod and nodes. I have attached the file with this thread. The problem I'm facing is:

I have created some regular expressions to filter out only the metrics that I need. Its working mostly as expected. However, for the last metric (container_cpu_usage_seconds_total), if I include everything starting with this metric name, the size of my metrics endpoint goes to around 17 megs, which is too high for my use case. I was wondering how I could add another filter to this metric name, to gather only the metrics starting with, for ex,:

container_cpu_usage_seconds_total{container_name="..."

Currently, I know how to add the regex for the [__name__] parameter, but since the "container_name=" part is not a part of the "metric name" as such, 
I am wondering how to add another regex for it. What is the source_label that represents "container_name" in this case. An example would be really helpful :)

Thanks,
Srijeet  

prometheus-configmap.yaml
Reply all
Reply to author
Forward
0 new messages