node-status

Description

The node-status Plugin can be used get the status of requests to APISIX by exposing an API endpoint.

Attributes

None.

API

This 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 Plugin

To configure the node-status Plugin, you have to first enable it in your configuration file (conf/config.yaml):

conf/config.yaml

  1. plugins:
  2. - example-plugin
  3. - limit-req
  4. - jwt-auth
  5. - zipkin
  6. - node-status
  7. ......

You have to the setup the Route for the status API and expose it using the public-api Plugin.

  1. curl http://127.0.0.1:9180/apisix/admin/routes/ns -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  2. {
  3. "uri": "/apisix/status",
  4. "plugins": {
  5. "public-api": {}
  6. }
  7. }'

Example usage

Once you have configured the Plugin, you can make a request to the apisix/status endpoint to get the status:

  1. curl http://127.0.0.1:9080/apisix/status -i
  1. HTTP/1.1 200 OK
  2. Date: Tue, 03 Nov 2020 11:12:55 GMT
  3. Content-Type: text/plain; charset=utf-8
  4. Transfer-Encoding: chunked
  5. Connection: keep-alive
  6. Server: APISIX web server
  7. {"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:

ParameterDescription
statusStatus of APISIX.
totalTotal number of client requests.
waitingNumber of idle client connections waiting for a request.
acceptedNumber of accepted client connections.
writingNumber of connections to which APISIX is writing back a response.
handledNumber of handled connections. Generally, this value is the same as accepted unless any a resource limit is reached.
activeNumber of active client connections including waiting connections.
readingNumber of connections where APISIX is reading the request header.
idUID of APISIX instance saved in apisix/conf/apisix.uid.

Disable Plugin

To remove the Plugin, you can remove it from your configuration file (conf/config.yaml):

conf/config.yaml

  1. plugins:
  2. - example-plugin
  3. - limit-req
  4. - jwt-auth
  5. - zipkin
  6. ......

You can also remove the Route on /apisix/status:

  1. curl http://127.0.0.1:9180/apisix/admin/routes/ns -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X DELETE