Skip to content

Commit 85c01e4

Browse files
committed
Code review
1 parent 8a9aaaa commit 85c01e4

File tree

2 files changed

+277
-16
lines changed

2 files changed

+277
-16
lines changed

site/content/how-to/monitoring/prometheus.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Prometheus Metrics and Grafana"
3-
description: "Learn how to monitor your NGINX Gateway Fabric effectively. This guide provides easy steps for configuring and understanding key performance metrics using Prometheus and Grafana."
2+
title: "Prometheus Metrics"
3+
description: "This document describes how to monitor NGINX Gateway Fabric using Prometheus and Grafana. It explains installation and configuration, as well as what metrics are available."
44
weight: 100
55
toc: true
66
docs: "DOCS-1418"
@@ -11,14 +11,16 @@ docs: "DOCS-1418"
1111
## Overview
1212

1313

14-
NGINX Gateway Fabric metrics are displayed in [Prometheus](https://prometheus.io/) format, simplifying monitoring. These metrics are served via a metrics server orchestrated by the controller-runtime package on HTTP port `9113`. When installed, Prometheus automatically scrapes this port and collects metrics. [Grafana](https://grafana.com/) can be used for rich visualization of these metrics.
14+
NGINX Gateway Fabric metrics are displayed in [Prometheus](https://prometheus.io/) format. These metrics are served through a metrics server orchestrated by the controller-runtime package on HTTP port `9113`. When installed, Prometheus automatically scrapes this port and collects metrics. [Grafana](https://grafana.com/) can be used for rich visualization of these metrics.
1515

1616
{{<call-out "important" "Security note for metrics">}}
1717
Metrics are served over HTTP by default. Enabling HTTPS will secure the metrics endpoint with a self-signed certificate. When using HTTPS, adjust the Prometheus Pod scrape settings by adding the `insecure_skip_verify` flag to handle the self-signed certificate. For further details, refer to the [Prometheus documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#tls_config).
1818
{{</call-out>}}
1919

2020
## Installing Prometheus and Grafana
2121

22+
{{< note >}}These installations are for demonstration purposes and have not been tuned for a production environment.{{< /note >}}
23+
2224
### Prometheus
2325

2426
```shell
@@ -64,21 +66,21 @@ In the Grafana UI menu, go to `Connections` then `Data sources`. Add your Promet
6466

6567
Download the following sample dashboard and Import as a new Dashboard in the Grafana UI.
6668

67-
{{< download "static/grafana-dashboard.json" "ngf-grafana-dashboard.json" >}}
69+
6870

6971
## Available metrics in NGINX Gateway Fabric
7072

71-
NGINX Gateway Fabric provides a variety of metrics to assist in monitoring and analyzing performance. These metrics are categorized as follows:
73+
NGINX Gateway Fabric provides a variety of metrics for monitoring and analyzing performance. These metrics are categorized as follows:
7274

7375
### NGINX/NGINX Plus metrics
7476

75-
NGINX metrics, essential for monitoring specific NGINX operations, include details like the total number of accepted client connections. For a complete list of available NGINX/NGINX Plus metrics, refer to the [NGINX Prometheus Exporter developer docs](https://github.com/nginxinc/nginx-prometheus-exporter#exported-metrics).
77+
NGINX metrics cover specific NGINX operations such as the total number of accepted client connections. For a complete list of available NGINX/NGINX Plus metrics, refer to the [NGINX Prometheus Exporter developer docs](https://github.com/nginxinc/nginx-prometheus-exporter#exported-metrics).
7678

77-
These metrics use the `nginx_gateway_fabric` namespace and include the `class` label, indicating the NGINX Gateway class. For example, `nginx_gateway_fabric_connections_accepted{class="nginx"}`.
79+
These metrics use the `nginx_gateway_fabric` namespace and include the `class` label, indicating the NGINX Gateway class. For example, `nginx_gateway_fabric_connections_accepted{class="nginx"}`.
7880

7981
### NGINX Gateway Fabric metrics
8082

81-
Metrics specific to the NGINX Gateway Fabric include:
83+
Metrics specific to NGINX Gateway Fabric include:
8284

8385
- `nginx_reloads_total`: Counts successful NGINX reloads.
8486
- `nginx_reload_errors_total`: Counts NGINX reload failures.
@@ -90,15 +92,15 @@ All these metrics are under the `nginx_gateway_fabric` namespace and include a `
9092

9193
### Controller-runtime metrics
9294

93-
Provided by the [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) library, these metrics cover a range of aspects:
95+
Provided by the [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) library, these metrics include:
9496

9597
- General resource usage like CPU and memory.
9698
- Go runtime metrics such as the number of Go routines, garbage collection duration, and Go version.
9799
- Controller-specific metrics, including reconciliation errors per controller, length of the reconcile queue, and reconciliation latency.
98100

99101
## How to change the default metrics configuration
100102

101-
Configuring NGINX Gateway Fabric for monitoring is straightforward. You can change metric settings using Helm or Kubernetes manifests, depending on your setup.
103+
You can configure monitoring metrics for NGINX Gateway Fabric using Helm or Manifests.
102104

103105
### Using Helm
104106

site/static/grafana-dashboard.json

+265-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"editable": true,
2020
"fiscalYearStartMonth": 0,
2121
"graphTooltip": 0,
22-
"id": 5,
22+
"id": 1,
2323
"links": [],
2424
"liveNow": false,
2525
"panels": [
@@ -129,7 +129,7 @@
129129
"type": "stat"
130130
},
131131
{
132-
"collapsed": true,
132+
"collapsed": false,
133133
"gridPos": {
134134
"h": 1,
135135
"w": 24,
@@ -226,7 +226,7 @@
226226
},
227227
"disableTextWrap": false,
228228
"editorMode": "code",
229-
"expr": "irate(nginx_gateway_fabric_connections_accepted{instance=~\"$instance\"}[5m])",
229+
"expr": "irate(nginx_gateway_fabric_connections_accepted{instance=~\"$instance\"}[1m])",
230230
"fullMetaSearch": false,
231231
"includeNullMetadata": false,
232232
"instant": false,
@@ -242,7 +242,7 @@
242242
"uid": "${DS_PROMETHEUS}"
243243
},
244244
"editorMode": "code",
245-
"expr": "irate(nginx_gateway_fabric_connections_handled{instance=~\"$instance\"}[5m])",
245+
"expr": "irate(nginx_gateway_fabric_connections_handled{instance=~\"$instance\"}[1m])",
246246
"hide": false,
247247
"instant": false,
248248
"legendFormat": "{{instance}} handled",
@@ -469,8 +469,8 @@
469469
"uid": "${DS_PROMETHEUS}"
470470
},
471471
"disableTextWrap": false,
472-
"editorMode": "builder",
473-
"expr": "irate(nginx_gateway_fabric_http_requests_total{instance=~\"$instance\"}[5m])",
472+
"editorMode": "code",
473+
"expr": "irate(nginx_gateway_fabric_http_requests_total{instance=~\"$instance\"}[1m])",
474474
"fullMetaSearch": false,
475475
"includeNullMetadata": false,
476476
"instant": false,
@@ -482,6 +482,265 @@
482482
],
483483
"title": "Total Requests",
484484
"type": "timeseries"
485+
},
486+
{
487+
"datasource": {
488+
"type": "prometheus",
489+
"uid": "cb451057-d630-4956-9a0e-f19cdc9c8097"
490+
},
491+
"fieldConfig": {
492+
"defaults": {
493+
"color": {
494+
"mode": "palette-classic"
495+
},
496+
"custom": {
497+
"axisBorderShow": false,
498+
"axisCenteredZero": false,
499+
"axisColorMode": "text",
500+
"axisLabel": "",
501+
"axisPlacement": "auto",
502+
"barAlignment": 0,
503+
"drawStyle": "line",
504+
"fillOpacity": 10,
505+
"gradientMode": "none",
506+
"hideFrom": {
507+
"legend": false,
508+
"tooltip": false,
509+
"viz": false
510+
},
511+
"insertNulls": false,
512+
"lineInterpolation": "linear",
513+
"lineWidth": 1,
514+
"pointSize": 1,
515+
"scaleDistribution": {
516+
"type": "linear"
517+
},
518+
"showPoints": "auto",
519+
"spanNulls": false,
520+
"stacking": {
521+
"group": "A",
522+
"mode": "none"
523+
},
524+
"thresholdsStyle": {
525+
"mode": "off"
526+
}
527+
},
528+
"mappings": [],
529+
"thresholds": {
530+
"mode": "absolute",
531+
"steps": [
532+
{
533+
"color": "green",
534+
"value": null
535+
}
536+
]
537+
},
538+
"unitScale": true
539+
},
540+
"overrides": []
541+
},
542+
"gridPos": {
543+
"h": 8,
544+
"w": 12,
545+
"x": 0,
546+
"y": 24
547+
},
548+
"id": 8,
549+
"options": {
550+
"legend": {
551+
"calcs": [],
552+
"displayMode": "list",
553+
"placement": "bottom",
554+
"showLegend": true
555+
},
556+
"tooltip": {
557+
"mode": "single",
558+
"sort": "none"
559+
}
560+
},
561+
"pluginVersion": "10.3.3",
562+
"targets": [
563+
{
564+
"datasource": {
565+
"type": "prometheus",
566+
"uid": "cb451057-d630-4956-9a0e-f19cdc9c8097"
567+
},
568+
"disableTextWrap": false,
569+
"editorMode": "code",
570+
"expr": "irate(nginx_gateway_fabric_nginx_reloads_total{instance=~\"$instance\"}[1m])",
571+
"fullMetaSearch": false,
572+
"includeNullMetadata": false,
573+
"instant": false,
574+
"legendFormat": "{{instance}}",
575+
"range": true,
576+
"refId": "A",
577+
"useBackend": false
578+
}
579+
],
580+
"title": "Total NGINX Reloads Rate",
581+
"type": "timeseries"
582+
},
583+
{
584+
"datasource": {
585+
"type": "prometheus",
586+
"uid": "cb451057-d630-4956-9a0e-f19cdc9c8097"
587+
},
588+
"fieldConfig": {
589+
"defaults": {
590+
"color": {
591+
"mode": "thresholds"
592+
},
593+
"mappings": [],
594+
"thresholds": {
595+
"mode": "absolute",
596+
"steps": [
597+
{
598+
"color": "green",
599+
"value": null
600+
},
601+
{
602+
"color": "red",
603+
"value": 1
604+
}
605+
]
606+
},
607+
"unitScale": true
608+
},
609+
"overrides": []
610+
},
611+
"gridPos": {
612+
"h": 8,
613+
"w": 6,
614+
"x": 12,
615+
"y": 24
616+
},
617+
"id": 9,
618+
"options": {
619+
"colorMode": "value",
620+
"graphMode": "area",
621+
"justifyMode": "auto",
622+
"orientation": "auto",
623+
"reduceOptions": {
624+
"calcs": [
625+
"lastNotNull"
626+
],
627+
"fields": "",
628+
"values": false
629+
},
630+
"showPercentChange": false,
631+
"textMode": "auto",
632+
"wideLayout": true
633+
},
634+
"pluginVersion": "10.3.3",
635+
"targets": [
636+
{
637+
"datasource": {
638+
"type": "prometheus",
639+
"uid": "cb451057-d630-4956-9a0e-f19cdc9c8097"
640+
},
641+
"disableTextWrap": false,
642+
"editorMode": "builder",
643+
"expr": "nginx_gateway_fabric_nginx_reload_errors_total{instance=~\"$instance\"}",
644+
"fullMetaSearch": false,
645+
"includeNullMetadata": true,
646+
"instant": false,
647+
"legendFormat": "{{instance}}",
648+
"range": true,
649+
"refId": "A",
650+
"useBackend": false
651+
}
652+
],
653+
"title": "Total NGINX Reload Errors",
654+
"type": "stat"
655+
},
656+
{
657+
"datasource": {
658+
"type": "prometheus",
659+
"uid": "cb451057-d630-4956-9a0e-f19cdc9c8097"
660+
},
661+
"fieldConfig": {
662+
"defaults": {
663+
"color": {
664+
"mode": "thresholds"
665+
},
666+
"mappings": [
667+
{
668+
"options": {
669+
"0": {
670+
"color": "semi-dark-green",
671+
"index": 0,
672+
"text": "Up to date"
673+
},
674+
"1": {
675+
"color": "semi-dark-red",
676+
"index": 1,
677+
"text": "Stale"
678+
}
679+
},
680+
"type": "value"
681+
}
682+
],
683+
"thresholds": {
684+
"mode": "absolute",
685+
"steps": [
686+
{
687+
"color": "green",
688+
"value": null
689+
},
690+
{
691+
"color": "semi-dark-red",
692+
"value": 1
693+
}
694+
]
695+
},
696+
"unitScale": true
697+
},
698+
"overrides": []
699+
},
700+
"gridPos": {
701+
"h": 8,
702+
"w": 6,
703+
"x": 18,
704+
"y": 24
705+
},
706+
"id": 10,
707+
"options": {
708+
"colorMode": "value",
709+
"graphMode": "area",
710+
"justifyMode": "auto",
711+
"orientation": "auto",
712+
"reduceOptions": {
713+
"calcs": [
714+
"lastNotNull"
715+
],
716+
"fields": "",
717+
"values": false
718+
},
719+
"showPercentChange": false,
720+
"textMode": "auto",
721+
"wideLayout": true
722+
},
723+
"pluginVersion": "10.3.3",
724+
"targets": [
725+
{
726+
"datasource": {
727+
"type": "prometheus",
728+
"uid": "cb451057-d630-4956-9a0e-f19cdc9c8097"
729+
},
730+
"disableTextWrap": false,
731+
"editorMode": "builder",
732+
"expr": "nginx_gateway_fabric_nginx_stale_config{instance=~\"$instance\"}",
733+
"fullMetaSearch": false,
734+
"includeNullMetadata": true,
735+
"instant": false,
736+
"legendFormat": "__auto",
737+
"range": true,
738+
"refId": "A",
739+
"useBackend": false
740+
}
741+
],
742+
"title": "NGINX Config State",
743+
"type": "stat"
485744
}
486745
],
487746
"refresh": "5s",

0 commit comments

Comments
 (0)