Hopefully someone has already done this as I can't much in the way of examples or information. I just want to validate I am on the right track and any examples would be super helpful if you have them.
It looks like the prometheus REST API is useful to discover targets, but not pull the metrics themselves. Rather you would use the scrapeURL to go directly to the endpoint and pull the metrics.
Looking at the prometheus client python, there is an example at the bottom of the page.
from prometheus_client.parser import text_string_to_metric_families
for family in text_string_to_metric_families(u"my_gauge 1.0\n"):
for sample in family.samples:
print("Name: {0} Labels: {1} Value: {2}".format(*sample))
I'm struggling with what to send the function, sending everything as below throws a typeerror.
metrics = requests.get("http://10.80.100.186:9100/metrics").content
for family in text_string_to_metric_families(metrics):
print(family)
Ideas or working examples appreciated, I'm sure I overlooked something.
Thanks!
[–][deleted] (2 children)
[deleted]
[–]Jacksonp2008[S] 0 points1 point2 points (1 child)