Nginx Metrics Source
The Vector nginx_metrics
source
collects metrics from Nginx.
Requirements
Configuration
- Common
- Advanced
- vector.toml
- vector.yaml
- vector.json
[sources.my_source_id]type = "nginx_metrics" # requiredendpoints = ["http://localhost:8000/basic_status"] # requiredscrape_interval_secs = 15 # optional, default, seconds
- optionaltable
auth
Configures the authentication strategy.
- commonrequiredstring
password
The basic authentication password.
- Syntax:
literal
- View examples
- Syntax:
- enumcommonrequiredstring
strategy
The authentication strategy to use.
- Syntax:
literal
- Enum, must be one of:
"basic"
"bearer"
- View examples
- Syntax:
- commonrequiredstring
token
The token to use for bearer authentication
- Syntax:
literal
- View examples
- Syntax:
- commonrequiredstring
user
The basic authentication user name.
- Syntax:
literal
- View examples
- Syntax:
- commonrequired[string]
endpoints
HTTP/HTTPS endpoint to Nginx server with enabled
ngx_http_stub_status_module
module.- View examples
- optionalstring
namespace
The namespace of metrics. Disabled if empty.
- Syntax:
literal
- Default:
"nginx"
- Syntax:
- commonoptionaluint
scrape_interval_secs
The interval between scrapes.
- Default:
15
(seconds)
- Default:
- optionaltable
tls
Configures the TLS options for incoming connections.
- optionalstring
ca_file
Absolute path to an additional CA certificate file, in DER or PEM format (X.509), or an inline CA certificate in PEM format.
- Syntax:
literal
- View examples
- Syntax:
- commonoptionalstring
crt_file
Absolute path to a certificate file used to identify this connection, in DER or PEM format (X.509) or PKCS#12, or an inline certificate in PEM format. If this is set and is not a PKCS#12 archive,
key_file
must also be set.- Syntax:
literal
- View examples
- Syntax:
- commonoptionalbool
enabled
Enable TLS during connections to the remote.
- Default:
false
- View examples
- Default:
- commonoptionalstring
key_file
Absolute path to a private key file used to identify this connection, in DER or PEM format (PKCS#8), or an inline private key in PEM format. If this is set,
crt_file
must also be set.- Syntax:
literal
- View examples
- Syntax:
- optionalstring
key_pass
Pass phrase used to unlock the encrypted key file. This has no effect unless
key_file
is set.- Syntax:
literal
- View examples
- Syntax:
- optionalbool
verify_certificate
If
true
(the default), Vector will validate the TLS certificate of the remote host.- Default:
true
- View examples
- Default:
- optionalbool
verify_hostname
If
true
(the default), Vector will validate the configured remote host name against the remote host's TLS certificate. Do NOT set this tofalse
unless you understand the risks of not verifying the remote hostname.- Default:
true
- View examples
- Default:
Output
This component outputs the following metric events:
- gauge
up
If the Nginx server is up or not. This metric includes the following tags:
endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
- gauge
connections_active
The current number of active client connections including
Waiting
connections. This metric includes the following tags:endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
- counter
connections_accepted_total
The total number of accepted client connections. This metric includes the following tags:
endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
- counter
connections_handled_total
The total number of handled connections. Generally, the parameter value is the same as
accepts
unless some resource limits have been reached (for example, theworker_connections
limit). This metric includes the following tags:endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
- counter
http_requests_total
The total number of client requests. This metric includes the following tags:
endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
- gauge
connections_reading
The current number of connections where nginx is reading the request header. This metric includes the following tags:
endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
- gauge
connections_writing
The current number of connections where nginx is writing the response back to the client. This metric includes the following tags:
endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
- gauge
connections_waiting
The current number of idle client connections waiting for a request. This metric includes the following tags:
endpoint
- Nginx endpoint.host
- The hostname of the Nginx server.
Telemetry
This component provides the following metrics that can be retrieved through
the internal_metrics
source. See the
metrics section in the
monitoring page for more info.
- counter
collect_completed_total
The total number of metrics collections completed for this component. This metric includes the following tags:
instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- histogram
collect_duration_nanoseconds
The duration spent collecting of metrics for this component. This metric includes the following tags:
instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
http_request_errors_total
The total number of HTTP request errors for this component. This metric includes the following tags:
instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
events_out_total
The total number of events emitted by this component. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
parse_errors_total
The total number of errors parsing metrics for this component. This metric includes the following tags:
instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
How It Works
Context
By default, the nginx_metrics
source will augment events with helpful
context keys as shown in the "Output" section.
ngx_http_stub_status_module
Module The ngx_http_stub_status_module module provides access to basic status information. Basic status information is a simple web page with text data.
State
This component is stateless, meaning its behavior is consistent across each input.