johrstrom / jmeter-prometheus-plugin

A Prometheus Listener for Apache JMeter that exposes results in an http API
Apache License 2.0
168 stars 110 forks source link

Not seeing Jmeter metrics in prometheus #78

Closed ghost closed 4 years ago

ghost commented 4 years ago

I am running the promethues as docker image instead of .exe file. Jmeter is not sending the metrics to promethues server if I run as docker image. Please let me know the reasons. Both are running in the same machine.

Here is Yaml file:

scrape_configs: config.

-- 192.168.1.74 is my inet address.

docker run -d -p 9090:9090 -v ~/Documents/JmeterProm/prometheus1.yml:/etc/prometheus/prometheus.yml prom/prometheus

-- Tested the https://github.com/johrstrom/jmeter-prometheus-plugin/blob/master/docs/examples/simple_prometheus_example.jmx with Jmeter.

If I am trying to access the targets in promethues using this URL http://192.168.1.74:9090/targets is showing Jmeter target as down with below error:

Get http://192.168.1.74:9270/metrics: dial tcp 192.168.1.74:9270: connect: connection refused

If I am trying to access http://192.168.1.74:9270/ is giving "Site can't be reached"

johrstrom commented 4 years ago

I think you probably need to set this property, so it doesn't bind to the loopback interface.

prometheus.ip=0.0.0.0

ghost commented 4 years ago

@johrstrom where I have to set this prometheus.ip=0.0.0.0 property?

johrstrom commented 4 years ago

I think the best practice is in user.properties (as opposed to jmeter.properties).

ghost commented 4 years ago

@johrstrom It is still not working

johrstrom commented 4 years ago

So, this is a container networking issue at this point. I don't think your prometheus container can route to your host. Are you able to see this now http://192.168.1.74:9270/?

I'm not super familiar with how bridges work with docker and Windows. I don't really use either. If you're just testing you can add --network='host' docker run command, that way you just use your hosts' network stack and then you should be able to see jmeter as just localhost.

Or if you need to keep the networking stack seperate you may try adding --add-host=192.168.1.74 to your docker run command.

ghost commented 4 years ago

@johrstrom I can't see any data when I try to access this in the browser - http://192.168.1.74:9270.

Once this is working, I think it will work with docker as well.BTW I am using MAC

ghost commented 4 years ago

@johrstrom its working fine when I add prometheus.ip=0.0.0.0 in user.properties. I made a mistake. you can close it now.