The ngx_http_api_module
module (1.13.3) provides REST API for accessing various status information, configuring upstream server groups on-the-fly, and managing key-value pairs without the need of reconfiguring nginx.
The module supersedes the ngx_http_status_module and ngx_http_upstream_conf_module modules.
This module is available as part of our commercial subscription.
http { upstream backend { zone http_backend 64k; server backend1.example.com weight=5; server backend2.example.com; } proxy_cache_path /data/nginx/cache_backend keys_zone=cache_backend:10m; server { server_name backend.example.com; location / { proxy_pass http://backend; proxy_cache cache_backend; health_check; } status_zone server_backend; } keyval_zone zone=one:32k state=one.keyval; keyval $arg_text $text zone=one; server { listen 127.0.0.1; location /api { api write=on; allow 127.0.0.1; deny all; } } } stream { upstream backend { zone stream_backend 64k; server backend1.example.com:12345 weight=5; server backend2.example.com:12345; } server { listen 127.0.0.1:12345; proxy_pass backend; status_zone server_backend; health_check; } }
All API requests include a supported API version in the URI. Examples of API requests with this configuration:
http://127.0.0.1/api/3/ http://127.0.0.1/api/3/nginx http://127.0.0.1/api/3/connections http://127.0.0.1/api/3/http/requests http://127.0.0.1/api/3/http/server_zones/server_backend http://127.0.0.1/api/3/http/caches/cache_backend http://127.0.0.1/api/3/http/upstreams/backend http://127.0.0.1/api/3/http/upstreams/backend/servers/ http://127.0.0.1/api/3/http/upstreams/backend/servers/1 http://127.0.0.1/api/3/http/keyvals/one?key=arg1 http://127.0.0.1/api/3/stream/ http://127.0.0.1/api/3/stream/server_zones/server_backend http://127.0.0.1/api/3/stream/upstreams/ http://127.0.0.1/api/3/stream/upstreams/backend http://127.0.0.1/api/3/stream/upstreams/backend/servers/1
Syntax: | api
[write=on|off]; |
---|---|
Default: | — |
Context: | location |
Turns on the REST API interface in the surrounding location. Access to this location should be limited.
The write
parameter determines whether the API is read-only or read-write. By default, the API is read-only.
All API requests should contain a supported API version in the URI. If the request URI equals the location prefix, the list of supported API versions is returned. The current API version is “3
”.
The optional “fields
” argument in the request line specifies which fields of the requested objects will be output:
http://127.0.0.1/api/3/nginx?fields=version,build
Syntax: | status_zone zone; |
---|---|
Default: | — |
Context: | server |
This directive appeared in version 1.13.12.
Enables collection of virtual http or stream server status information in the specified zone
. Several servers may share the same zone.
/
Supported methods:
GET
- Return list of root endpoints Returns a list of root endpoints.
Possible responses:
/nginx
Supported methods:
GET
- Return status of nginx running instance Returns nginx version, build name, address, number of configuration reloads, IDs of master and worker processes.
Request parameters:
fields
(string
, optional)Possible responses:
/processes
Supported methods:
GET
- Return nginx processes status Returns the number of abnormally terminated and respawned child processes.
Possible responses:
DELETE
- Reset nginx processes statistics Resets counters of abnormally terminated and respawned child processes.
Possible responses:
/connections
Supported methods:
GET
- Return client connections statistics Returns statistics of client connections.
Request parameters:
fields
(string
, optional)Possible responses:
DELETE
- Reset client connections statistics Resets statistics of accepted and dropped client connections.
Possible responses:
/ssl
Supported methods:
GET
- Return SSL statistics Returns SSL statistics.
Request parameters:
fields
(string
, optional)Possible responses:
DELETE
- Reset SSL statistics Resets counters of SSL handshakes and session reuses.
Possible responses:
/slabs/
Supported methods:
GET
- Return status of all slabs Returns status of slabs for each shared memory zone with slab allocator.
Request parameters:
fields
(string
, optional)fields
” value is empty, then only zone names are output.Possible responses:
/slabs/{slabZoneName}
slabZoneName
(string
, required)Supported methods:
GET
- Return status of a slab Returns status of slabs for a particular shared memory zone with slab allocator.
Request parameters:
fields
(string
, optional)Possible responses:
SlabNotFound
), returns Error
DELETE
- Reset slab statistics Resets the “reqs
” and “fails
” metrics for each memory slot.
Possible responses:
/http/
Supported methods:
GET
- Return list of HTTP-related endpoints Returns a list of first level HTTP endpoints.
Possible responses:
/http/requests
Supported methods:
GET
- Return HTTP requests statistics Returns status of client HTTP requests.
Request parameters:
fields
(string
, optional)Possible responses:
DELETE
- Reset HTTP requests statistics Resets the number of total client HTTP requests.
Possible responses:
MethodDisabled
), returns Error
/http/server_zones/
Supported methods:
GET
- Return status of all HTTP server zones Returns status information for each HTTP server zone.
Request parameters:
fields
(string
, optional)fields
” value is empty, then only server zone names are output.Possible responses:
/http/server_zones/{httpServerZoneName}
httpServerZoneName
(string
, required)Supported methods:
GET
- Return status of an HTTP server zone Returns status of a particular HTTP server zone.
Request parameters:
fields
(string
, optional)Possible responses:
ServerZoneNotFound
), returns Error
DELETE
- Reset statistics for an HTTP server zone Resets statistics of accepted and discarded requests, responses, received and sent bytes in a particular HTTP server zone.
Possible responses:
/http/caches/
Supported methods:
GET
- Return status of all caches Returns status of each cache configured by proxy_cache_path and other “*_cache_path
” directives.
Request parameters:
fields
(string
, optional)fields
” value is empty, then only names of cache zones are output.Possible responses:
/http/caches/{httpCacheZoneName}
httpCacheZoneName
(string
, required)Supported methods:
GET
- Return status of a cache Returns status of a particular cache.
Request parameters:
fields
(string
, optional)Possible responses:
CacheNotFound
), returns Error
DELETE
- Reset cache statistics Resets statistics of cache hits/misses in a particular cache zone.
Possible responses:
/http/upstreams/
Supported methods:
GET
- Return status of all HTTP upstream server groups Returns status of each HTTP upstream server group and its servers.
Request parameters:
fields
(string
, optional)fields
” value is empty, only names of upstreams are output.Possible responses:
/http/upstreams/{httpUpstreamName}/
httpUpstreamName
(string
, required)Supported methods:
GET
- Return status of an HTTP upstream server group Returns status of a particular HTTP upstream server group and its servers.
Request parameters:
fields
(string
, optional)Possible responses:
UpstreamStatic
), returns Error
UpstreamNotFound
), returns Error
DELETE
- Reset statistics of an HTTP upstream server group Resets the statistics for each upstream server in an upstream server group and queue statistics.
Possible responses:
/http/upstreams/{httpUpstreamName}/servers/
httpUpstreamName
(string
, required)Supported methods:
GET
- Return configuration of all servers in an HTTP upstream server group Returns configuration of each server in a particular HTTP upstream server group.
Possible responses:
UpstreamStatic
), returns Error
UpstreamNotFound
), returns Error
POST
- Add a server to an HTTP upstream server group Adds a new server to an HTTP upstream server group. Server parameters are specified in the JSON format.
Request parameters:
postHttpUpstreamServer
(HTTP Upstream Server, required)ID
”, “backup
”, and “service
” parameters cannot be changed.Possible responses:
UpstreamStatic
), invalid “parameter
” value (UpstreamConfFormatError
), missing “server
” argument (UpstreamConfFormatError
), unknown parameter “name
” (UpstreamConfFormatError
), nested object or list (UpstreamConfFormatError
), “error
” while parsing (UpstreamBadAddress
), service upstream “host
” may not have port (UpstreamBadAddress
), service upstream “host
” requires domain name (UpstreamBadAddress
), invalid “weight
” (UpstreamBadWeight
), invalid “max_conns
” (UpstreamBadMaxConns
), invalid “max_fails
” (UpstreamBadMaxFails
), invalid “fail_timeout
” (UpstreamBadFailTimeout
), invalid “slow_start
” (UpstreamBadSlowStart
), route is too long (UpstreamBadRoute
), “service
” is empty (UpstreamBadService
), no resolver defined to resolve (UpstreamConfNoResolver
), upstream “name
” has no backup (UpstreamNoBackup
), upstream “name
” memory exhausted (UpstreamOutOfMemory
), returns Error
UpstreamNotFound
), returns Error
MethodDisabled
), returns Error
JsonError
), returns Error
/http/upstreams/{httpUpstreamName}/servers/{httpUpstreamServerId}
httpUpstreamName
(string
, required)httpUpstreamServerId
(string
, required)Supported methods:
GET
- Return configuration of a server in an HTTP upstream server group Returns configuration of a particular server in the HTTP upstream server group.
Possible responses:
UpstreamStatic
), invalid server ID (UpstreamBadServerId
), returns Error
UpstreamNotFound
), server with ID “id
” does not exist (UpstreamServerNotFound
), returns Error
PATCH
- Modify a server in an HTTP upstream server group Modifies settings of a particular server in an HTTP upstream server group. Server parameters are specified in the JSON format.
Request parameters:
patchHttpUpstreamServer
(HTTP Upstream Server, required)ID
”, “backup
”, and “service
” parameters cannot be changed.Possible responses:
UpstreamStatic
), invalid “parameter
” value (UpstreamConfFormatError
), unknown parameter “name
” (UpstreamConfFormatError
), nested object or list (UpstreamConfFormatError
), “error
” while parsing (UpstreamBadAddress
), invalid “server
” argument (UpstreamBadAddress
), invalid server ID (UpstreamBadServerId
), invalid “weight
” (UpstreamBadWeight
), invalid “max_conns
” (UpstreamBadMaxConns
), invalid “max_fails
” (UpstreamBadMaxFails
), invalid “fail_timeout
” (UpstreamBadFailTimeout
), invalid “slow_start
” (UpstreamBadSlowStart
), route is too long (UpstreamBadRoute
), “service
” is empty (UpstreamBadService
), server “ID
” address is immutable (UpstreamServerImmutable
), server “ID
” weight is immutable (UpstreamServerWeightImmutable
), upstream “name
” memory exhausted (UpstreamOutOfMemory
), returns Error
UpstreamNotFound
), server with ID “id
” does not exist (UpstreamServerNotFound
), returns Error
MethodDisabled
), returns Error
JsonError
), returns Error
DELETE
- Remove a server from an HTTP upstream server group Removes a server from an HTTP upstream server group.
Possible responses:
UpstreamStatic
), invalid server ID (UpstreamBadServerId
), server “id
” not removable (UpstreamServerImmutable
), returns Error
UpstreamNotFound
), server with ID “id
” does not exist (UpstreamServerNotFound
), returns Error
MethodDisabled
), returns Error
/http/keyvals/
Supported methods:
GET
- Return key-value pairs from all HTTP keyval zones Returns key-value pairs for each HTTP keyval shared memory zone.
Request parameters:
fields
(string
, optional)fields
” value is empty, then only HTTP keyval zone names are output.Possible responses:
/http/keyvals/{httpKeyvalZoneName}
httpKeyvalZoneName
(string
, required)Supported methods:
GET
- Return key-value pairs from an HTTP keyval zone Returns key-value pairs stored in a particular HTTP keyval shared memory zone.
Request parameters:
key
(string
, optional)Possible responses:
KeyvalNotFound
), keyval key not found (KeyvalKeyNotFound
), returns Error
POST
- Add a key-value pair to the HTTP keyval zone Adds a new key-value pair to the HTTP keyval shared memory zone. Several key-value pairs can be entered if the HTTP keyval shared memory zone is empty.
Request parameters:
Key-value
(HTTP Keyval Shared Memory Zone, required)Possible responses:
KeyvalFormatError
), only one key can be added (KeyvalFormatError
), nested object or list (KeyvalFormatError
), returns Error
KeyvalNotFound
), returns Error
MethodDisabled
), returns Error
KeyvalKeyExists
), returns Error
JsonError
), returns Error
PATCH
- Modify a key-value or delete a key Changes the value of the selected key in the key-value pair or deletes a key by setting the key value to null
.
Request parameters:
httpKeyvalZoneKeyValue
(HTTP Keyval Shared Memory Zone, required)Possible responses:
KeyvalFormatError
), only one key can be updated (KeyvalFormatError
), nested object or list (KeyvalFormatError
), returns Error
KeyvalNotFound
), keyval key not found (KeyvalKeyNotFound
), returns Error
MethodDisabled
), returns Error
JsonError
), returns Error
DELETE
- Empty the HTTP keyval zone Deletes all key-value pairs from the HTTP keyval shared memory zone.
Possible responses:
/stream/
Supported methods:
GET
- Return list of stream-related endpoints Returns a list of first level stream endpoints.
Possible responses:
/stream/server_zones/
Supported methods:
GET
- Return status of all stream server zones Returns status information for each stream server zone.
Request parameters:
fields
(string
, optional)fields
” value is empty, then only server zone names are output.Possible responses:
StreamNotConfigured
), returns Error
/stream/server_zones/{streamServerZoneName}
streamServerZoneName
(string
, required)Supported methods:
GET
- Return status of a stream server zone Returns status of a particular stream server zone.
Request parameters:
fields
(string
, optional)Possible responses:
ServerZoneNotFound
), stream not configured (StreamNotConfigured
), returns Error
DELETE
- Reset statistics for a stream server zone Resets statistics of accepted and discarded connections, sessions, received and sent bytes in a particular stream server zone.
Possible responses:
/stream/upstreams/
Supported methods:
GET
- Return status of all stream upstream server groups Returns status of each stream upstream server group and its servers.
Request parameters:
fields
(string
, optional)fields
” value is empty, only names of upstreams are output.Possible responses:
StreamNotConfigured
), returns Error
/stream/upstreams/{streamUpstreamName}/
streamUpstreamName
(string
, required)Supported methods:
GET
- Return status of a stream upstream server group Returns status of a particular stream upstream server group and its servers.
Request parameters:
fields
(string
, optional)Possible responses:
UpstreamStatic
), returns Error
UpstreamNotFound
), stream not configured (StreamNotConfigured
), returns Error
DELETE
- Reset statistics of a stream upstream server group Resets the statistics for each upstream server in an upstream server group.
Possible responses:
/stream/upstreams/{streamUpstreamName}/servers/
streamUpstreamName
(string
, required)Supported methods:
GET
- Return configuration of all servers in a stream upstream server group Returns configuration of each server in a particular stream upstream server group.
Possible responses:
UpstreamStatic
), returns Error
UpstreamNotFound
), stream not configured (StreamNotConfigured
), returns Error
POST
- Add a server to a stream upstream server group Adds a new server to a stream upstream server group. Server parameters are specified in the JSON format.
Request parameters:
postStreamUpstreamServer
(Stream Upstream Server, required)ID
”, “backup
”, and “service
” parameters cannot be changed.Possible responses:
UpstreamStatic
), invalid “parameter
” value (UpstreamConfFormatError
), missing “server
” argument (UpstreamConfFormatError
), unknown parameter “name
” (UpstreamConfFormatError
), nested object or list (UpstreamConfFormatError
), “error
” while parsing (UpstreamBadAddress
), no port in server “host
” (UpstreamBadAddress
), service upstream “host
” may not have port (UpstreamBadAddress
), service upstream “host
” requires domain name (UpstreamBadAddress
), invalid “weight
” (UpstreamBadWeight
), invalid “max_conns
” (UpstreamBadMaxConns
), invalid “max_fails
” (UpstreamBadMaxFails
), invalid “fail_timeout
” (UpstreamBadFailTimeout
), invalid “slow_start
” (UpstreamBadSlowStart
), “service
” is empty (UpstreamBadService
), no resolver defined to resolve (UpstreamConfNoResolver
), upstream “name
” has no backup (UpstreamNoBackup
), upstream “name
” memory exhausted (UpstreamOutOfMemory
), returns Error
UpstreamNotFound
), stream not configured (StreamNotConfigured
), returns Error
MethodDisabled
), returns Error
JsonError
), returns Error
/stream/upstreams/{streamUpstreamName}/servers/{streamUpstreamServerId}
streamUpstreamName
(string
, required)streamUpstreamServerId
(string
, required)Supported methods:
GET
- Return configuration of a server in a stream upstream server group Returns configuration of a particular server in the stream upstream server group.
Possible responses:
UpstreamStatic
), invalid server ID (UpstreamBadServerId
), returns Error
UpstreamNotFound
), server with ID “id
” does not exist (UpstreamServerNotFound
), stream not configured (StreamNotConfigured
), returns Error
PATCH
- Modify a server in a stream upstream server group Modifies settings of a particular server in a stream upstream server group. Server parameters are specified in the JSON format.
Request parameters:
patchStreamUpstreamServer
(Stream Upstream Server, required)ID
”, “backup
”, and “service
” parameters cannot be changed.Possible responses:
UpstreamStatic
), invalid “parameter
” value (UpstreamConfFormatError
), unknown parameter “name
” (UpstreamConfFormatError
), nested object or list (UpstreamConfFormatError
), “error
” while parsing (UpstreamBadAddress
), invalid “server
” argument (UpstreamBadAddress
), no port in server “host
” (UpstreamBadAddress
), invalid server ID (UpstreamBadServerId
), invalid “weight
” (UpstreamBadWeight
), invalid “max_conns
” (UpstreamBadMaxConns
), invalid “max_fails
” (UpstreamBadMaxFails
), invalid “fail_timeout
” (UpstreamBadFailTimeout
), invalid “slow_start
” (UpstreamBadSlowStart
), “service
” is empty (UpstreamBadService
), server “ID
” address is immutable (UpstreamServerImmutable
), server “ID
” weight is immutable (UpstreamServerWeightImmutable
), upstream “name
” memory exhausted (UpstreamOutOfMemory
), returns Error
UpstreamNotFound
), server with ID “id
” does not exist (UpstreamServerNotFound
), stream not configured (StreamNotConfigured
), returns Error
MethodDisabled
), returns Error
JsonError
), returns Error
DELETE
- Remove a server from a stream upstream server group Removes a server from a stream server group.
Possible responses:
UpstreamStatic
), invalid server ID (UpstreamBadServerId
), server “id
” not removable (UpstreamServerImmutable
), returns Error
UpstreamNotFound
), server with ID “id
” does not exist (UpstreamServerNotFound
), stream not configured (StreamNotConfigured
), returns Error
MethodDisabled
), returns Error
/stream/keyvals/
Supported methods:
GET
- Return key-value pairs from all stream keyval zones Returns key-value pairs for each stream keyval shared memory zone.
Request parameters:
fields
(string
, optional)fields
” value is empty, then only stream keyval zone names are output.Possible responses:
StreamNotConfigured
), returns Error
/stream/keyvals/{streamKeyvalZoneName}
streamKeyvalZoneName
(string
, required)Supported methods:
GET
- Return key-value pairs from a stream keyval zone Returns key-value pairs stored in a particular stream keyval shared memory zone.
Request parameters:
key
(string
, optional)Possible responses:
KeyvalNotFound
), keyval key not found (KeyvalKeyNotFound
), stream not configured (StreamNotConfigured
), returns Error
POST
- Add a key-value pair to the stream keyval zone Adds a new key-value pair to the stream keyval shared memory zone. Several key-value pairs can be entered if the stream keyval shared memory zone is empty.
Request parameters:
Key-value
(Stream Keyval Shared Memory Zone, required)Possible responses:
KeyvalFormatError
), only one key can be added (KeyvalFormatError
), nested object or list (KeyvalFormatError
), returns Error
KeyvalNotFound
), stream not configured (StreamNotConfigured
), returns Error
MethodDisabled
), returns Error
KeyvalKeyExists
), returns Error
JsonError
), returns Error
PATCH
- Modify a key-value or delete a key Changes the value of the selected key in the key-value pair or deletes a key by setting the key value to null
.
Request parameters:
streamKeyvalZoneKeyValue
(Stream Keyval Shared Memory Zone, required)Possible responses:
KeyvalFormatError
), only one key can be updated (KeyvalFormatError
), nested object or list (KeyvalFormatError
), returns Error
KeyvalNotFound
), keyval key not found (KeyvalKeyNotFound
), stream not configured (StreamNotConfigured
), returns Error
MethodDisabled
), returns Error
JsonError
), returns Error
DELETE
- Empty the stream keyval zone Deletes all key-value pairs from the stream keyval shared memory zone.
Possible responses:
/stream/zone_sync/
Supported methods:
GET
- Return sync status of a node Returns synchronization status of a cluster node.
Possible responses:
ZoneSyncNotConfigured
), stream not configured (StreamNotConfigured
), returns Error
nginx:
General information about nginx:version
(string
) build
(string
) address
(string
) generation
(integer
) load_timestamp
(string
) timestamp
(string
) pid
(integer
) ppid
(integer
) Example:
{ "nginx" : { "version" : "1.15.2", "build" : "nginx-plus-r16", "address" : "206.251.255.64", "generation" : 6, "load_timestamp" : "2018-10-08T09:05:48.776Z", "timestamp" : "2018-10-08T15:23:17.056Z", "pid" : 32212, "ppid" : 32210 } }
Processes:
respawned
(integer
) Example:
{ "respawned" : 0 }
Connections:
The number of accepted, dropped, active, and idle connections.accepted
(integer
) dropped
(integer
) active
(integer
) idle
(integer
) Example:
{ "accepted" : 4968119, "dropped" : 0, "active" : 5, "idle" : 117 }
SSL:
handshakes
(integer
) handshakes_failed
(integer
) session_reuses
(integer
) Example:
{ "handshakes" : 79572, "handshakes_failed" : 21025, "session_reuses" : 15762 }
Shared memory zone with slab allocator:
pages
used
(integer
) free
(integer
) slots
Status data for memory slots (8, 16, 32, 64, 128, etc.)
A collection of "Memory Slot" objects
Example:
{ "pages" : { "used" : 1143, "free" : 2928 }, "slots" : { "8" : { "used" : 0, "free" : 0, "reqs" : 0, "fails" : 0 }, "16" : { "used" : 0, "free" : 0, "reqs" : 0, "fails" : 0 }, "32" : { "used" : 0, "free" : 0, "reqs" : 0, "fails" : 0 }, "64" : { "used" : 1, "free" : 63, "reqs" : 1, "fails" : 0 }, "128" : { "used" : 0, "free" : 0, "reqs" : 0, "fails" : 0 }, "256" : { "used" : 18078, "free" : 178, "reqs" : 1635736, "fails" : 0 } } }
Memory Slot:
used
(integer
) free
(integer
) reqs
(integer
) fails
(integer
) HTTP Requests:
total
(integer
) current
(integer
) Example:
{ "total" : 10624511, "current" : 4 }
HTTP Server Zone:
processing
(integer
) requests
(integer
) responses
1xx
”, “2xx
”, “3xx
”, “4xx
”, and “5xx
”.1xx
(integer
) 1xx
” status codes. 2xx
(integer
) 2xx
” status codes. 3xx
(integer
) 3xx
” status codes. 4xx
(integer
) 4xx
” status codes. 5xx
(integer
) 5xx
” status codes. total
(integer
) discarded
(integer
) received
(integer
) sent
(integer
) Example:
{ "processing" : 1, "requests" : 706690, "responses" : { "1xx" : 0, "2xx" : 699482, "3xx" : 4522, "4xx" : 907, "5xx" : 266, "total" : 705177 }, "discarded" : 1513, "received" : 172711587, "sent" : 19415530115 }
HTTP Cache:
size
(integer
) max_size
(integer
) cold
(boolean
) hit
responses
(integer
) bytes
(integer
) stale
responses
(integer
) *_cache_use_stale
” directives). bytes
(integer
) updating
responses
(integer
) *_cache_use_stale
” directives). bytes
(integer
) revalidated
responses
(integer
) *_cache_revalidate
” directives. bytes
(integer
) miss
responses
(integer
) bytes
(integer
) responses_written
(integer
) bytes_written
(integer
) expired
responses
(integer
) bytes
(integer
) responses_written
(integer
) bytes_written
(integer
) bypass
responses
(integer
) *_cache_bypass
” directives. bytes
(integer
) responses_written
(integer
) bytes_written
(integer
) Example:
{ "size" : 530915328, "max_size" : 536870912, "cold" : false, "hit" : { "responses" : 254032, "bytes" : 6685627875 }, "stale" : { "responses" : 0, "bytes" : 0 }, "updating" : { "responses" : 0, "bytes" : 0 }, "revalidated" : { "responses" : 0, "bytes" : 0 }, "miss" : { "responses" : 1619201, "bytes" : 53841943822 }, "expired" : { "responses" : 45859, "bytes" : 1656847080, "responses_written" : 44992, "bytes_written" : 1641825173 }, "bypass" : { "responses" : 200187, "bytes" : 5510647548, "responses_written" : 200173, "bytes_written" : 44992 } }
HTTP Upstream:
peers
id
(integer
) server
(string
) service
(string
) name
(string
) backup
(boolean
) weight
(integer
) state
(string
) up
”, “draining
”, “down
”, “unavail
”, “checking
”, and “unhealthy
”. active
(integer
) max_conns
(integer
) requests
(integer
) responses
1xx
(integer
) 1xx
” status codes. 2xx
(integer
) 2xx
” status codes. 3xx
(integer
) 3xx
” status codes. 4xx
(integer
) 4xx
” status codes. 5xx
(integer
) 5xx
” status codes. total
(integer
) sent
(integer
) received
(integer
) fails
(integer
) unavail
(integer
) unavail
”) due to the number of unsuccessful attempts reaching the max_fails threshold. health_checks
checks
(integer
) fails
(integer
) unhealthy
(integer
) unhealthy
”). last_passed
(boolean
) downtime
(integer
) unavail
”, “checking
”, and “unhealthy
” states. downstart
(string
) unavail
”, “checking
”, or “unhealthy
”, in the ISO 8601 format with millisecond resolution. selected
(string
) header_time
(integer
) response_time
(integer
) keepalive
(integer
) zombies
(integer
) zone
(string
) queue
size
(integer
) max_size
(integer
) overflows
(integer
) Example:
{ "upstream_backend" : { "peers" : [ { "id" : 0, "server" : "10.0.0.1:8088", "name" : "10.0.0.1:8088", "backup" : false, "weight" : 5, "state" : "up", "active" : 0, "max_conns" : 20, "requests" : 667231, "header_time" : 20, "response_time" : 36, "responses" : { "1xx" : 0, "2xx" : 666310, "3xx" : 0, "4xx" : 915, "5xx" : 6, "total" : 667231 }, "sent" : 251946292, "received" : 19222475454, "fails" : 0, "unavail" : 0, "health_checks" : { "checks" : 26214, "fails" : 0, "unhealthy" : 0, "last_passed" : true }, "downtime" : 0, "downstart" : "2017-07-07T11:09:21.602Z", "selected" : "2017-07-17T15:01:25.000Z" }, { "id" : 1, "server" : "10.0.0.1:8089", "name" : "10.0.0.1:8089", "backup" : true, "weight" : 1, "state" : "unhealthy", "active" : 0, "max_conns" : 20, "requests" : 0, "responses" : { "1xx" : 0, "2xx" : 0, "3xx" : 0, "4xx" : 0, "5xx" : 0, "total" : 0 }, "sent" : 0, "received" : 0, "fails" : 0, "unavail" : 0, "health_checks" : { "checks" : 26284, "fails" : 26284, "unhealthy" : 1, "last_passed" : false }, "downtime" : 262925617, "downstart" : "2017-07-07T11:09:21.602Z", "selected" : "2017-07-17T15:01:25.000Z" } ], "keepalive" : 0, "zombies" : 0, "zone" : "upstream_backend" } }
HTTP Upstream Server:
Dynamically configurable parameters of an HTTP upstream server:id
(integer
) server
(string
) http
” block. See also the resolve parameter of the HTTP upstream server. service
(string
) weight
(integer
) max_conns
(integer
) max_fails
(integer
) fail_timeout
(string
) slow_start
(string
) route
(string
) backup
(boolean
) true
, adds a backup server. This parameter cannot be changed. down
(boolean
) drain
(boolean
) parent
(string
) host
(string
) Example:
{ "id" : 1, "server" : "10.0.0.1:8089", "weight" : 4, "max_conns" : 0, "max_fails" : 0, "fail_timeout" : "10s", "slow_start" : "10s", "route" : "", "backup" : true, "down" : true }
HTTP Keyval Shared Memory Zone:
Contents of an HTTP keyval shared memory zone.Example:
{ "key1" : "value1", "key2" : "value2", "key3" : "value3" }
Stream Server Zone:
processing
(integer
) connections
(integer
) sessions
2xx
”, “4xx
”, or “5xx
”.2xx
(integer
) 2xx
”. 4xx
(integer
) 4xx
”. 5xx
(integer
) 5xx
”. total
(integer
) discarded
(integer
) received
(integer
) sent
(integer
) Example:
{ "dns" : { "processing" : 1, "connections" : 155569, "sessions" : { "2xx" : 155564, "4xx" : 0, "5xx" : 0, "total" : 155569 }, "discarded" : 0, "received" : 4200363, "sent" : 20489184 } }
Stream Upstream:
peers
id
(integer
) server
(string
) service
(string
) name
(string
) backup
(boolean
) weight
(integer
) state
(string
) up
”, “down
”, “unavail
”, “checking
”, or “unhealthy
”. active
(integer
) max_conns
(integer
) connections
(integer
) connect_time
(integer
) first_byte_time
(integer
) response_time
(integer
) sent
(integer
) received
(integer
) fails
(integer
) unavail
(integer
) unavail
”) due to the number of unsuccessful attempts reaching the max_fails threshold. health_checks
checks
(integer
) fails
(integer
) unhealthy
(integer
) unhealthy
”). last_passed
(boolean
) downtime
(integer
) unavail
”, “checking
”, and “unhealthy
” states. downstart
(string
) unavail
”, “checking
”, or “unhealthy
”, in the ISO 8601 format with millisecond resolution. selected
(string
) zombies
(integer
) zone
(string
) Example:
{ "dns" : { "peers" : [ { "id" : 0, "server" : "10.0.0.1:12347", "name" : "10.0.0.1:12347", "backup" : false, "weight" : 5, "state" : "up", "active" : 0, "max_conns" : 50, "connections" : 667231, "sent" : 251946292, "received" : 19222475454, "fails" : 0, "unavail" : 0, "health_checks" : { "checks" : 26214, "fails" : 0, "unhealthy" : 0, "last_passed" : true }, "downtime" : 0, "downstart" : "2017-07-07T11:09:21.602Z", "selected" : "2017-07-17T15:01:25.000Z" }, { "id" : 1, "server" : "10.0.0.1:12348", "name" : "10.0.0.1:12348", "backup" : true, "weight" : 1, "state" : "unhealthy", "active" : 0, "max_conns" : 50, "connections" : 0, "sent" : 0, "received" : 0, "fails" : 0, "unavail" : 0, "health_checks" : { "checks" : 26284, "fails" : 26284, "unhealthy" : 1, "last_passed" : false }, "downtime" : 262925617, "downstart" : "2017-07-07T11:09:21.602Z", "selected" : "2017-07-17T15:01:25.000Z" } ], "zombies" : 0, "zone" : "dns" } }
Stream Upstream Server:
Dynamically configurable parameters of a stream upstream server:id
(integer
) server
(string
) stream
” block. See also the resolve parameter of the stream upstream server. service
(string
) weight
(integer
) max_conns
(integer
) max_fails
(integer
) fail_timeout
(string
) slow_start
(string
) backup
(boolean
) true
, adds a backup server. This parameter cannot be changed. down
(boolean
) parent
(string
) host
(string
) Example:
{ "id" : 0, "server" : "10.0.0.1:12348", "weight" : 1, "max_conns" : 0, "max_fails" : 1, "fail_timeout" : "10s", "slow_start" : 0, "backup" : false, "down" : false }
Stream Keyval Shared Memory Zone:
Contents of a stream keyval shared memory zone.Example:
{ "key1" : "value1", "key2" : "value2", "key3" : "value3" }
Stream Zone Sync Node:
zones
Synchronization information per each shared memory zone.
A collection of "Sync Zone" objects
status
bytes_in
(integer
) msgs_in
(integer
) msgs_out
(integer
) bytes_out
(integer
) nodes_online
(integer
) Example:
{ "zones" : { "zone1" : { "records_pending" : 2061, "records_total" : 260575 }, "zone2" : { "records_pending" : 0, "records_total" : 14749 } }, "status" : { "bytes_in" : 1364923761, "msgs_in" : 337236, "msgs_out" : 346717, "bytes_out" : 1402765472, "nodes_online" : 15 } }
Sync Zone:
Synchronization status of a shared memory zone.records_pending
(integer
) records_total
(integer
) Error:
nginx error object.path
(string
) method
(string
) error
status
(integer
) text
(string
) code
(string
) request_id
(string
) href
(string
)
© 2002-2018 Igor Sysoev
© 2011-2018 Nginx, Inc.
Licensed under the BSD License.
https://nginx.org/en/docs/http/ngx_http_api_module.html