Nginx Metrics Source

The Vector nginx_metrics source collects metrics from Nginx.

Requirements

Configuration

[sources.my_source_id]
type = "nginx_metrics" # required
endpoints = ["http://localhost:8000/basic_status"] # required
scrape_interval_secs = 15 # optional, default, seconds
  • optionaltable

    auth

    Configures the authentication strategy.

    • commonrequiredstring

      password

      The basic authentication password.

      • Syntax: literal
    • enumcommonrequiredstring

      strategy

      The authentication strategy to use.

      • Syntax: literal
      • Enum, must be one of: "basic" "bearer"
    • commonrequiredstring

      token

      The token to use for bearer authentication

      • Syntax: literal
    • commonrequiredstring

      user

      The basic authentication user name.

      • Syntax: literal
  • commonrequired[string]

    endpoints

    HTTP/HTTPS endpoint to Nginx server with enabled ngx_http_stub_status_module module.

  • optionalstring

    namespace

    The namespace of metrics. Disabled if empty.

    • Syntax: literal
    • Default: "nginx"
  • commonoptionaluint

    scrape_interval_secs

    The interval between scrapes.

    • Default: 15 (seconds)
  • 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
    • 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
    • commonoptionalbool

      enabled

      Enable TLS during connections to the remote.

      • Default: false
    • 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
    • optionalstring

      key_pass

      Pass phrase used to unlock the encrypted key file. This has no effect unless key_file is set.

      • Syntax: literal
    • optionalbool

      verify_certificate

      If true (the default), Vector will validate the TLS certificate of the remote host.

      • Default: true
    • 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 to false unless you understand the risks of not verifying the remote hostname.

      • Default: true

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, the worker_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.

Module ngx_http_stub_status_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.