diff --git a/alert_rules_template.json b/alert_rules_template.json index 5fc4624..67d3643 100644 --- a/alert_rules_template.json +++ b/alert_rules_template.json @@ -1,5 +1,5 @@ { - "version": "1.3.0", + "version": "1.4.3", "description": "Шаблон правил алертинга Grafana для PTAF", "defaults": { "no_data_state": "NoData", @@ -531,5 +531,9 @@ "summary": "🔴 {{ $labels.instance }}: служба angie.service не активна" } } - ] + ], + "contact_point": { + "receiver_name": "Telegram PTAF Grafana", + "message_template": "{{ range .Alerts }}{{ if eq .Status \"firing\" }}🔴 *Firing*{{ else }}✅ *Resolved*{{ end }}\n{{ if .Annotations.summary }}{{ .Annotations.summary }}{{ end }}\n\n{{ if index .Values \"Значение\" }}*Текущее значение:* {{ index .Values \"Значение\" | printf \"%.2f\" }}\n{{ end }}\n*Labels:*\n{{ range .Labels.SortedPairs }} • {{ .Name }} = {{ .Value }}\n{{ end }}{{ end }}" + } } \ No newline at end of file diff --git a/dashboard_template.json b/dashboard_template.json index 263eb88..44588b2 100644 --- a/dashboard_template.json +++ b/dashboard_template.json @@ -48,14 +48,14 @@ "tenant_panels": [ { "panel_key": "rps", - "title_format": "RPS %s", + "title_format": "RPS {client}", "width": 12, "x_offset": 0, "y_offset": 1 }, { "panel_key": "status_codes", - "title_format": "Status Codes %s", + "title_format": "Status Codes {client}", "width": 12, "x_offset": 12, "y_offset": 1 @@ -75,13 +75,6 @@ "width": 12, "x_offset": 12, "y_offset": 9 - }, - { - "panel_key": "traffic_combined", - "title_suffix": "{sid} Traffic", - "width": 24, - "x_offset": 0, - "y_offset": 17 } ], "overview_row_title": "Обзор", @@ -110,6 +103,22 @@ "x_offset": 0, "y_offset": 34 } + ], + "inter_domain_panels": [ + { + "panel_key": "traffic_combined_total", + "title_format": "Total Traffic {client}", + "condition": { + "type": "min_domains", + "value": 2 + } + } + ], + "traffic_domain_panels": [ + { + "panel_key": "traffic_combined", + "title_format": "{domain} {sid} Traffic" + } ] }, "panels": { @@ -462,7 +471,7 @@ "metric": "sum", "field": "upstream_response_length_digital", "ref_id": "A", - "expression": "$A / 60", + "expression": "$A * 8 / 1000 / 60", "expression_ref_id": "ResponseTraffic" }, { @@ -470,7 +479,7 @@ "metric": "sum", "field": "upstream_bytes_sent_digital", "ref_id": "B", - "expression": "$B / 60", + "expression": "$B * 8 / 1000 / 60", "expression_ref_id": "RequestTraffic" } ] @@ -507,7 +516,7 @@ "metric": "sum", "field": "upstream_response_length_digital", "ref_id": "A", - "expression": "($A / 60)", + "expression": "($A * 8 / 1000 / 60)", "expression_ref_id": "Traffic" } }, @@ -1121,6 +1130,96 @@ } ] } + }, + "traffic_combined_total": { + "type": "timeseries", + "description": "Total Response and Request Traffic (all resources)", + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 17 + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "drawStyle": "line", + "fillOpacity": 10, + "lineInterpolation": "smooth", + "lineWidth": 1, + "showPoints": "never", + "spanNulls": 180000 + }, + "unit": "Kbits" + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*Response.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/.*Request.*/" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + } + ] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single" + } + }, + "query_mode": "multi_sum_expression", + "query_config": { + "base_query": "SID:{sid}", + "targets": [ + { + "alias": "Response Traffic", + "metric": "sum", + "field": "upstream_response_length_digital", + "ref_id": "A", + "expression": "$A * 8 / 1000 / 60", + "expression_ref_id": "ResponseTrafficTotal" + }, + { + "alias": "Request Traffic", + "metric": "sum", + "field": "upstream_bytes_sent_digital", + "ref_id": "B", + "expression": "$B * 8 / 1000 / 60", + "expression_ref_id": "RequestTrafficTotal" + } + ] + } } }, "queries": {