Skip to content

Commit 3363efe

Browse files
authored
Update existing prometheus documentation to include configuration options for ServiceMonitor (#4414)
1 parent abe4950 commit 3363efe

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

docs/content/logging-and-monitoring/prometheus.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title: Prometheus
33

44
description: "The Ingress Controller exposes a number of metrics in the Prometheus format."
55
weight: 2000
6-
doctypes: [""]
6+
doctypes: ["concept"]
77
aliases:
8-
- /prometheus/
8+
- /prometheus/
99
toc: true
1010
docs: "DOCS-614"
1111
---
@@ -15,6 +15,8 @@ The Ingress Controller exposes a number of metrics in the [Prometheus](https://p
1515

1616
## Enabling Metrics
1717

18+
### Using Manifest
19+
1820
If you're using *Kubernetes manifests* (Deployment or DaemonSet) to install the Ingress Controller, to enable Prometheus metrics:
1921

2022
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).
@@ -35,8 +37,24 @@ If you're using *Kubernetes manifests* (Deployment or DaemonSet) to install the
3537
prometheus.io/scheme: http
3638
```
3739
40+
### Using Helm
41+
3842
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.
3943

44+
### Using ServiceMonitor
45+
46+
When deploying with *Helm*, you can deploy a `Service` and `ServiceMonitor` resource using the `prometheus.service.*` and `prometheus.serviceMonitor.*` parameters.
47+
When these resources are deployed, Prometheus metrics exposed by the NGINX Ingress Controller can be captured and enumerated using a `Prometheus` resource alongside a Prometheus Operator deployment.
48+
49+
To view metrics captured this way, the following is required:
50+
* The latest ServiceMonitor CRD from the [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) repository:
51+
```shell
52+
LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)
53+
curl https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$LATEST/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml | kubectl create -f -
54+
```
55+
* A working [Prometheus resource and Prometheus Operator](https://prometheus-operator.dev/docs/user-guides/getting-started/)
56+
57+
4058
## Available Metrics
4159

4260
The Ingress Controller exports the following metrics:

0 commit comments

Comments
 (0)