node-status
#
Descriptionnode-status
is a plugin which we could get request status information through it's API.
#
AttributesNone
#
APIThis plugin will add /apisix/status
to get status information.
You may need to use public-api plugin to expose it.
#
How To Enable- Configure
node-status
in the plugin list of the configuration fileconf/config.yaml
, then you can add this plugin in any route.
plugins: # plugin list
- example-plugin
- limit-req
- node-status
- jwt-auth
- zipkin
......
- 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- 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"}
- Parameter Description
Parameter | Description |
---|---|
status | status information |
total | the total number of client requests |
waiting | the current number of idle client connections waiting for a request |
accepted | the total number of accepted client connections |
writing | the current number of connections where APISIX is writing the response back to the client |
handled | the total number of handled connections. Generally, the parameter value is the same as accepted unless some resource limits have been reached |
active | the current number of active client connections including waiting connections |
reading | the current number of connections where APISIX is reading the request header |
id | APISIX's uid which is saved in apisix/conf/apisix.uid |
#
Disable Plugin- You can delete
node-status
in the plugin list of the configuration fileapisix/conf/config.yaml
, then you can not add this plugin in any route.
plugins: # plugin list
- example-plugin
- limit-req
- jwt-auth
- zipkin
......
- 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": {}
}'
- 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