mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-15 17:31:45 +08:00
1f52c70d84
- remove unneeded MD009 - Trailing spaces config entry - MD012 - Multiple consecutive blank lines https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md012---multiple-consecutive-blank-lines
4.6 KiB
4.6 KiB
Summary
Name
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 interceptors to protect 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
......
After starting APISIX
, you can get status information through the API /apisix/status
.
- Create a route object, and enable plugin
node-status
.
$ 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": {
"node-status":{}
}
}'
You have to configure node-status
in the configuration file apisix/conf/config.yaml
before creating a route like this.
And this plugin will not make any difference in future requests, so usually we don't set this plugin when creating routes.
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": {}
}'