prometheus / graphite_exporter

Server that accepts metrics via the Graphite protocol and exports them as Prometheus metrics
Apache License 2.0
356 stars 100 forks source link

Graphite_exporter: Writing metric on port 9109 over TCP failing #41

Closed digambarGitHub closed 6 years ago

digambarGitHub commented 6 years ago

My application is sending metrics over tcp on port 9109 in plaintext protocol format :

I am using method writeBytes() of class **DataOutputStream** to write data on graphite_exporter's 9109 port. There is writing successfully but can not see data on http://localhost:9108/metrics. Before sending data I have started graphite_exporter to listen on port 9108. Can someone has any idea why I can not see my metrics on http://localhost:9108/metrics?
matthiasr commented 6 years ago

What mapping configuration are you using? Do the basic examples here work? Is there anything in the exporter logs about this?

digambarGitHub commented 6 years ago

I have metrics kind of : servers.usva.instance1.cpu.total.user

Configuration(graphite_mapping.conf) file looks like below : servers.star.star.cpu.total.user (here I have star=*) name="servers_cpu_percent" region="$1" instance="$2" job="cpu_job"

Exporter logs stay as it is like : image

Does it matter how old metric_timestamp is?

matthiasr commented 6 years ago

I think the mapping does not match, and therefore the metrics are discarded. Try with

servers.*.*.cpu.total.user

instead? In general, to exclude problems with the mapping, try without the mapping, the metrics should show up even if they're not in a great format.

More long-term, consider using node exporter or WMI exporter to collect CPU utilization metrics. Going through the graphite exporter should be a last resort, if no more native option to get the data you want in Prometheus format is available.

I'll close this issue, since it does not appear to be an issue with the exporter itself. For usage questions, it's better to use the appropriate channels where there are more eyes on the problem.

digambarGitHub commented 6 years ago

I have the metrics as you shown - servers...cpu.total.user

matthiasr commented 6 years ago

Could you attach the mappings file as it is here?

digambarGitHub commented 6 years ago

@matthiasr Here is the file : [graphite_mapping.txt] (https://github.com/prometheus/graphite_exporter/files/1738955/graphite_mapping.txt)

digambarGitHub commented 6 years ago

@matthiasr : issue is resolved, I was sending timestamp 6 hours back. we need to send latest timestamp.

Btw how long back timestamp works for graphite exporter?

matthiasr commented 6 years ago

Anything less than the value of the --graphite.sample-expiry flag should work, by default 5 minutes.

Keep in mind that Prometheus does not ingest old samples the way graphite does. Sending anything older than "now" will most likely not do what you expect.