Skip to main content
Version: 2.14

node-status

Description#

node-status is a plugin which we could get request status information through it's API.

Attributes#

None

API#

This plugin will add /apisix/status to get status information. You may need to use public-api plugin to expose it.

How To Enable#

  1. Configure node-status in the plugin list of the configuration file conf/config.yaml, then you can add this plugin in any route.
plugins:                          # plugin list
- example-plugin
- limit-req
- node-status
- jwt-auth
- zipkin
......
  1. Setup the route for the status API, which will use the public-api plugin.
$ curl http://127.0.0.1:9080/apisix/admin/routes/ns -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/apisix/status",
"plugins": {
"public-api": {}
}
}'

Test Plugin#

  1. Request with uri /apisix/status
$ curl localhost:9080/apisix/status -i
HTTP/1.1 200 OK
Date: Tue, 03 Nov 2020 11:12:55 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX web server

{"status":{"total":"23","waiting":"0","accepted":"22","writing":"1","handled":"22","active":"1","reading":"0"},"id":"6790a064-8f61-44ba-a6d3-5df42f2b1bb3"}
  1. Parameter Description
ParameterDescription
statusstatus information
totalthe total number of client requests
waitingthe current number of idle client connections waiting for a request
acceptedthe total number of accepted client connections
writingthe current number of connections where APISIX is writing the response back to the client
handledthe total number of handled connections. Generally, the parameter value is the same as accepted unless some resource limits have been reached
activethe current number of active client connections including waiting connections
readingthe current number of connections where APISIX is reading the request header
idAPISIX's uid which is saved in apisix/conf/apisix.uid

Disable Plugin#

  1. You can delete node-status in the plugin list of the configuration file apisix/conf/config.yaml, then you can not add this plugin in any route.
plugins:                          # plugin list
- example-plugin
- limit-req
- jwt-auth
- zipkin
......
  1. When you want to disable the node-status plugin in the route, it is very simple, you can delete the corresponding json configuration in the plugin configuration, no need to restart the service, it will take effect immediately.
$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
"uri": "/route1",
"upstream": {
"type": "roundrobin",
"nodes": {
"192.168.1.100:80": 1
}
},
"plugins": {}
}'
  1. You can also remove the route on /apisix/status, no one can access the API.
$ curl http://127.0.0.1:9080/apisix/admin/routes/ns -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X DELETE