node-status
#
DescriptionThe node-status
Plugin can be used get the status of requests to APISIX by exposing an API endpoint.
#
AttributesNone.
#
APIThis Plugin will add the endpoint /apisix/status
to expose the status of APISIX.
You may need to use the public-api Plugin to expose the endpoint.
#
Enabling the PluginTo configure the node-status
Plugin, you have to first enable it in your configuration file (conf/config.yaml
):
plugins: - example-plugin - limit-req - jwt-auth - zipkin - node-status ......
You have to the setup the Route for the status API and expose it using 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": {} }}'
#
Example usageOnce you have configured the Plugin, you can make a request to the apisix/status
endpoint to get the status:
curl localhost:9080/apisix/status -i
HTTP/1.1 200 OKDate: Tue, 03 Nov 2020 11:12:55 GMTContent-Type: text/plain; charset=utf-8Transfer-Encoding: chunkedConnection: keep-aliveServer: APISIX web server
{"status":{"total":"23","waiting":"0","accepted":"22","writing":"1","handled":"22","active":"1","reading":"0"},"id":"6790a064-8f61-44ba-a6d3-5df42f2b1bb3"}
The parameters in the response are described below:
Parameter | Description |
---|---|
status | Status of APISIX. |
total | Total number of client requests. |
waiting | Number of idle client connections waiting for a request. |
accepted | Number of accepted client connections. |
writing | Number of connections to which APISIX is writing back a response. |
handled | Number of handled connections. Generally, this value is the same as accepted unless any a resource limit is reached. |
active | Number of active client connections including waiting connections. |
reading | Number of connections where APISIX is reading the request header. |
id | UID of APISIX instance saved in apisix/conf/apisix.uid . |
#
Disable PluginTo remove the Plugin, you can remove it from your configuration file (conf/config.yaml
):
plugins: - example-plugin - limit-req - jwt-auth - zipkin ......
To disable the node-status
Plugin on a Route, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
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
:
curl http://127.0.0.1:9080/apisix/admin/routes/ns -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X DELETE