Prometheus plugin returning 405 Method Not Allowed on /metrics

Hello,

I’ve setup a Kong 1.4.1 cluster on three servers with a Cassandra backing.

I have a working service named my-service and I want to monitor it using Prometheus.

Step 1: Enable the plugin for the service:

curl -X POST http://localhost:8001/services/my-service/plugins --data "name=prometheus"
{
  "created_at": 1576630361,
  "consumer": null,
  "id": "d9cb0e37-795c-40f9-8902-c097f73bccf5",
  "service": {
    "id": "376b38e5-913f-4ed0-9556-71c1b2584aca"
  },
  "name": "prometheus",
  "config": {},
  "route": null,
  "run_on": "first",
  "tags": null,
  "protocols": [
    "grpc",
    "grpcs",
    "http",
    "https"
  ],
  "enabled": true
}

Step 2: Validate that the plugin is enabled:

curl http://localhost:8001/services/my-service/plugins
{
  "next": null,
  "data": [
    {
      "created_at": 1576630361,
      "consumer": null,
      "id": "d9cb0e37-795c-40f9-8902-c097f73bccf5",
      "service": {
        "id": "376b38e5-913f-4ed0-9556-71c1b2584aca"
      },
      "enabled": true,
      "name": "prometheus",
      "protocols": [
        "grpc",
        "grpcs",
        "http",
        "https"
      ],
      "run_on": "first",
      "tags": null,
      "route": null,
      "config": {}
    }
}

Step 3: Pull some metrics

curl -i http://localhost:8001/metrics
HTTP/1.1 405 Not Allowed
Date: Wed, 18 Dec 2019 00:55:47 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Server: kong/1.4.1
Content-Length: 32
X-Kong-Admin-Latency: 1

{"message":"Method not allowed"}

Why am I getting “Method not allowed” when I try to pull metrics?

Many thanks!

-Z

Please upgrade to Kong 1.4.2.
This was a bug in 1.4.1.

1 Like

Hahah I thought I was going crazy.

Thanks!


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ