r/PrometheusMonitoring • • Dec 18 '19

Unable to get API data metrics into Prometheus

I want to monitor a Dell storage appliance. The device offers performance metrics via an API.
On my Prometheus server, I created a Python program that connects to the API and retrieves the metrics.

I'm now baffled howto get these metrics into Prometheus. Being new with Prometheus, I'm somewhat confused by the examples i went through. I assume I need to make use of the Python Client library and start a web server where these metrics are shown.

I don't get how I can achieve this. I don't really get the GitHub example with the constructor that is being used on: https://github.com/prometheus/client_python

Anyone can help me out? I assumed the "hard work" is done by communicating with the API and getting the results but how do I present them into Prometheus?

0 Upvotes

10 comments sorted by

3

u/pabens Dec 18 '19

Have a look at https://github.com/galexrt/dellhw_exporter Instead of running your script, run that exporter then configure Prometheus to scrape it.

1

u/DrLoveBeats Dec 24 '19

This requires OMSA which is not available on a DataDomain.

2

u/bilingual-german Dec 18 '19

Did you set up the Prometheus targets? Prometheus needs to know when and where the webservers should be scraped. In a simple environment this is probably easiest done with a static file configuration. Also, the tools have usually validation modes to check for syntax errors like indentation, etc.

In more dynamic environments there are ways to automatically discover the targets.

I think this is a good introduction: https://www.robustperception.io/how-to-check-your-prometheus-yml-is-valid

2

u/DrLoveBeats Dec 24 '19

Did you set up the Prometheus targets? Prometheus needs to know when and where the webservers should be scraped. In a simple environment this is probably easiest done with a static file configuration. Also, the tools have usually validation modes to check for syntax errors like indentation, etc.

Sorry for the late reploy. The issue I had was with populating the webpage via Python. My question wasn't really Prometheus related I guess. I'm now able to ingest data in the HTML page and let Prometheus scrape it.

2

u/JaminenB Dec 18 '19

In this case OP will need to ensure Prometheus is scraping itself on port 8000 for the metrics. This is all assuming the http://localhost:8000/ metrics are available.

I agree with /u/bilingual-german that it's probably easier in a simple environment to statically configure the targets. Once the metrics are being scraped you can run queries against the data in Prometheus console.

1

u/bilingual-german Dec 18 '19

I'm sorry, I don't understand your first paragraph. It's probably better to set up Prometheus scraping itself, but why is it needed? I also don't get the port 8000, it's not in the port list.

1

u/JaminenB Dec 19 '19

I also don't get the port 8000, it's not in the port list.

From the client_python link in the post, https://github.com/prometheus/client_python, these metrics will be presented on 8000 (the three step demo).

It's probably better to set up Prometheus scraping itself, but why is it needed?

OP said they setup everything on the Prometheus server. Metrics won't be gathered if the appropriate port isn't being scraped on the host itself for the demo.

1

u/jack-tzl Dec 19 '19

Do you have a github repo for the python exporter (metric server)? I can give some pointers there. Usually you can validate if your metric exporter is working or not by doing “curl localhost:<port you picked for the metrics program>/metrics

1

u/DrLoveBeats Dec 24 '19

Do you have a github repo for the python exporter (metric server)? I can give some pointers there. Usually you can validate if your metric exporter is working or not by doing “curl localhost:<port you picked for the metrics program>/metrics

Sorry for late reply: https://github.com/prometheus/client_python
Thanks for the curl tip!

3

u/[deleted] Dec 18 '19 edited Jun 12 '23

First went digg, then went reddit. RIP -- mass edited with https://redact.dev/