diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-03-23 16:59:15 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-03-23 16:59:15 +0300 |
commit | f6e36a699ae2d073e340e0a5844b8e111ed3de37 (patch) | |
tree | 52bb1d04e7b027165245b55622859b8425105fc7 /modules/nixos/monitoring/rules/nginx.yaml | |
parent | 2023-03-22 (diff) |
2023-03-23
Diffstat (limited to 'modules/nixos/monitoring/rules/nginx.yaml')
-rw-r--r-- | modules/nixos/monitoring/rules/nginx.yaml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/modules/nixos/monitoring/rules/nginx.yaml b/modules/nixos/monitoring/rules/nginx.yaml new file mode 100644 index 0000000..59229a8 --- /dev/null +++ b/modules/nixos/monitoring/rules/nginx.yaml @@ -0,0 +1,52 @@ +--- +groups: + - name: Nginx + + rules: + - alert: NginxHighHttp4xxErrorRate + expr: >- + sum(rate(nginx_http_requests_total{status=~"^4.."}[1m])) + / sum(rate(nginx_http_requests_total[1m])) * 100 + > 5 + for: 1m + labels: + severity: critical + annotations: + summary: NGINX high HTTP 4xx error rate (instance {{ $labels.instance }}) + description: |- + Too many HTTP requests with status 4xx (> 5%). + + VALUE = {{ $value }} + LABELS = {{ $labels }} + + - alert: NginxHighHttp5xxErrorRate + expr: >- + sum(rate(nginx_http_requests_total{status=~"^5.."}[1m])) + / sum(rate(nginx_http_requests_total[1m])) * 100 + > 5 + for: 1m + labels: + severity: critical + annotations: + summary: NGINX high HTTP 5xx error rate (instance {{ $labels.instance }}) + description: |- + Too many HTTP requests with status 5xx (> 5%). + + VALUE = {{ $value }} + LABELS = {{ $labels }} + + - alert: NginxLatencyHigh + expr: >- + histogram_quantile(0.99, + sum(rate(nginx_http_request_duration_seconds_bucket[2m])) by (host, node)) + > 3 + for: 2m + labels: + severity: warning + annotations: + summary: NGINX high latency (instance {{ $labels.instance }}) + description: |- + NGINX 99% latency is higher than 3 seconds. + + VALUE = {{ $value }} + LABELS = {{ $labels }} |