GET /api/v1/rules returns 'Method Not Allowed'

3,375 views
Skip to first unread message

hannesst...@gmail.com

unread,
Sep 6, 2018, 8:18:41 AM9/6/18
to Prometheus Users
I'm struggling to make '/api/v1/rules' work, as it consistently returns HTTP status "Method Not Allowed".

Not sure if it's needed, but I've also tried setting --web.enable-admin-api, but that seems to have no effect on my issue (also I see no evidence in the log output that admin mode got enabled)

Any help appreciated,
    / Hannes.

hannesst...@gmail.com

unread,
Sep 6, 2018, 8:20:06 AM9/6/18
to Prometheus Users
Here's my current log output:
level=info ts=2018-09-06T12:07:31.14942356Z caller=main.go:222 msg="Starting Prometheus" version="(version=2.3.2, branch=HEAD, revision=71af5e29e815795e9dd14742ee7725682fa14b7b)"
level=info ts=2018-09-06T12:07:31.150605077Z caller=main.go:223 build_context="(go=go1.10.3, user=root@5258e0bd9cc1, date=20180712-14:02:52)"
level=info ts=2018-09-06T12:07:31.150628717Z caller=main.go:224 host_details="(Linux 4.4.0-133-generic #159-Ubuntu SMP Fri Aug 10 07:31:43 UTC 2018 x86_64 afb1b572bdc8 (none))"
level=info ts=2018-09-06T12:07:31.150642674Z caller=main.go:225 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2018-09-06T12:07:31.151338321Z caller=main.go:533 msg="Starting TSDB ..."
level=info ts=2018-09-06T12:07:31.151367398Z caller=web.go:415 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2018-09-06T12:07:31.15512848Z caller=main.go:543 msg="TSDB started"
level=info ts=2018-09-06T12:07:31.15516377Z caller=main.go:603 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2018-09-06T12:07:31.166833874Z caller=main.go:629 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2018-09-06T12:07:31.167006568Z caller=main.go:502 msg="Server is ready to receive web requests."

Brian Brazil

unread,
Sep 6, 2018, 8:24:46 AM9/6/18
to hannesst...@gmail.com, Prometheus Users
On 6 September 2018 at 13:20, <hannesst...@gmail.com> wrote:
Here's my current log output:
level=info ts=2018-09-06T12:07:31.14942356Z caller=main.go:222 msg="Starting Prometheus" version="(version=2.3.2, branch=HEAD, revision=71af5e29e815795e9dd14742ee7725682fa14b7b)"

This feature is only going to be available from 2.4.0, so you should wait for that release in the next few days.

Brian

 
level=info ts=2018-09-06T12:07:31.150605077Z caller=main.go:223 build_context="(go=go1.10.3, user=root@5258e0bd9cc1, date=20180712-14:02:52)"
level=info ts=2018-09-06T12:07:31.150628717Z caller=main.go:224 host_details="(Linux 4.4.0-133-generic #159-Ubuntu SMP Fri Aug 10 07:31:43 UTC 2018 x86_64 afb1b572bdc8 (none))"
level=info ts=2018-09-06T12:07:31.150642674Z caller=main.go:225 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2018-09-06T12:07:31.151338321Z caller=main.go:533 msg="Starting TSDB ..."
level=info ts=2018-09-06T12:07:31.151367398Z caller=web.go:415 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2018-09-06T12:07:31.15512848Z caller=main.go:543 msg="TSDB started"
level=info ts=2018-09-06T12:07:31.15516377Z caller=main.go:603 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2018-09-06T12:07:31.166833874Z caller=main.go:629 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2018-09-06T12:07:31.167006568Z caller=main.go:502 msg="Server is ready to receive web requests."


On Thursday, September 6, 2018 at 2:18:41 PM UTC+2, hannesst...@gmail.com wrote:
I'm struggling to make '/api/v1/rules' work, as it consistently returns HTTP status "Method Not Allowed".

Not sure if it's needed, but I've also tried setting --web.enable-admin-api, but that seems to have no effect on my issue (also I see no evidence in the log output that admin mode got enabled)

Any help appreciated,
    / Hannes.

--
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/c39d6e40-c320-4b05-b74f-d96f57691986%40googlegroups.com.

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



--

hannesst...@gmail.com

unread,
Sep 6, 2018, 9:00:29 AM9/6/18
to Prometheus Users
Great, thanks!

johnggi...@gmail.com

unread,
Nov 28, 2018, 9:16:58 AM11/28/18
to Prometheus Users
Hannes, did 2.4.0 or a later version solve this for you?

johnggi...@gmail.com

unread,
Dec 4, 2018, 12:34:51 PM12/4/18
to Prometheus Users
To answer my own question for the benefit of others, 2.4.0 was not a straightforward option for me as we are using Prometheus as part of Openshift, and the first 2.4.x version of the openshift/prometheus image is 2.4.2 (see link below).

However, I used 2.5.0 and I'm happy to confirm that the /rules endpoint is available (as is /alerts too, for example).

The following reference page includes a drop-down which you can change to see which endpoints are available in different versions.

e.g.
etc.

hannesst...@gmail.com

unread,
Feb 12, 2019, 10:05:27 AM2/12/19
to Prometheus Users
Yes, the /api/v1/rules now works great on newer versions!
(sorry for the late reply)
Reply all
Reply to author
Forward
0 new messages