NGINX

Metrics, Dashboards, Alerts and more for NGINX Integration in Sysdig Monitor.
NGINX

This integration is enabled by default.

Versions supported: > v12

This integration uses a sidecar exporter that is available in UBI or scratch base image.

This integration has 12 metrics.

Timeseries generated: 8 series per nginx container

List of Alerts

AlertDescriptionFormat
[Nginx] No Intances UpNo Nginx instances UpPrometheus

List of Dashboards

Nginx

The dashboard provides information on the status of the NGINX server and Golden Signals. Nginx

List of Metrics

Metric name
net.bytes.in
net.bytes.out
net.http.error.count
net.http.request.count
net.http.request.time
nginx_connections_accepted
nginx_connections_active
nginx_connections_handled
nginx_connections_reading
nginx_connections_waiting
nginx_connections_writing
nginx_up

Preparing the Integration

Enable Nginx stub_status Module

The exporter can be installed as a sidecar of the pod with the Nginx server. To make Nginx expose an endpoint for scraping metrics, enable the stub_status module. If your Nginx configuration is defined inside a Kubernetes ConfigMap, add the following snippet to enable the stub_status module:

server {
  listen       80;
  server_name  localhost;
  location /nginx_status {
    stub_status on;
    access_log  on;
    allow all;  # REPLACE with your access policy
  }
}

This is how the ConfigMap would look after adding this snippet:

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
data:
  nginx.conf: |
    server {
      listen       80;
      server_name  localhost;
      location /nginx_status {
        stub_status on;
        access_log  on;
        allow all;  # REPLACE with your access policy
      }
    }    

Installing

An automated wizard is present in the Monitoring Integrations in Sysdig Monitor. However, you can also use this Helm chart for expert users: https://github.com/sysdiglabs/integrations-charts/tree/main/charts/nginx-exporter

Monitoring and Troubleshooting NGINX

This document describes important metrics and queries that you can use to monitor and troubleshoot NGINX.

Tracking metrics status

You can track NGINX metrics status with following alerts: Exporter proccess is not serving metrics

# [NGINX] Exporter Process Down
absent(nginx_up{kube_cluster_name=~$cluster,kube_namespace_name=~$namespace,kube_workload_name=~$workload}) > 0

Agent Configuration

This is the default agent job for this integration:

- job_name: nginx-default
  tls_config:
    insecure_skip_verify: true
  kubernetes_sd_configs:
  - role: pod
  relabel_configs:
  - action: keep
    source_labels: [__meta_kubernetes_pod_host_ip]
    regex: __HOSTIPS__
  - action: keep
    source_labels:
    - __meta_kubernetes_pod_annotation_promcat_sysdig_com_integration_type
    regex: "nginx"
  - action: replace
    source_labels: [__address__, __meta_kubernetes_pod_annotation_promcat_sysdig_com_port]
    regex: ([^:]+)(?::\d+)?;(\d+)
    replacement: $1:$2
    target_label: __address__
  - action: replace
    source_labels: [__meta_kubernetes_pod_uid]
    target_label: sysdig_k8s_pod_uid
  - action: replace
    source_labels: [__meta_kubernetes_pod_container_name]
    target_label: sysdig_k8s_pod_container_name