Skip to content

Commit

Permalink
feat(backend): 添加 dbha 告警策略 #4714
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Jun 3, 2024
1 parent 09abc65 commit 3614540
Show file tree
Hide file tree
Showing 10 changed files with 870 additions and 292 deletions.
6 changes: 3 additions & 3 deletions dbm-ui/backend/db_monitor/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ python manage.py export_alarm tbinlogdumper 46679 46680
prod 策略:
```
source prod.local.env
python manage.py export_alarm mysql
python manage.py export_alarm redis
python manage.py export_alarm mysql 98056 98061 98058
python manage.py export_alarm redis 106455 106497
python manage.py export_alarm es 98003 98004 98005 98006 98007 98008 98009 98010
python manage.py export_alarm kafka 98027 -d -c consumergroup topic
python manage.py export_alarm pulsar 98065 98063
python manage.py export_alarm hdfs
python manage.py export_alarm influxdb
python manage.py export_alarm riak
python manage.py export_alarm cloud
python manage.py export_alarm cloud 100371 100372 100373 113059 100368 100369 117596 114983
```


Expand Down
258 changes: 258 additions & 0 deletions dbm-ui/backend/db_monitor/tpls/alarm/cloud/DBHA全局监控.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
{
"bk_biz_id": 0,
"name": "DBHA全局监控",
"db_type": "cloud",
"details": {
"bk_biz_id": "",
"name": "DBHA全局监控",
"source": "dbm",
"scenario": "component",
"type": "monitor",
"items": [
{
"name": "COUNT(dbha_global_monitor-dbm_report_channel)",
"no_data_config": {
"level": 2,
"continuous": 10,
"is_enabled": false,
"agg_dimension": []
},
"target": [],
"expression": "a",
"functions": [],
"origin_sql": "",
"query_configs": [
{
"data_source_label": "custom",
"data_type_label": "event",
"alias": "a",
"metric_id": "custom.event.bkmonitor_event_{event_data_id}.dbha_global_monitor",
"functions": [],
"result_table_id": "bkmonitor_event_{event_data_id}",
"agg_method": "COUNT",
"agg_interval": 300,
"agg_dimension": [
"server_ip",
"uncovered_city_ids",
"uncovered_num",
"cloud_id",
"appid"
],
"agg_condition": [],
"custom_event_name": "dbha_global_monitor",
"name": "dbha_global_monitor"
}
],
"algorithms": [
{
"type": "Threshold",
"level": 1,
"config": [
[
{
"method": "gte",
"threshold": 1
}
]
],
"unit_prefix": ""
}
],
"metric_type": "event"
}
],
"detects": [
{
"level": 1,
"expression": "",
"trigger_config": {
"count": 2,
"uptime": {
"calendars": [],
"time_ranges": [
{
"end": "23:59",
"start": "00:00"
}
]
},
"check_window": 5
},
"recovery_config": {
"check_window": 5,
"status_setter": "recovery"
},
"connector": "and"
}
],
"actions": [],
"notice": {
"config_id": 115072,
"user_groups": [],
"user_type": "main",
"signal": [
"no_data",
"abnormal"
],
"options": {
"end_time": "23:59:59",
"start_time": "00:00:00",
"assign_mode": [
"by_rule"
],
"upgrade_config": {
"is_enabled": false,
"user_groups": [],
"upgrade_interval": 1440
},
"converge_config": {
"count": 1,
"condition": [
{
"dimension": "strategy_id",
"value": [
"self"
]
},
{
"dimension": "dimensions",
"value": [
"self"
]
},
{
"dimension": "alert_level",
"value": [
"self"
]
},
{
"dimension": "signal",
"value": [
"self"
]
},
{
"dimension": "bk_biz_id",
"value": [
"self"
]
},
{
"dimension": "notice_receiver",
"value": [
"self"
]
},
{
"dimension": "notice_way",
"value": [
"self"
]
}
],
"timedelta": 60,
"is_enabled": true,
"converge_func": "collect",
"need_biz_converge": true,
"sub_converge_config": {
"timedelta": 60,
"count": 2,
"condition": [
{
"dimension": "bk_biz_id",
"value": [
"self"
]
},
{
"dimension": "notice_receiver",
"value": [
"self"
]
},
{
"dimension": "notice_way",
"value": [
"self"
]
},
{
"dimension": "alert_level",
"value": [
"self"
]
},
{
"dimension": "signal",
"value": [
"self"
]
}
],
"converge_func": "collect_alarm"
}
},
"chart_image_enabled": true,
"exclude_notice_ways": {
"ack": [],
"closed": [],
"recovered": []
},
"noise_reduce_config": {
"unit": "percent",
"count": 10,
"timedelta": 5,
"dimensions": [
"cloud_id",
"server_ip",
"uncovered_city_ids",
"uncovered_num"
],
"is_enabled": false
}
},
"relate_type": "NOTICE",
"config": {
"need_poll": true,
"notify_interval": 7200,
"interval_notify_mode": "standard",
"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通知人:{{alarm.receivers}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\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通知人:{{alarm.receivers}}\n{{content.content}}\n{{content.current_value}}\n{{content.biz}}\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.assign_detail}}\n{{content.related_info}}",
"title_tmpl": "{{business.bk_biz_name}} - {{alarm.name}}{{alarm.display_type}}"
}
]
}
},
"labels": [
"DBM",
"DBM_CLOUD"
],
"app": "",
"path": "",
"priority": 0,
"priority_group_key": "",
"edit_allowed": true,
"metric_type": "event",
"data_source_type": "自定义事件",
"is_enabled": true
},
"is_enabled": true,
"monitor_indicator": "COUNT(dbha_global_monitor-dbm_report_channel)",
"version": 1,
"alert_source": "event",
"custom_conditions": [],
"export_at": "2024-05-31T17:28:31+08:00"
}
Loading

0 comments on commit 3614540

Please sign in to comment.