Prometheus 2 & spring-boot: "no token found"

1,020 views
Skip to first unread message

bo...@kairat.eu

unread,
Oct 27, 2017, 9:36:51 AM10/27/17
to Prometheus Users
Hi @all!

I'm new in the prooooometheus world and just tried to use it in my spring boot project.

What I did:

Add prometheus to pom:
        <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_spring_boot</artifactId>
            <version>0.1.0</version>
        </dependency>

Activate it via annotation:
(Class contained more code in between my tries...)

@Configuration
@EnablePrometheusEndpoint
public class PrometheusConfiguration {}

Download and unpack prometheus:
prometheus-2.0.0-rc.2.linux-amd64.tar.gz

Adapt prometheus.yml

#...
scrape_configs:
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
   
    basic_auth:
        username: admin
        password: s3cr3t

    static_configs:
      - targets: ['localhost:8080']


Run spring-boot app and prometheus.


Targets-Web-Page http://localhost:9090/targets gives me:
prometheus (0/1 up)
Endpoint                                 State     Labels                                 Last Scrape     Error
http://localhost:8080/metrics    down     instance="localhost:8080"     14.734s ago     no token found

Console output of prometeus gives me:
level=warn ts=2017-10-27T13:20:50.25392254Z caller=scrape.go:673 component="target manager" scrape_pool=prometheus target=http://localhost:8080/metrics msg="append failed" err="no token found"

Content of /metrics is:
{"mem":491665,"mem.free":274533,"processors":4,"instance.uptime":940532,"uptime":944976,"systemload.average":0.04,"heap.committed":424960,"heap.init":129024,"heap.used":150426,"heap":1817088,"nonheap.committed":68000,"nonheap.init":2496,"nonheap.used":66705,"nonheap":0,"threads.peak":25,"threads.daemon":21,"threads.totalStarted":29,"threads":23,"classes":9983,"classes.loaded":9983,"classes.unloaded":0,"gc.ps_scavenge.count":9,"gc.ps_scavenge.time":97,"gc.ps_marksweep.count":2,"gc.ps_marksweep.time":107,"httpsessions.max":-1,"httpsessions.active":63,"datasource.primary.active":0,"datasource.primary.usage":0.0,"gauge.response.metrics":398.0,"gauge.response.star-star.favicon.ico":3.0,"counter.status.200.star-star.favicon.ico":2,"counter.status.200.metrics":62,"counter.status.401.metrics":2}


Any ideas? :-|

Greetings!
Boris

Brian Brazil

unread,
Oct 27, 2017, 10:09:38 AM10/27/17
to bo...@kairat.eu, Prometheus Users
That's not valid Prometheus metrics output. Make sure you're specifying the right endpoint to scrape.

Brian
 


Any ideas? :-|

Greetings!
Boris

--
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/57f42277-6828-42e2-a8e7-f00fa376721f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Ben Kochie

unread,
Oct 27, 2017, 11:20:37 AM10/27/17
to bo...@kairat.eu, Prometheus Users
That looks like a very old version of client_java, from back when the output was json.  Looks like you should update to the latest release of client_java.

--

bo...@kairat.eu

unread,
Nov 6, 2017, 8:00:35 AM11/6/17
to Prometheus Users
@Brian Brazil: THX! Monitoring the correct url helps...
Reply all
Reply to author
Forward
0 new messages