Prometheus can be configured to scrape the JMX Exporter (or any other 
Prometheus exposition (output) compliant URL.)

On Tuesday, July 25, 2023 at 2:55:23 AM UTC-4 Moe wrote:

> Thanks, Doug I'll look into using the Rest API output.
>
> Yeah, I would need access to List<MetricFamilySamples> returned during 
> collection.
>
> I see that the config file 
> <https://github.com/prometheus/prometheus/blob/main/config/testdata/conf.good.yml>
>  used 
> in Prometheus has a scrape interval defined. Does this call the JMX 
> collector?
>
> On Tuesday, July 25, 2023 at 5:46:40 AM UTC+5:30 Doug Hoard wrote:
>
>> I'm not aware of any code that performs what you are trying to 
>> accomplish. Do you actually need access to the List<MetricFamilySamples> 
>> returned during the collection?
>>
>> Typically, a Java application would use the Prometheus JMX Exporter (as a 
>> Java agent) to expose the metrics via HTTP(S). Your application could 
>> start, pause for a specific period of time, then call the JMX Exporter REST 
>> API on an interval (or for a specific number of iterations), capturing the 
>> output, and parsing it.
>>
>> Here is a link to the Java class used to parse the REST API output used 
>> by the integration tests:
>>
>>
>> https://github.com/prometheus/jmx_exporter/blob/main/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParser.java
>>
>> On Monday, July 24, 2023 at 4:53:28 AM UTC-4 MUSTAJIB MOHAMMED KHAN wrote:
>>
>>> I need to create a Java application which collects JMX metrics from a 
>>> running java process. For this, I am using the JMXCollector 
>>> <https://github.com/prometheus/jmx_exporter/blob/main/collector/src/main/java/io/prometheus/jmx/JmxCollector.java>
>>>  class. 
>>> I couldn't find the option in this to configure it for multiple iterations.
>>>
>>> I have a Java wrapper around this to schedule collection after a 
>>> specified time and for a specified number of iterations. I would like to 
>>> understand if there is an already existing class that I can use.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/eafbf6e5-c1db-4538-b867-56c2b3b69e13n%40googlegroups.com.

Reply via email to