Search code examples
apache-nifiprometheus

PrometheusReportingTask not emitting metrics in NiFi


I created a new PrometheusReportingTask using the hamburger menu and then chose "All Components" strategy, as show below:

enter image description here

In the Settings, Run Schedule is set to "60 sec"

As you can see below the PrometheusReportingTask is running.

Also confirmed this in the nifi log file:

 INFO org.eclipse.jetty.server.Server jetty-9.4.26.v20200117; built: 2020-01-17T12:35:33.676Z; git: 7b38981d25d14afb4a12ff1f2596756144edf695; jvm 11.0.5+10-LTS
 INFO o.e.jetty.server.handler.ContextHandler Started o.e.j.s.ServletContextHandler@3a6d7945{/metrics,null,AVAILABLE}
 INFO o.eclipse.jetty.server.AbstractConnector Started ServerConnector@139a9c85{HTTP/1.1,[http/1.1]}{0.0.0.0:9092}
 INFO org.eclipse.jetty.server.Server Started @16382501ms
 INFO o.a.n.r.p.PrometheusReportingTask PrometheusReportingTask[id=1b3385ce-0174-1000-ff14-1bf8d240953c] Started JETTY server
 INFO o.a.n.c.s.TimerDrivenSchedulingAgent PrometheusReportingTask[id=1b3385ce-0174-1000-ff14-1bf8d240953c] started.

enter image description here

I have a processor group Foo Group and I was expecting to see the JVM as well as this processor group metrics

enter image description here

However when I cURL the metrics endpoint, I don't find any metrics. There is no error, just no output.

$curl localhost:9092/metrics
$

Also, when I stop the PrometheusReportingTask, I do see the metrics endpoint become unavailable

 $curl localhost:9092/metrics
 curl: (7) Failed to connect to localhost port 9092: Connection refused

Is there something else that needs to be configured?

I am using Apache NiFi 1.10.0, and I tried this on 1.12.0 both with no success. Which tells me, there is something I am missing in the configuration or I am not hitting the endpoint correctly.

Thank you.


Solution

  • The trailing slash is required when pulling from the metrics endpoint:

    curl localhost:9092/metrics/