-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add resource association abnormal alarm
- Loading branch information
1 parent
98e8f7a
commit d1682a4
Showing
3 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
server/controller/db/mysql/migrator/schema/rawsql/issu/6.6.1.18.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
-- Tractions are needed for these commands to avoid manual rollback if error occurs. | ||
START TRANSACTION; | ||
-- modify start, add upgrade sql | ||
set @lcuuid = (select uuid()); | ||
INSERT INTO alarm_policy(user_id, tag_conditions, query_conditions, query_url, query_params, name, level, state, | ||
app_type, contrast_type, target_field, threshold_warning, lcuuid) | ||
values(1, '过滤项: tag.type = device_ip_connection', '[{\"type\":\"deepflow\",\"tableName\":\"deepflow_server_controller_resource_relation_exception\",\"dbName\":\"deepflow_tenant\",\"metrics\":[{\"description\":\"\",\"typeName\":\"counter\",\"METRIC_CATEGORY\":\"metrics\",\"METRIC\":\"metrics.count\",\"METRIC_NAME\":\"metrics.count\",\"isTimeUnit\":false,\"type\":1,\"unit\":[\"data\",\"short\"],\"checked\":true,\"operatorLv2\":[],\"_key\":\"77b0ee61-e213-4d10-9342-bb172f861f39\",\"perOperator\":\"\",\"operatorLv1\":\"Sum\",\"percentile\":null,\"markLine\":null,\"diffMarkLine\":null,\"METRIC_LABEL\":\"Sum(metrics.count)\",\"ORIGIN_METRIC_LABEL\":\"Sum(metrics.count)\"}],\"condition\":{\"dbName\":\"deepflow_tenant\",\"tableName\":\"deepflow_server_controller_resource_relation_exception\",\"type\":\"simplified\",\"RESOURCE_SETS\":[{\"id\":\"R1\",\"condition\":[{\"key\":\"tag.type\",\"op\":\"=\",\"val\":[\"device_ip_connection\"]}],\"groupBy\":[\"_\",\"tag.domain\"],\"groupInfo\":{\"mainGroupInfo\":[\"_\"],\"otherGroupInfo\":[\"tag.domain\"]},\"inputMode\":\"free\"}]},\"dataSource\":\"\"}]', | ||
'/v1/stats/querier/UniversalHistory', '{\"DATABASE\":\"deepflow_tenant\",\"TABLE\":\"deepflow_server_controller_resource_relation_exception\",\"interval\":60,\"fill\": \"none\",\"window_size\":1,\"QUERIES\":[{\"QUERY_ID\":\"R1\",\"SELECT\":\"Sum(`metrics.count`) AS `Sum(metrics.count)`\",\"WHERE\":\"`tag.type`=\'device_ip_connection\'\",\"GROUP_BY\":\"`tag.domain`\",\"METRICS\":[\"Sum(`metrics.count`) AS `Sum(metrics.count)`\"]}]}', | ||
'云资源关联关系异常 (实例与IP)', 0, 1, 1, 1, '{\"displayName\":\"Sum(metrics.count)\",\"unit\":\"\"}', '{\"OP\":\">=\",\"VALUE\":1}', @lcuuid); | ||
|
||
set @lcuuid = (select uuid()); | ||
INSERT INTO alarm_policy(user_id, tag_conditions, query_conditions, query_url, query_params, name, level, state, | ||
app_type, contrast_type, target_field, threshold_warning, lcuuid) | ||
values(1, '过滤项: tag.type = chost_pod_node_connection', '[{\"type\":\"deepflow\",\"tableName\":\"deepflow_server_controller_resource_relation_exception\",\"dbName\":\"deepflow_tenant\",\"metrics\":[{\"description\":\"\",\"typeName\":\"counter\",\"METRIC_CATEGORY\":\"metrics\",\"METRIC\":\"metrics.count\",\"METRIC_NAME\":\"metrics.count\",\"isTimeUnit\":false,\"type\":1,\"unit\":[\"data\",\"short\"],\"checked\":true,\"operatorLv2\":[],\"_key\":\"77b0ee61-e213-4d10-9342-bb172f861f39\",\"perOperator\":\"\",\"operatorLv1\":\"Sum\",\"percentile\":null,\"markLine\":null,\"diffMarkLine\":null,\"METRIC_LABEL\":\"Sum(metrics.count)\",\"ORIGIN_METRIC_LABEL\":\"Sum(metrics.count)\"}],\"condition\":{\"dbName\":\"deepflow_tenant\",\"tableName\":\"deepflow_server_controller_resource_relation_exception\",\"type\":\"simplified\",\"RESOURCE_SETS\":[{\"id\":\"R1\",\"condition\":[{\"key\":\"tag.type\",\"op\":\"=\",\"val\":[\"chost_pod_node_connection\"]}],\"groupBy\":[\"_\",\"tag.domain\"],\"groupInfo\":{\"mainGroupInfo\":[\"_\"],\"otherGroupInfo\":[\"tag.domain\"]},\"inputMode\":\"free\"}]},\"dataSource\":\"\"}]', | ||
'/v1/stats/querier/UniversalHistory', '{\"DATABASE\":\"deepflow_tenant\",\"TABLE\":\"deepflow_server_controller_resource_relation_exception\",\"interval\":60,\"fill\": \"none\",\"window_size\":1,\"QUERIES\":[{\"QUERY_ID\":\"R1\",\"SELECT\":\"Sum(`metrics.count`) AS `Sum(metrics.count)`\",\"WHERE\":\"`tag.type`=\'chost_pod_node_connection\'\",\"GROUP_BY\":\"`tag.domain`\",\"METRICS\":[\"Sum(`metrics.count`) AS `Sum(metrics.count)`\"]}]}', | ||
'云资源关联关系异常 (云服务器与容器节点)', 0, 1, 1, 1, '{\"displayName\":\"Sum(metrics.count)\",\"unit\":\"\"}', '{\"OP\":\">=\",\"VALUE\":1}', @lcuuid); | ||
|
||
set @lcuuid = (select uuid()); | ||
INSERT INTO alarm_policy(user_id, tag_conditions, query_conditions, query_url, query_params, name, level, state, | ||
app_type, contrast_type, target_field, threshold_warning, lcuuid) | ||
values(1, '过滤项: N/A', '[{\"type\":\"deepflow\",\"tableName\":\"deepflow_server_controller_resource_sync_delay\",\"dbName\":\"deepflow_tenant\",\"metrics\":[{\"description\":\"\",\"typeName\":\"counter\",\"METRIC_CATEGORY\":\"metrics\",\"METRIC\":\"metrics.max_delay\",\"METRIC_NAME\":\"metrics.max_delay\",\"isTimeUnit\":false,\"type\":1,\"unit\":[\"data\",\"short\"],\"checked\":true,\"operatorLv2\":[],\"_key\":\"77b0ee61-e213-4d10-9342-bb172f861f39\",\"perOperator\":\"\",\"operatorLv1\":\"Max\",\"percentile\":null,\"markLine\":null,\"diffMarkLine\":null,\"METRIC_LABEL\":\"Max(metrics.max_delay)\",\"ORIGIN_METRIC_LABEL\":\"Max(metrics.max_delay)\"}],\"condition\":{\"dbName\":\"deepflow_tenant\",\"tableName\":\"deepflow_server_controller_resource_sync_delay\",\"type\":\"simplified\",\"RESOURCE_SETS\":[{\"id\":\"R1\",\"condition\":[],\"groupBy\":[\"_\",\"tag.domain\"],\"groupInfo\":{\"mainGroupInfo\":[\"_\"],\"otherGroupInfo\":[\"tag.domain\"]},\"inputMode\":\"free\"}]},\"dataSource\":\"\"}]', | ||
'/v1/stats/querier/UniversalHistory', '{\"DATABASE\":\"deepflow_tenant\",\"TABLE\":\"deepflow_server_controller_resource_sync_delay\",\"interval\":60,\"fill\": \"none\",\"window_size\":1,\"QUERIES\":[{\"QUERY_ID\":\"R1\",\"SELECT\":\"Max(`metrics.max_delay`) AS `Max(metrics.max_delay)`\",\"WHERE\":\"1=1\",\"GROUP_BY\":\"`tag.domain`\",\"METRICS\":[\"Max(`metrics.max_delay`) AS `Max(metrics.max_delay)`\"]}]}', | ||
'云资源同步滞后 (云服务器)', 0, 1, 1, 1, '{\"displayName\":\"Max(metrics.max_delay)\",\"unit\":\"\"}', '{\"OP\":\">=\",\"VALUE\":150}', @lcuuid); | ||
|
||
set @lcuuid = (select uuid()); | ||
INSERT INTO alarm_policy(user_id, tag_conditions, query_conditions, query_url, query_params, name, level, state, | ||
app_type, contrast_type, target_field, threshold_warning, lcuuid) | ||
values(1, '过滤项: N/A', '[{\"type\":\"deepflow\",\"tableName\":\"deepflow_server_controller_resource_sync_delay\",\"dbName\":\"deepflow_tenant\",\"metrics\":[{\"description\":\"\",\"typeName\":\"counter\",\"METRIC_CATEGORY\":\"metrics\",\"METRIC\":\"metrics.max_delay\",\"METRIC_NAME\":\"metrics.max_delay\",\"isTimeUnit\":false,\"type\":1,\"unit\":[\"data\",\"short\"],\"checked\":true,\"operatorLv2\":[],\"_key\":\"77b0ee61-e213-4d10-9342-bb172f861f39\",\"perOperator\":\"\",\"operatorLv1\":\"Max\",\"percentile\":null,\"markLine\":null,\"diffMarkLine\":null,\"METRIC_LABEL\":\"Max(metrics.max_delay)\",\"ORIGIN_METRIC_LABEL\":\"Max(metrics.max_delay)\"}],\"condition\":{\"dbName\":\"deepflow_tenant\",\"tableName\":\"deepflow_server_controller_resource_sync_delay\",\"type\":\"simplified\",\"RESOURCE_SETS\":[{\"id\":\"R1\",\"condition\":[],\"groupBy\":[\"_\",\"tag.domain\",\"tag.sub_domain\"],\"groupInfo\":{\"mainGroupInfo\":[\"_\"],\"otherGroupInfo\":[\"tag.domain\",\"tag.sub_domain\"]},\"inputMode\":\"free\"}]},\"dataSource\":\"\"}]', | ||
'/v1/stats/querier/UniversalHistory', '{\"DATABASE\":\"deepflow_tenant\",\"TABLE\":\"deepflow_server_controller_resource_sync_delay\",\"interval\":60,\"fill\": \"none\",\"window_size\":1,\"QUERIES\":[{\"QUERY_ID\":\"R1\",\"SELECT\":\"Max(`metrics.max_delay`) AS `Max(metrics.max_delay)`\",\"WHERE\":\"1=1\",\"GROUP_BY\":\"`tag.domain`, `tag.sub_domain`\",\"METRICS\":[\"Max(`metrics.max_delay`) AS `Max(metrics.max_delay)`\"]}]}', | ||
'云资源同步滞后 (POD)', 0, 1, 1, 1, '{\"displayName\":\"Max(metrics.max_delay)\",\"unit\":\"\"}', '{\"OP\":\">=\",\"VALUE\":120}', @lcuuid); | ||
|
||
set @lcuuid = (select uuid()); | ||
INSERT INTO alarm_policy(user_id, tag_conditions, query_conditions, query_url, query_params, name, level, state, | ||
app_type, contrast_type, target_field, threshold_warning, lcuuid) | ||
values(1, '过滤项: N/A', '[{\"type\":\"deepflow\",\"tableName\":\"deepflow_server_controller_cloud_task_cost\",\"dbName\":\"deepflow_tenant\",\"metrics\":[{\"description\":\"\",\"typeName\":\"counter\",\"METRIC_CATEGORY\":\"metrics\",\"METRIC\":\"metrics.cost\",\"METRIC_NAME\":\"metrics.cost\",\"isTimeUnit\":false,\"type\":1,\"unit\":[\"data\",\"short\"],\"checked\":true,\"operatorLv2\":[],\"_key\":\"77b0ee61-e213-4d10-9342-bb172f861f39\",\"perOperator\":\"\",\"operatorLv1\":\"AAvg\",\"percentile\":null,\"markLine\":null,\"diffMarkLine\":null,\"METRIC_LABEL\":\"AAvg(metrics.cost)\",\"ORIGIN_METRIC_LABEL\":\"AAvg(metrics.cost)\"}],\"condition\":{\"dbName\":\"deepflow_tenant\",\"tableName\":\"deepflow_server_controller_cloud_task_cost\",\"type\":\"simplified\",\"RESOURCE_SETS\":[{\"id\":\"R1\",\"condition\":[],\"groupBy\":[\"_\",\"tag.domain\"],\"groupInfo\":{\"mainGroupInfo\":[\"_\"],\"otherGroupInfo\":[\"tag.domain\"]},\"inputMode\":\"free\"}]},\"dataSource\":\"\"}]', | ||
'/v1/stats/querier/UniversalHistory', '{\"DATABASE\":\"deepflow_tenant\",\"TABLE\":\"deepflow_server_controller_cloud_task_cost\",\"interval\":60,\"fill\": \"none\",\"window_size\":1,\"QUERIES\":[{\"QUERY_ID\":\"R1\",\"SELECT\":\"AAvg(`metrics.cost`) AS `AAvg(metrics.cost)`\",\"WHERE\":\"1=1\",\"GROUP_BY\":\"`tag.domain`\",\"METRICS\":[\"AAvg(`metrics.cost`) AS `AAvg(metrics.cost)`\"]}]}', | ||
'云资源同步滞后 (API 调用)', 0, 1, 1, 1, '{\"displayName\":\"AAvg(metrics.cost)\",\"unit\":\"\"}', '{\"OP\":\">=\",\"VALUE\":300}', @lcuuid); | ||
-- update db_version to latest, remember update DB_VERSION_EXPECTED in migration/version.go | ||
UPDATE db_version SET version='6.6.1.18'; | ||
-- modify end | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters