Introduction

Nginx is a high-performance, open-source web server and reverse proxy that is widely used for load balancing, HTTP caching, and media streaming. Monitoring Nginx is crucial for tracking key performance metrics such as request rates, response times, error rates, active connections, and upstream health.

To monitor Nginx efficiently, we can use the OpenTelemetry Nginx Receiver, which collects key Nginx performance metrics and makes them available for analysis.

Kubernetes 2.0 ConfigMap

Users should update or append the existing ConfigMap named opsramp-workload-metric-user-config by adding application-specific fields. These fields may include authentication credentials, collection frequency, and other relevant configurations. To run OpenTelemetry Redis Receiver with Kubernetes, we need to create a ConfigMap and deploy it.

apiVersion: v1
kind: ConfigMap
metadata:
  name: opsramp-workload-metric-user-config
  namespace: opsramp-agent
data:
  workloads: |
    nginx:
    - name: nginx1
      maxConnsPerHost: 4
      idleConnTimeout: 5s
      disableKeepAlives: true
      http2ReadIdleTimeout: 1m
      collectionFrequency: 20m
      http2PingTimeout: 5s
      httpPath: nginx_status
      auth: none
      port: 80
      targetPodSelector: 
        matchLabels: 
          - key: app 
            operator: ==
            value: 
              - nginx
    - name: nginx-with-tls
      maxConnsPerHost: 4
      idleConnTimeout: 5s
      disableKeepAlives: true
      http2ReadIdleTimeout: 1m
      http2PingTimeout: 5s
      collectionFrequency: 10s
      httpPath: tls_stub_status
      auth: tls
      certFile:
        source: secret
        value: default/nginx-secret/tls.crt
      keyFile:
        source: secret
        value: default/nginx-secret/tls.key
      port: 443
      targetPodSelector: 
        matchLabels: 
          - key: app 
            operator: ==
            value: 
              - my-nginx-tls

Supported Metrics

Supported metrics for this workload as provided by the Kubernetes 2.0 Agent.

MetricDescription
nginx_connections_acceptedTotal number of accepted connections in Nginx
nginx_connections_currentCurrent number of open connections in Nginx
nginx_connections_handledTotal number of handled connections in Nginx
nginx_requestsTotal number of requests processed by Nginx