Skip to content

Commit

Permalink
feat(helm-charts): 自动初始化监控数据源和仪表盘 #3869
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 5388
  • Loading branch information
zhangzhw8 committed Apr 8, 2024
1 parent f05028b commit e5c1d50
Show file tree
Hide file tree
Showing 174 changed files with 609 additions and 577 deletions.
2 changes: 1 addition & 1 deletion dbm-ui/backend/bk_dataview/bkdbm.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ max_connections = 0
enabled = false

[plugins]
allow_loading_unsigned_plugins = bkmonitor-timeseries-datasource,bkmonitor-event-datasource
allow_loading_unsigned_plugins = bkmonitor-timeseries-datasource,bkmonitor-event-datasource,bk_log_datasource
2 changes: 1 addition & 1 deletion dbm-ui/backend/bk_dataview/dashboards/json/kafka.json
Original file line number Diff line number Diff line change
Expand Up @@ -4225,7 +4225,7 @@
"id": "byNames",
"options": {
"mode": "exclude",
"names": [,
"names": [],
"prefix": "All except:",
"readOnly": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ datasources:
- bk_uid
baseUrl: ${BKMONITOR_URL}/rest/v2/grafana/
- name: 日志平台
uid: bklog
type: bk_log_datasource
access: proxy
isDefault: false
Expand Down
8 changes: 6 additions & 2 deletions dbm-ui/backend/bk_dataview/grafana/provisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging
import os.path
from dataclasses import dataclass
from json import JSONDecodeError
from typing import Dict, List, Optional

import yaml
Expand Down Expand Up @@ -112,8 +113,11 @@ def dashboards(self, request, org_name: str, org_id: int) -> List[Dashboard]:
file_content = file_content.replace(
"{metric_data_id}", str(bkm_dbm_report["metric"]["data_id"])
)

dashboard = json.loads(file_content)
try:
dashboard = json.loads(file_content)
except JSONDecodeError as err:
logger.error(f"Failed to load {os.path.basename(path)}")
raise err
title = dashboard.get("title")
if not title:
continue
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/bk_dataview/grafana/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def check_permissions(self, request):
def perform_provisioning(self, request):
"""默认的数据源, 面板注入"""
if len(self.provisioning_classes) == 0:
logger.warning("perform_provisioning: %s", len(self.provisioning_classes))
logger.warning("perform_provisioning: provisioning_classes len is %s", len(self.provisioning_classes))
return

logger.warning("perform_provisioning: %s", self.provisioning_classes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
},
"is_enabled": true,
"monitor_indicator": "COUNT(dns_check_warning-dbm_report_channel)",
"version": 18,
"version": 22,
"alert_source": "event",
"custom_conditions": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,17 @@
"template": [
{
"signal": "abnormal",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "recovered",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "closed",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
}
]
Expand All @@ -259,7 +259,7 @@
},
"is_enabled": true,
"monitor_indicator": "AVG(CPU使用率)",
"version": 21,
"version": 22,
"alert_source": "time_series",
"custom_conditions": [],
"export_at": "2024-03-28T21:19:53+08:00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,17 @@
"template": [
{
"signal": "abnormal",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "recovered",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "closed",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
}
]
Expand All @@ -260,7 +260,7 @@
},
"is_enabled": true,
"monitor_indicator": "AVG(I/O使用率)",
"version": 21,
"version": 22,
"alert_source": "time_series",
"custom_conditions": [],
"export_at": "2024-03-28T21:19:53+08:00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,17 @@
"template": [
{
"signal": "abnormal",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "recovered",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "closed",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
}
]
Expand All @@ -295,7 +295,7 @@
},
"is_enabled": true,
"monitor_indicator": "AVG(磁盘空间使用率)",
"version": 21,
"version": 22,
"alert_source": "time_series",
"custom_conditions": [],
"export_at": "2024-03-28T21:19:53+08:00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,17 @@
"template": [
{
"signal": "abnormal",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "recovered",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "closed",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
}
]
Expand All @@ -269,7 +269,7 @@
},
"is_enabled": true,
"monitor_indicator": "AVG(网卡入流量)",
"version": 21,
"version": 22,
"alert_source": "time_series",
"custom_conditions": [],
"export_at": "2024-03-28T21:19:53+08:00"
Expand Down
8 changes: 4 additions & 4 deletions dbm-ui/backend/db_monitor/tpls/alarm/es/ES 写拒绝.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,17 @@
"template": [
{
"signal": "abnormal",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "recovered",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "closed",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
}
]
Expand All @@ -268,7 +268,7 @@
},
"is_enabled": true,
"monitor_indicator": "max_without_time(elasticsearch_thread_pool_rejected_count)",
"version": 21,
"version": 22,
"alert_source": "time_series",
"custom_conditions": [],
"export_at": "2024-03-28T21:19:53+08:00"
Expand Down
8 changes: 4 additions & 4 deletions dbm-ui/backend/db_monitor/tpls/alarm/es/ES 写排队.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,17 @@
"template": [
{
"signal": "abnormal",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "recovered",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
},
{
"signal": "closed",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.related_info}}",
"message_tmpl": "{{content.level}}\n{{content.begin_time}}\n{{content.time}}\n{{content.duration}}\n{{content.target_type}}\n{{content.data_source}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\n通知人:{{alarm.receivers}}\n{{content.target}}\n{{content.dimension}}\n{{content.detail}}\n{{content.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
}
]
Expand All @@ -258,7 +258,7 @@
},
"is_enabled": true,
"monitor_indicator": "MAX(elasticsearch_thread_pool_queue_count)",
"version": 21,
"version": 22,
"alert_source": "time_series",
"custom_conditions": [],
"export_at": "2024-03-28T21:19:53+08:00"
Expand Down
Loading

0 comments on commit e5c1d50

Please sign in to comment.