# Kong remove enabled plugin

**URL:** <https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411>\
**Category:** Questions\
**Created:** [December 11, 2018, 12:20pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411 "2018-12-11T12:20:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddie4Frost](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/eddie4frost/32/587_2.png) [@Eddie4Frost](https://discuss.konghq.com/u/Eddie4Frost)\
**Post date:** [December 11, 2018, 12:20pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/1 "2018-12-11T12:20:18Z")

</div>

Hey guys, hope you’re fine!  
I’m using the following environment:  
Kong 0.14.1  
Kong Ingress Controller 0.2.0  
My question is, there’s some bug with this versions when we talk about monitoring plugins, plugins like api-key and rate-limiting works fine, but when I enable the prometheus plugin, kong simple remove the plugin five minutes later, this occurs with statsd plugin too.  
I used the oficial kong docs.  
Help me please!  
Thank you guys!!!

---

<div class="post-metadata">

**Author:** ![thibaultcha](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/thibaultcha/32/340_2.png) [@thibaultcha](https://discuss.konghq.com/u/thibaultcha)\
**Post date:** [December 11, 2018, 4:47pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/2 "2018-12-11T16:47:51Z")

</div>

Hi,

Did you configure the plugin using a [KongPlugin CRD](https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/custom-resources.md#kongplugin)? When using the Kubernetes Ingress Controller, you must configure plugins as such, since the controller will cleanup any manually added resources.

---

<div class="post-metadata">

**Author:** ![Eddie4Frost](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/eddie4frost/32/587_2.png) [@Eddie4Frost](https://discuss.konghq.com/u/Eddie4Frost)\
**Post date:** [December 11, 2018, 6:10pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/3 "2018-12-11T18:10:37Z")

</div>

Hi, I used in that way now as your mention, see below:

apiVersion: [configuration.konghq.com/v1](http://configuration.konghq.com/v1)  
kind: KongPlugin  
metadata:  
name: prometheus-plugin  
namespace: kong  
labels:  
global: “true”  
disabled: false  
config:  
key: value  
plugin: prometheus

And the output is the following:

# curl -i [http://localhost:8001/metrics](http://localhost:8001/metrics)

HTTP/1.1 200 OK  
Server: openresty/1.13.6.2  
Date: Tue, 11 Dec 2018 18:05:19 GMT  
Content-Type: text/plain; charset=UTF-8  
Transfer-Encoding: chunked  
Connection: keep-alive  
Access-Control-Allow-Origin: \*

# HELP kong\_datastore\_reachable Datastore reachable from Kong, 0 is unreachable

# TYPE kong\_datastore\_reachable gauge

kong\_datastore\_reachable 1

# HELP kong\_nginx\_http\_current\_connections Number of HTTP connections

# TYPE kong\_nginx\_http\_current\_connections gauge

kong\_nginx\_http\_current\_connections{state=“accepted”} 1294  
kong\_nginx\_http\_current\_connections{state=“active”} 1  
kong\_nginx\_http\_current\_connections{state=“handled”} 1294  
kong\_nginx\_http\_current\_connections{state=“reading”} 0  
kong\_nginx\_http\_current\_connections{state=“total”} 1294  
kong\_nginx\_http\_current\_connections{state=“waiting”} 0  
kong\_nginx\_http\_current\_connections{state=“writing”} 1

# HELP kong\_nginx\_metric\_errors\_total Number of nginx-lua-prometheus errors

# TYPE kong\_nginx\_metric\_errors\_total counter

kong\_nginx\_metric\_errors\_total 0

Is that correct?  
Because I can’t import this output in the official Kong dashboard ( [https://grafana.com/dashboards/7424](https://grafana.com/dashboards/7424) ).

Thank you

---

<div class="post-metadata">

**Author:** ![Eddie4Frost](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/eddie4frost/32/587_2.png) [@Eddie4Frost](https://discuss.konghq.com/u/Eddie4Frost)\
**Post date:** [December 13, 2018, 12:12pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/4 "2018-12-13T12:12:17Z")

</div>

Hello guys,  
Could you help me please with this question?

Thank you

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [December 14, 2018, 6:31pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/5 "2018-12-14T18:31:02Z")

</div>

Hello @Eddie4Frost,

It seems like `key:value` under the `config` property in your YAML is invalid. Prometheus plugin doesn’t take any config with `key` as a “key”.

Please try the following:

```auto
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: prometheus-plugin
namespace: kong
labels:
global: “true”
plugin: prometheus

```

Also, please note that once you enable this plugin, you’ll need to configure Prometheus to scrape Kong nodes in order for these metrics to be available in Prometheus (which is what Grafana will read from).

---

<div class="post-metadata">

**Author:** ![Eddie4Frost](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/eddie4frost/32/587_2.png) [@Eddie4Frost](https://discuss.konghq.com/u/Eddie4Frost)\
**Post date:** [December 17, 2018, 6:02pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/6 "2018-12-17T18:02:07Z")

</div>

Hey, I hope you are fine!  
I’ve applied the code above and created the following scrape\_config:

- job\_name: ‘kong-exporter’  
static\_configs:  
- targets: [‘[http://localhost:8001](http://localhost:8001)’]  
labels:  
group: ‘kong-exporter’

I’m still doing request with curl and I see the same metric listed above without success on Grafana too.

Thank you for all the support.

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [December 19, 2018, 5:11am UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/7 "2018-12-19T05:11:50Z")

</div>

I’m assuming you’ve put this inside your Prometheus pod running in k8s.

This will not work because `localhost:8001` is scraping the `localhost` of Prometheus pod.  
You will need to configure Prometheus to use k8s service discovery to discover all Kong pods and scrape them.  
Please refer the Prometheus documentation: [https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes\_sd\_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config)

---

<div class="post-metadata">

**Author:** ![Eddie4Frost](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/eddie4frost/32/587_2.png) [@Eddie4Frost](https://discuss.konghq.com/u/Eddie4Frost)\
**Post date:** [December 19, 2018, 10:44am UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/8 "2018-12-19T10:44:50Z")

</div>

Hi there,  
Thank you for your feedback @hbagdi, could you please take a look on these screenshots?

 ![102](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/1X/a70e0968af785dddcaf563a4cd3a51e1e8c4263d.png) ![102](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/1X/7c6ce7965d1d60d9f4be828134d13166dfaebcee.png)

Kong now are sending metric to Prometheus, but only 3 metrics:  
kong\_datastore\_reachable  
kong\_nginx\_http\_current\_connections  
kong\_nginx\_metric\_errors\_total

When doing a curl on metrics:

# HELP kong\_datastore\_reachable Datastore reachable from Kong, 0 is unreachable

# TYPE kong\_datastore\_reachable gauge

kong\_datastore\_reachable 1

# HELP kong\_nginx\_http\_current\_connections Number of HTTP connections

# TYPE kong\_nginx\_http\_current\_connections gauge

kong\_nginx\_http\_current\_connections{state=“accepted”} 36890  
kong\_nginx\_http\_current\_connections{state=“active”} 3  
kong\_nginx\_http\_current\_connections{state=“handled”} 36890  
kong\_nginx\_http\_current\_connections{state=“reading”} 0  
kong\_nginx\_http\_current\_connections{state=“total”} 84368  
kong\_nginx\_http\_current\_connections{state=“waiting”} 2  
kong\_nginx\_http\_current\_connections{state=“writing”} 1

# HELP kong\_nginx\_metric\_errors\_total Number of nginx-lua-prometheus errors

# TYPE kong\_nginx\_metric\_errors\_total counter

kong\_nginx\_metric\_errors\_total 0

The output is different from the official documentation. I don’t have any idea where is the issue.  
Thank you again guys!

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [December 19, 2018, 6:42pm UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/9 "2018-12-19T18:42:58Z")

</div>

Good to see you making progress on this.

Can you make sure that you’ve created a KongPlugin resource for `prometheus` plugin in Kong?

Also, have you created an Ingress rules in your k8s cluster and is Kong actually proxying traffic?

---

<div class="post-metadata">

**Author:** ![salamando](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@salamando](https://discuss.konghq.com/u/salamando)\
**Post date:** [February 15, 2019, 5:57am UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/10 "2019-02-15T05:57:33Z")

</div>

The same problem to me.  
When doing a curl on metrics:

# HELP kong\_datastore\_reachable Datastore reachable from Kong, 0 is unreachable

# TYPE kong\_datastore\_reachable gauge

kong\_datastore\_reachable 1

# HELP kong\_nginx\_http\_current\_connections Number of HTTP connections

# TYPE kong\_nginx\_http\_current\_connections gauge

kong\_nginx\_http\_current\_connections{state=“accepted”} 101406  
kong\_nginx\_http\_current\_connections{state=“active”} 4  
kong\_nginx\_http\_current\_connections{state=“handled”} 101406  
kong\_nginx\_http\_current\_connections{state=“reading”} 0  
kong\_nginx\_http\_current\_connections{state=“total”} 3320855  
kong\_nginx\_http\_current\_connections{state=“waiting”} 3  
kong\_nginx\_http\_current\_connections{state=“writing”} 1

# HELP kong\_nginx\_metric\_errors\_total Number of nginx-lua-prometheus errors

# TYPE kong\_nginx\_metric\_errors\_total counter

kong\_nginx\_metric\_errors\_total 0

There are only some info about nginx.

Kong version 0.14.  
I have created the `prometheus` plugin in Kong and Kong proxyed traffic for period of time.

---

<div class="post-metadata">

**Author:** ![salamando](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@salamando](https://discuss.konghq.com/u/salamando)\
**Post date:** [February 15, 2019, 7:27am UTC](https://discuss.konghq.com/t/kong-remove-enabled-plugin/2411/11 "2019-02-15T07:27:20Z")

</div>

I delete the `prometheus` plugin for test.  
I can still get the same info in /metrics uri.  
It seem like prometheus is not working as expect.  
Where is the data store of prometheus ?  
Is there any way to find prometheus data or check prometheus is working well?
