homework 10.3: complete rest of homework

This commit is contained in:
2022-10-05 14:52:15 +07:00
parent cf7e8c27f2
commit cc1297a674
6 changed files with 227 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -55,8 +55,41 @@ avg(node_load15{})
- Количество свободной оперативной памяти - Количество свободной оперативной памяти
// todo ```text
node_memory_MemTotal_bytes - node_memory_Active_bytes
```
- Количество места на файловой системе - Количество места на файловой системе
// todo ```text
node_filesystem_avail_bytes{mountpoint="/"}
```
![grafana_node_exporter_dashboard](./img/grafana_node_exporter_dashboard.png)
### Задание 3
> Создайте для каждой Dashboard подходящее правило alert (можно обратиться к первой лекции в блоке "Мониторинг").
> Дополнительно нужно завести удобный для вас канал нотификации, например Telegram или Email и отправить туда тестовые события.
>
> Для решения ДЗ - приведите скриншот вашей итоговой Dashboard и скриншоты тестовых событий из каналов нотификаций.
Dashboard с настроенными alerts:
![grafana_node_exporter_dashboard_alerts](./img/grafana_node_exporter_dashboard_alerts.png)
Тестовая нотификация в `discord`:
[grafana_discord_test_alert](./img/grafana_discord_test_alert.png)
### Задание 4
> Сохраните ваш Dashboard.
>
> Для этого перейдите в настройки Dashboard, выберите в боковом меню "JSON MODEL".
>
> Далее скопируйте отображаемое json-содержимое в отдельный файл и сохраните его.
>
> В решении задания - приведите листинг этого файла.
Файл с dashboard: [stack/grafana/dashboard_backup.json](./stack/grafana/dashboard_backup.json)

View File

@@ -32,7 +32,7 @@ services:
- 9090 - 9090
depends_on: depends_on:
node-exporter: node-exporter:
condition: service_completed_successfully condition: service_started
grafana: grafana:
image: grafana/grafana:9.1.7 image: grafana/grafana:9.1.7

View File

@@ -162,6 +162,101 @@
"title": "CPU Load Average", "title": "CPU Load Average",
"type": "gauge" "type": "gauge"
}, },
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "dashed"
}
},
"displayName": "mem available",
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1073741824
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 11,
"x": 13,
"y": 0
},
"id": 6,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "code",
"expr": "node_memory_MemTotal_bytes - node_memory_Active_bytes",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Свободная оперативная память",
"type": "timeseries"
},
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
@@ -276,6 +371,101 @@
], ],
"title": "Нагрузка на node", "title": "Нагрузка на node",
"type": "timeseries" "type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "dashed"
}
},
"displayName": "fs available",
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 10737418240
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 11,
"x": 13,
"y": 8
},
"id": 8,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "code",
"expr": "node_filesystem_avail_bytes{mountpoint=\"/\"}",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Свободное место на диске",
"type": "timeseries"
} }
], ],
"refresh": false, "refresh": false,
@@ -293,6 +483,6 @@
"timezone": "", "timezone": "",
"title": "node-exporter", "title": "node-exporter",
"uid": "NwsNrL44z", "uid": "NwsNrL44z",
"version": 1, "version": 4,
"weekStart": "" "weekStart": ""
} }