github.com/nginxinc/kubernetes-ingress@v1.12.5/docs-web/logging-and-monitoring/prometheus.md (about) 1 # Prometheus 2 3 The Ingress Controller exposes a number of metrics in the [Prometheus](https://prometheus.io/) format. Those include NGINX/NGINX Plus and the Ingress Controller metrics. 4 5 ## Enabling Metrics 6 7 If you're using *Kubernetes manifests* (Deployment or DaemonSet) to install the Ingress Controller, to enable Prometheus metrics: 8 1. Run the Ingress controller with the `-enable-prometheus-metrics` [command-line argument](/nginx-ingress-controller/configuration/global-configuration/command-line-arguments). As a result, the Ingress Controller will expose NGINX or NGINX Plus metrics in the Prometheus format via the path `/metrics` on port `9113` (customizable via the `-prometheus-metrics-listen-port` command-line argument). 9 1. To enable TLS for the Prometheus endpoint, configure the `-prometheus-tls-secret` cli argument with the namespace and name of a TLS Secret. 10 1. Add the Prometheus port to the list of the ports of the Ingress Controller container in the template of the Ingress Controller pod: 11 ```yaml 12 - name: prometheus 13 containerPort: 9113 14 ``` 15 1. Make Prometheus aware of the Ingress Controller targets by adding the following annotations to the template of the Ingress Controller pod (note: this assumes your Prometheus is configured to discover targets by analyzing the annotations of pods): 16 ```yaml 17 annotations: 18 prometheus.io/scrape: "true" 19 prometheus.io/port: "9113" 20 prometheus.io/scheme: http 21 ``` 22 23 If you're using *Helm* to install the Ingress Controller, to enable Prometheus metrics, configure the `prometheus.*` parameters of the Helm chart. See the [Installation with Helm](/nginx-ingress-controller/installation/installation-with-helm) doc. 24 25 ## Available Metrics 26 The Ingress Controller exports the following metrics: 27 28 * NGINX/NGINX Plus metrics: 29 * Exported by NGINX/NGINX Plus. Refer to the [NGINX Prometheus Exporter developer docs](https://github.com/nginxinc/nginx-prometheus-exporter#exported-metrics) to find more information about the exported metrics. 30 * There is a Grafana dashboard for NGINX Plus metrics located in the root repo folder. 31 * Calculated by the Ingress Controller: 32 * `controller_upstream_server_response_latency_ms_count`. Bucketed response times from when NGINX establishes a connection to an upstream server to when the last byte of the response body is received by NGINX. **Note**: The metric for the upstream isn't available until traffic is sent to the upstream. The metric isn't enabled by default. To enable the metric, set the `-enable-latency-metrics` command-line argument. 33 * Ingress Controller metrics 34 * `controller_nginx_reloads_total`. Number of successful NGINX reloads. This includes the label `reason` with 2 possible values `endpoints` (the reason for the reload was an endpoints update) and `other` (the reload was caused by something other than an endpoint update like an ingress update). 35 * `controller_nginx_reload_errors_total`. Number of unsuccessful NGINX reloads. 36 * `controller_nginx_last_reload_status`. Status of the last NGINX reload, 0 meaning down and 1 up. 37 * `controller_nginx_last_reload_milliseconds`. Duration in milliseconds of the last NGINX reload. 38 * `controller_nginx_worker_processes_total`. Number of NGINX worker processes. This metric includes the constant label `generation` with two possible values `old` (the shutting down processes of the old generations) or `current` (the processes of the current generation). 39 * `controller_ingress_resources_total`. Number of handled Ingress resources. This metric includes the label type, that groups the Ingress resources by their type (regular, [minion or master](/nginx-ingress-controller/configuration/ingress-resources/cross-namespace-configuration)). **Note**: The metric doesn't count minions without a master. 40 * `controller_virtualserver_resources_total`. Number of handled VirtualServer resources. 41 * `controller_virtualserverroute_resources_total`. Number of handled VirtualServerRoute resources. **Note**: The metric counts only VirtualServerRoutes that have a reference from a VirtualServer. 42 * Workqueue metrics. **Note**: the workqueue is a queue used by the Ingress Controller to process changes to the relevant resources in the cluster like Ingress resources. The Ingress Controller uses only one queue. The metrics for that queue will have the label `name="taskQueue"` 43 * `workqueue_depth`. Current depth of the workqueue. 44 * `workqueue_queue_duration_second`. How long in seconds an item stays in the workqueue before being requested. 45 * `workqueue_work_duration_seconds`. How long in seconds processing an item from the workqueue takes. 46 47 **Note**: all metrics have the namespace `nginx_ingress`. For example, `nginx_ingress_controller_nginx_reloads_total`. 48 49 **Note**: all metrics include the label `class`, which is set to the class of the Ingress Controller. The class is configured via the `-ingress-class` command-line argument.