prometheus in dockers: metrics not showing up in prometheus localhost:9090

2,553 views
Skip to first unread message

vim...@gmail.com

unread,
Jul 7, 2017, 4:56:31 AM7/7/17
to Prometheus Users
Hi
I have a http server where from prometheus gets the stats. Without docker it works fine and I see stats in prometheus. 

when I run both Prometheus and Http server inside 2 different docker container, I do see GET query in http server logs as given below:
172.18.0.1 - - [07/Jul/2017 08:54:45] "GET /metrics HTTP/1.1" 200 -

But no stats are shown except below 4 
scrape_duration_seconds
scrape_samples_post_metric_relabling
scrape_samples_scraped
UP

below is how YML file looks
    - targets: ['172.17.0.1:9200']
        labels:
         group: 'test'



Brian Brazil

unread,
Jul 7, 2017, 5:30:48 AM7/7/17
to vim...@gmail.com, Prometheus Users
On 7 July 2017 at 09:56, <vim...@gmail.com> wrote:
Hi
I have a http server where from prometheus gets the stats. Without docker it works fine and I see stats in prometheus. 

when I run both Prometheus and Http server inside 2 different docker container, I do see GET query in http server logs as given below:
172.18.0.1 - - [07/Jul/2017 08:54:45] "GET /metrics HTTP/1.1" 200 -

But no stats are shown except below 4 
scrape_duration_seconds
scrape_samples_post_metric_relabling
scrape_samples_scraped
UP

These metrics come from Prometheus itself as part of ingestion. I'm guessing that your /metrics is either empty or malformed. Looking at the status targets page should tell you which.

Brian
 

below is how YML file looks
    - targets: ['172.17.0.1:9200']
        labels:
         group: 'test'


--

vim...@gmail.com

unread,
Jul 7, 2017, 5:36:35 AM7/7/17
to Prometheus Users, vim...@gmail.com
Hi Brian
Thank you so much for the reply.
Without dockers it just works fine. only with dockers I am having issues.

=>Looking at the status targets page should tell you which.
where exactly I should see the status?

the http server:
http://172.17.0.1:9200/metrics output is given below and it works fine when I don't use dockers.

test_card_5_memtotal{pgw="1.1.1.1",type="gen"  }     98304
test_card_5_numproc{pgw="1.1.1.1",type="gen"  }     251
test_card_5_cpubusy{pgw="1.1.1.1",type="cpu"  }     13.60107040405273
test_card_5_cpuidle{pgw="1.1.1.1",type="gen"  }     86.39892578125000
test_card_5_memused{pgw="1.1.1.1",type="mem"  }     14618
test_card_5_card{pgw="1.1.1.1",type="gen"  }     5

Brian Brazil

unread,
Jul 7, 2017, 5:39:16 AM7/7/17
to vim...@gmail.com, Prometheus Users
On 7 July 2017 at 10:36, <vim...@gmail.com> wrote:
Hi Brian
Thank you so much for the reply.
Without dockers it just works fine. only with dockers I am having issues.

=>Looking at the status targets page should tell you which.
where exactly I should see the status?

It's the /targets endpoint on Prometheus.
 

the http server:
http://172.17.0.1:9200/metrics output is given below and it works fine when I don't use dockers.

test_card_5_memtotal{pgw="1.1.1.1",type="gen"  }     98304
test_card_5_numproc{pgw="1.1.1.1",type="gen"  }     251
test_card_5_cpubusy{pgw="1.1.1.1",type="cpu"  }     13.60107040405273
test_card_5_cpuidle{pgw="1.1.1.1",type="gen"  }     86.39892578125000
test_card_5_memused{pgw="1.1.1.1",type="mem"  }     14618
test_card_5_card{pgw="1.1.1.1",type="gen"  }     5


That looks correct.

Brian
 



On Friday, July 7, 2017 at 3:00:48 PM UTC+5:30, Brian Brazil wrote:
On 7 July 2017 at 09:56, <vim...@gmail.com> wrote:
Hi
I have a http server where from prometheus gets the stats. Without docker it works fine and I see stats in prometheus. 

when I run both Prometheus and Http server inside 2 different docker container, I do see GET query in http server logs as given below:
172.18.0.1 - - [07/Jul/2017 08:54:45] "GET /metrics HTTP/1.1" 200 -

But no stats are shown except below 4 
scrape_duration_seconds
scrape_samples_post_metric_relabling
scrape_samples_scraped
UP

These metrics come from Prometheus itself as part of ingestion. I'm guessing that your /metrics is either empty or malformed. Looking at the status targets page should tell you which.

Brian
 

below is how YML file looks
    - targets: ['172.17.0.1:9200']
        labels:
         group: 'test'


--

--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/184a0568-56ff-4d79-821d-5c63ccc4653d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

vim...@gmail.com

unread,
Jul 7, 2017, 5:48:44 AM7/7/17
to Prometheus Users, vim...@gmail.com
Thanks so much.
it says "text format parsing error in line 7: unexpected end of input stream"
Please suggest if you have idea about it as well.
Regards
Vimal 
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.



--

Brian Brazil

unread,
Jul 7, 2017, 5:51:57 AM7/7/17
to vim...@gmail.com, Prometheus Users
On 7 July 2017 at 10:48, <vim...@gmail.com> wrote:
Thanks so much.
it says "text format parsing error in line 7: unexpected end of input stream"
Please suggest if you have idea about it as well.

It's probably missing the newline on the last line.

Which client library are you using? They should all produce correct output.

Brian
 
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5bda8f15-a3c0-4c94-89e7-581d857d2cc1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

vim...@gmail.com

unread,
Jul 7, 2017, 6:01:50 AM7/7/17
to Prometheus Users, vim...@gmail.com
Super!! Its actually new line. 

Thanks so much Brian

Have a rocking weekend
Vimal



--
Reply all
Reply to author
Forward
0 new messages