console/web/mock/alerting/rule.js

935 lines
36 KiB
JavaScript

const ruleItem = {
id: "c97um9tath2fgbc3jbsg",
created: "2022-04-08T15:58:31.318579+08:00",
updated: "2022-04-08T15:58:31.318579+08:00",
enabled: true,
resource: {
id: "c8i18llath2blrusdjng",
type: "elasticsearch",
objects: [".infini_metrics*"],
filter: {
and: [{ field: "timestamp", operator: "gte", values: ["now-15m"] }],
},
raw_filter: {
bool: { must: [{ range: { timestamp: { gte: "now-15m" } } }] },
},
time_field: "timestamp",
context: { fields: null },
},
metrics: {
period_interval: "1m",
max_periods: 15,
groups: [
{
field: "xxxx1",
limit: 5,
},
{
field: "xxxx2",
limit: 2,
},
],
items: [
{
name: "a",
field: "payload.elasticsearch.node_stats.fs.total.free_in_bytes",
statistic: "min",
},
{
name: "b",
field: "payload.elasticsearch.node_stats.fs.total.total_in_bytes",
statistic: "max",
},
],
formula: "a/b*100",
expression: "min(fs.free_in_bytes)/max(fs.total_in_bytes)*100",
title: "",
content: "",
},
conditions: {
operator: "any",
items: [
{
minimum_period_match: 1,
operator: "lte",
values: ["10"],
severity: "error",
message: "磁盘可用率小于10%",
},
],
},
channels: {
normal: [
{
name: "钉钉",
type: "webhook",
webhook: {
header_params: { "Content-Type": "application/json" },
method: "POST",
url: "https://oapi.dingtalk.com/robot/send?access_token=XXXXXX",
body:
'{"msgtype": "text","text": {"content":"告警通知: {{ctx.message}}"}}',
},
},
],
escalation: [
{
name: "微信",
type: "webhook",
webhook: {
header_params: { "Content-Type": "application/json" },
method: "POST",
url: "https://oapi.weixin.com/robot/send?access_token=XXXXXX",
body:
'{"msgtype": "text","text": {"content":"告警通知: {{ctx.message}}"}}',
},
},
],
throttle_period: "1h",
accept_time_range: { start: "8:00", end: "21:00" },
escalation_enabled: true,
escalation_throttle_period: "30m",
},
schedule: {
interval: "1m",
},
};
export default {
//[]rule 传递规则数组
"POST /alerting/rule": function(req, res) {
//自动生成 expression 规则表达式
//根据 统计周期和 最大统计周期数 计算时间过滤条件, 然后附加到 filter 过滤条件
//根据规则生成 task 任务, 运行任务
res.send({
_id: "c97um9tath2fgbc3jbsg",
_source: ruleItem,
result: "created",
});
},
"GET /alerting/rule/_search": function(req, res) {
res.send({
took: 0,
timed_out: false,
_shards: { total: 1, successful: 1, skipped: 0, failed: 0 },
hits: {
total: { value: 1, relation: "eq" },
max_score: 1.0,
hits: [
{
_index: ".infini_alerting-rule",
_type: "_doc",
_id: "c97um9tath2fgbc3jbsg",
_score: 1.0,
_source: {
...ruleItem,
},
},
],
},
});
},
//["c97um9tath2fgbc3jbsg"]
"GET /alerting/rule/info": function(req, res) {
res.send({
c97um9tath2fgbc3jbsg: {
alert_count: 3,
status: "active",
},
});
},
"GET /alerting/rule/:rule_id": function(req, res) {
res.send({
found: true,
_id: "c97um9tath2fgbc3jbsg",
_source: ruleItem,
});
},
"GET /alerting/rule/:rule_id/info": function(req, res) {
res.send({
conditions: {
operator: "any",
items: [
{
minimum_period_match: 1,
operator: "lte",
values: ["76"],
severity: "error",
expression:
"min(payload.elasticsearch.node_stats.fs.total.free_in_bytes)/max(payload.elasticsearch.node_stats.fs.total.total_in_bytes)*100 <= 76",
},
{
minimum_period_match: 1,
operator: "lte",
values: ["75"],
severity: "critical",
expression:
"min(payload.elasticsearch.node_stats.fs.total.free_in_bytes)/max(payload.elasticsearch.node_stats.fs.total.total_in_bytes)*100 <= 75",
},
],
},
enabled: true,
message_count: 8,
period_interval: "1m",
resource_name: "elasticsearch",
resource_objects: [".infini_metrics"],
state: "alerting",
updated: "2022-05-18T18:37:44.694967+08:00",
});
},
"PUT /alerting/rule/:rule_id": function(req, res) {
//自动生成 expression 规则表达式
//根据 统计周期和 最大统计周期数 计算时间过滤条件, 然后附加到 filter 过滤条件
//根据规则生成 task 任务,然后替换原来的 task
ruleItem.updated = new Date();
res.send({
_id: "c97um9tath2fgbc3jbsg",
_source: ruleItem,
result: "updated",
});
},
"DELETE /alerting/rule/:rule_id": function(req, res) {
//移除对应任务
res.send({
result: "deleted",
});
},
//{"enabled": false}
"POST /alerting/rule/:rule_id/_enable": function(req, res) {
//关闭开启任务
res.send({
result: "updated",
});
},
//rule entity
"POST /alerting/rule/test": function(req, res) {
res.send({
result: "success",
});
},
//根据时间范围获取规则指标数据. 查询参数(min,max,)
"GET /alerting/rule/:rule_id/metric": function(req, res) {
res.send({
metric: {
key: "c9tm3tlath24js45edq0",
axis: [
{
id: "ca2rcl5ath24btln62m0",
group: "c9tm3tlath24js45edq0",
title: "",
formatType: "num",
position: "left",
tickFormat: "0,0.[00]",
ticks: 5,
labelFormat: "",
showGridLines: true,
},
],
lines: [
{
timeRange: {
min: 0,
max: 0,
},
data: [
[1652839800000, 95.70319250749945],
[1652840400000, 95.70284407522763],
[1652841000000, 95.70281042313438],
[1652841600000, 95.7046973294504],
[1652842200000, 95.70100498491836],
[1652842800000, 95.70083095649696],
[1652843400000, 95.70046296778555],
[1652844000000, 95.70011549115127],
[1652844600000, 95.6997285944686],
[1652845200000, 95.69931719250908],
[1652845800000, 95.69910449489737],
[1652846400000, 95.70098928515883],
[1652847000000, 95.7006149824137],
[1652847600000, 95.6996553858073],
[1652848200000, 95.6998578103155],
[1652848800000, 95.69968340646507],
[1652849400000, 95.69940261967888],
[1652850000000, 95.69906333422347],
[1652850600000, 95.698855585449],
[1652851200000, 95.7076721949719],
[1652851800000, 95.70728424026196],
[1652852400000, 95.70713560449511],
[1652853000000, 95.70608378886644],
[1652853600000, 95.70571699470194],
[1652854200000, 95.7053787331439],
[1652854800000, 95.70507798035916],
[1652855400000, 95.7047728589457],
[1652856000000, 95.70466903575333],
[1652856600000, 95.70684645588047],
[1652857200000, 95.70642959313503],
[1652857800000, 95.7059886005418],
[1652858400000, 95.70564102151778],
[1652859000000, 95.7052143634876],
[1652859600000, 95.70481531655625],
[1652860200000, 95.70184478553357],
[1652860800000, 95.70422326497241],
[1652861400000, 95.70614180971687],
[1652862000000, 95.69483139578237],
[1652862600000, 95.7020209300095],
[1652863200000, 95.70591068195267],
[1652863800000, 95.69858353592026],
[1652864400000, 95.77908405290943],
[1652865000000, 95.78250885306112],
[1652865600000, 95.77758496478371],
[1652866200000, 95.7880901858338],
[1652866800000, 95.78758775939893],
[1652867400000, 95.78718434383885],
[1652868000000, 95.78696389873708],
[1652868600000, 95.78002815453577],
[1652869200000, 95.76165356554101],
[1652869800000, 95.76204885818204],
[1652870400000, 95.7750606823607],
[1652871000000, 95.77430787889125],
[1652871600000, 95.77591969811637],
[1652872200000, 95.7761880616146],
[1652872800000, 95.77583502180464],
[1652873400000, 95.77546041189031],
[1652874000000, 95.77511013660323],
[1652874600000, 95.74574605723672],
[1652875200000, 95.73313795578734],
[1652875800000, 95.75163834763781],
[1652876400000, 95.7390761167902],
[1652877000000, 95.73573370624612],
[1652877600000, 95.79733928960185],
[1652878200000, 95.79864206247362],
[1652878800000, 95.76444962445343],
[1652879400000, 95.77120086235038],
[1652923200000, 95.74306955540608],
[1652923800000, 95.7423981517768],
[1652924400000, 95.77209581690342],
[1652925000000, 95.76469341441502],
],
bucket_size: "600s",
metric: {
group: "c9tm3tlath24js45edq0",
title: "",
label: "c8i18q5ath2blrusdjpg-LENOVO",
description: "",
metricAgg: "",
field: "",
formatType: "num",
format: "",
tickFormat: "0,0.[00]",
units: "",
hasCalculation: false,
isDerivative: false,
},
color: "",
type: "",
},
{
timeRange: {
min: 0,
max: 0,
},
data: [
[1652839800000, 95.70319250749945],
[1652840400000, 95.70284407522763],
[1652841000000, 95.70281066204377],
[1652841600000, 95.70469760248969],
[1652842200000, 95.70100498491836],
[1652842800000, 95.70083095649696],
[1652843400000, 95.70046296778555],
[1652844000000, 95.70011576419056],
[1652844600000, 95.6997285944686],
[1652845200000, 95.69931719250908],
[1652845800000, 95.69910449489737],
[1652846400000, 95.70098928515883],
[1652847000000, 95.7006149824137],
[1652847600000, 95.6996553858073],
[1652848200000, 95.6998578103155],
[1652848800000, 95.69968340646507],
[1652849400000, 95.69940261967888],
[1652850000000, 95.69906179837743],
[1652850600000, 95.698855585449],
[1652851200000, 95.7076721949719],
[1652851800000, 95.70728424026196],
[1652852400000, 95.70713560449511],
[1652853000000, 95.70608378886644],
[1652853600000, 95.70571699470194],
[1652854200000, 95.7053787331439],
[1652854800000, 95.70507798035916],
[1652855400000, 95.7047728589457],
[1652856000000, 95.70466903575333],
[1652856600000, 95.70684645588047],
[1652857200000, 95.70642959313503],
[1652857800000, 95.7059886005418],
[1652858400000, 95.70564102151778],
[1652859000000, 95.7052143634876],
[1652859600000, 95.70481640871343],
[1652860200000, 95.70184478553357],
[1652860800000, 95.70422326497241],
[1652861400000, 95.70614180971687],
[1652862000000, 95.69483139578237],
[1652862600000, 95.70202147608809],
[1652863200000, 95.70591068195267],
[1652863800000, 95.6985884506276],
[1652864400000, 95.77908487202733],
[1652865000000, 95.78250885306112],
[1652865600000, 95.77759506723767],
[1652866200000, 95.7880901858338],
[1652866800000, 95.78758775939893],
[1652867400000, 95.78718434383885],
[1652868000000, 95.78696389873708],
[1652868600000, 95.78002832518531],
[1652869200000, 95.76165714918177],
[1652869800000, 95.76204940426064],
[1652870400000, 95.7750606823607],
[1652871000000, 95.77430787889125],
[1652871600000, 95.77591969811637],
[1652872200000, 95.7761880616146],
[1652872800000, 95.77583502180464],
[1652873400000, 95.77546041189031],
[1652874000000, 95.77511013660323],
[1652874600000, 95.74574547702821],
[1652875200000, 95.73313860425567],
[1652875800000, 95.75163834763781],
[1652876400000, 95.73905853988552],
[1652877000000, 95.73573370624612],
[1652877600000, 95.79733928960185],
[1652878200000, 95.79864315463081],
[1652878800000, 95.76444962445343],
[1652879400000, 95.77120086235038],
[1652923200000, 95.74306955540608],
[1652923800000, 95.7423981517768],
[1652924400000, 95.77210127768933],
[1652925000000, 95.76469703218568],
],
bucket_size: "600s",
metric: {
group: "c9tm3tlath24js45edq0",
title: "",
label: "c8i18q5ath2blrusdjpg-node-714-1",
description: "",
metricAgg: "",
field: "",
formatType: "num",
format: "",
tickFormat: "0,0.[00]",
units: "",
hasCalculation: false,
isDerivative: false,
},
color: "",
type: "",
},
{
timeRange: {
min: 0,
max: 0,
},
data: [
[1652839800000, 95.70319250749945],
[1652840400000, 95.70284407522763],
[1652841000000, 95.70281042313438],
[1652841600000, 95.7046973294504],
[1652842200000, 95.70100498491836],
[1652842800000, 95.70083095649696],
[1652843400000, 95.70046296778555],
[1652844000000, 95.70011521811197],
[1652844600000, 95.6997285944686],
[1652845200000, 95.69931719250908],
[1652845800000, 95.69910449489737],
[1652846400000, 95.70098928515883],
[1652847000000, 95.7006149824137],
[1652847600000, 95.6996553858073],
[1652848200000, 95.6998578103155],
[1652848800000, 95.69968340646507],
[1652849400000, 95.69940261967888],
[1652850000000, 95.69906179837743],
[1652850600000, 95.698855585449],
[1652851200000, 95.7076721949719],
[1652851800000, 95.70728424026196],
[1652852400000, 95.70713560449511],
[1652853000000, 95.70608378886644],
[1652853600000, 95.70571699470194],
[1652854200000, 95.7053787331439],
[1652854800000, 95.70507798035916],
[1652855400000, 95.7047728589457],
[1652856000000, 95.70466903575333],
[1652856600000, 95.70684645588047],
[1652857200000, 95.70642959313503],
[1652857800000, 95.7059886005418],
[1652858400000, 95.70564102151778],
[1652859000000, 95.7052143634876],
[1652859600000, 95.70481586263485],
[1652860200000, 95.70184478553357],
[1652860800000, 95.70422326497241],
[1652861400000, 95.70614180971687],
[1652862000000, 95.69483139578237],
[1652862600000, 95.70202120304879],
[1652863200000, 95.70591068195267],
[1652863800000, 95.69858353592026],
[1652864400000, 95.77908405290943],
[1652865000000, 95.78250885306112],
[1652865600000, 95.77758496478371],
[1652866200000, 95.7880901858338],
[1652866800000, 95.78758775939893],
[1652867400000, 95.78718434383885],
[1652868000000, 95.78696389873708],
[1652868600000, 95.78002815453577],
[1652869200000, 95.76164551088176],
[1652869800000, 95.76204831210345],
[1652870400000, 95.7750606823607],
[1652871000000, 95.77430787889125],
[1652871600000, 95.77591969811637],
[1652872200000, 95.7761880616146],
[1652872800000, 95.77583502180464],
[1652873400000, 95.77546041189031],
[1652874000000, 95.77511013660323],
[1652874600000, 95.7457423029464],
[1652875200000, 95.73313792165743],
[1652875800000, 95.75163834763781],
[1652876400000, 95.73923086181131],
[1652877000000, 95.73573370624612],
[1652877600000, 95.79733928960185],
[1652878200000, 95.79864206247362],
[1652878800000, 95.76444962445343],
[1652879400000, 95.77120086235038],
[1652923200000, 95.74306955540608],
[1652923800000, 95.7423981517768],
[1652924400000, 95.77209581690342],
[1652925000000, 95.76469450657218],
],
bucket_size: "600s",
metric: {
group: "c9tm3tlath24js45edq0",
title: "",
label: "c8i18q5ath2blrusdjpg-node-714-2",
description: "",
metricAgg: "",
field: "",
formatType: "num",
format: "",
tickFormat: "0,0.[00]",
units: "",
hasCalculation: false,
isDerivative: false,
},
color: "",
type: "",
},
{
timeRange: {
min: 0,
max: 0,
},
data: [
[1652839800000, 95.70319738807687],
[1652840400000, 95.70284407522763],
[1652841000000, 95.70281066204377],
[1652841600000, 95.7046973294504],
[1652842200000, 95.70100498491836],
[1652842800000, 95.70083095649696],
[1652843400000, 95.70046296778555],
[1652844000000, 95.70011576419056],
[1652844600000, 95.6997285944686],
[1652845200000, 95.69931719250908],
[1652845800000, 95.69910449489737],
[1652846400000, 95.70098928515883],
[1652847000000, 95.7006149824137],
[1652847600000, 95.6996553858073],
[1652848200000, 95.6998578103155],
[1652848800000, 95.69968340646507],
[1652849400000, 95.69940261967888],
[1652850000000, 95.69906179837743],
[1652850600000, 95.698855585449],
[1652851200000, 95.7076721949719],
[1652851800000, 95.70728424026196],
[1652852400000, 95.70713560449511],
[1652853000000, 95.70608378886644],
[1652853600000, 95.70571699470194],
[1652854200000, 95.7053787331439],
[1652854800000, 95.70507798035916],
[1652855400000, 95.7047728589457],
[1652856000000, 95.70466903575333],
[1652856600000, 95.70684645588047],
[1652857200000, 95.70642959313503],
[1652857800000, 95.7059886005418],
[1652858400000, 95.70564102151778],
[1652859000000, 95.7052143634876],
[1652859600000, 95.70481640871343],
[1652860200000, 95.70184478553357],
[1652860800000, 95.70422326497241],
[1652861400000, 95.70614180971687],
[1652862000000, 95.69483139578237],
[1652862600000, 95.70202147608809],
[1652863200000, 95.70591068195267],
[1652863800000, 95.69858565197482],
[1652864400000, 95.77908432594873],
[1652865000000, 95.78250885306112],
[1652865600000, 95.77759042556964],
[1652866200000, 95.7880901858338],
[1652866800000, 95.78758775939893],
[1652867400000, 95.78718434383885],
[1652868000000, 95.78696389873708],
[1652868600000, 95.78002832518531],
[1652869200000, 95.76165714918177],
[1652869800000, 95.76204940426064],
[1652870400000, 95.7750606823607],
[1652871000000, 95.77430787889125],
[1652871600000, 95.77591969811637],
[1652872200000, 95.7761880616146],
[1652872800000, 95.77583502180464],
[1652873400000, 95.77546041189031],
[1652874000000, 95.77511013660323],
[1652874600000, 95.74574387292233],
[1652875200000, 95.73313850186594],
[1652875800000, 95.75163834763781],
[1652876400000, 95.73914697048755],
[1652877000000, 95.73573370624612],
[1652877600000, 95.79733928960185],
[1652878200000, 95.79864315463081],
[1652878800000, 95.76430689316136],
[1652879400000, 95.77120086235038],
[1652923200000, 95.74306955540608],
[1652923800000, 95.7423981517768],
[1652924400000, 95.772096362982],
[1652925000000, 95.76469641784728],
],
bucket_size: "600s",
metric: {
group: "c9tm3tlath24js45edq0",
title: "",
label: "c8i18q5ath2blrusdjpg-node-714-3",
description: "",
metricAgg: "",
field: "",
formatType: "num",
format: "",
tickFormat: "0,0.[00]",
units: "",
hasCalculation: false,
isDerivative: false,
},
color: "",
type: "",
},
{
timeRange: {
min: 0,
max: 0,
},
data: [
[1652839800000, 95.70319728568714],
[1652840400000, 95.7028386144417],
[1652841000000, 95.70281062791385],
[1652841600000, 95.70469760248969],
[1652842200000, 95.70101153786148],
[1652842800000, 95.70083095649696],
[1652843400000, 95.70046296778555],
[1652844000000, 95.70011740242633],
[1652844600000, 95.69972815077973],
[1652845200000, 95.69931650991083],
[1652845800000, 95.69910446076744],
[1652846400000, 95.70098921689902],
[1652847000000, 95.7006149824137],
[1652847600000, 95.6996488328642],
[1652848200000, 95.69985132563221],
[1652848800000, 95.69968333820525],
[1652849400000, 95.69940224424984],
[1652850000000, 95.69906333422347],
[1652850600000, 95.698855585449],
[1652851200000, 95.7076721949719],
[1652851800000, 95.70728424026196],
[1652852400000, 95.70714157722972],
[1652853000000, 95.70608378886644],
[1652853600000, 95.70571825750869],
[1652854200000, 95.7053787331439],
[1652854800000, 95.70507798035916],
[1652855400000, 95.7047728589457],
[1652856000000, 95.70466903575333],
[1652856600000, 95.70684645588047],
[1652857200000, 95.70642959313503],
[1652857800000, 95.7059886005418],
[1652858400000, 95.70564102151778],
[1652859000000, 95.7052143634876],
[1652859600000, 95.70480432672458],
[1652860200000, 95.70184260121918],
[1652860800000, 95.70422326497241],
[1652861400000, 95.70614180971687],
[1652862000000, 95.69478682211728],
[1652862600000, 95.7020072780447],
[1652863200000, 95.70591068195267],
[1652863800000, 95.6985350714452],
[1652864400000, 95.77906224389564],
[1652865000000, 95.78249683933208],
[1652865600000, 95.77771192805643],
[1652866200000, 95.7880901858338],
[1652866800000, 95.78758775939893],
[1652867400000, 95.78718434383885],
[1652868000000, 95.78696389873708],
[1652868600000, 95.77999395636392],
[1652869200000, 95.76169960679232],
[1652869800000, 95.76206254427676],
[1652870400000, 95.77506505098944],
[1652871000000, 95.77431279359858],
[1652871600000, 95.77591969811637],
[1652872200000, 95.7761880616146],
[1652872800000, 95.77583502180464],
[1652873400000, 95.7754652583378],
[1652874000000, 95.77510573384457],
[1652874600000, 95.74555533928833],
[1652875200000, 95.73296484887356],
[1652875800000, 95.75158165785395],
[1652876400000, 95.73868331563274],
[1652877000000, 95.73571189723235],
[1652877600000, 95.79734130326666],
[1652878200000, 95.7986278644302],
[1652878800000, 95.76433092061943],
[1652879400000, 95.77120086235038],
[1652923200000, 95.74306573285594],
[1652923800000, 95.7423981517768],
[1652924400000, 95.7720398779776],
[1652925000000, 95.7645965878546],
],
bucket_size: "600s",
metric: {
group: "c9tm3tlath24js45edq0",
title: "",
label: "c8in3llath2dpdt4md7g-LENOVO",
description: "",
metricAgg: "",
field: "",
formatType: "num",
format: "",
tickFormat: "0,0.[00]",
units: "",
hasCalculation: false,
isDerivative: false,
},
color: "",
type: "",
},
{
timeRange: {
min: 0,
max: 0,
},
data: [
[1652839800000, 71.21477962026893],
[1652840400000, 71.16964028920393],
[1652841000000, 71.1578523840598],
[1652841600000, 71.1183727708089],
[1652842200000, 71.09917657719251],
[1652842800000, 71.08703199639422],
[1652843400000, 71.06526208694963],
[1652844000000, 71.05339596705241],
[1652844600000, 71.16389252860492],
[1652845200000, 71.14500468948633],
[1652845800000, 71.1262646803461],
[1652846400000, 71.11502468797494],
[1652847000000, 71.10197715675483],
[1652847600000, 71.07568717168384],
[1652848200000, 71.05705076637886],
[1652848800000, 71.04909128912304],
[1652849400000, 71.042682183884],
[1652850000000, 71.0375089536441],
[1652850600000, 71.10193825412894],
[1652851200000, 71.10399190327428],
[1652851800000, 71.07456513805309],
[1652852400000, 71.08885714380017],
[1652853000000, 71.08762863982489],
[1652853600000, 71.07505408263526],
[1652854200000, 71.06497789303002],
[1652854800000, 71.05674691639564],
[1652855400000, 71.04382018806643],
[1652856000000, 71.037629756535],
[1652856600000, 71.091979591404],
[1652857200000, 71.08162862640962],
[1652857800000, 71.03000647986707],
[1652858400000, 71.00039707705488],
[1652859000000, 70.97536876556653],
[1652859600000, 70.94846862352117],
[1652860200000, 70.95646986991215],
[1652860800000, 70.94959925667975],
[1652861400000, 71.02472227476807],
[1652862000000, 71.00958464878467],
[1652862600000, 70.99570419186932],
[1652863200000, 70.9906611830508],
[1652863800000, 70.97267752285802],
[1652864400000, 70.94326918519646],
[1652865000000, 70.92997881969056],
[1652865600000, 70.89176415603288],
[1652866200000, 70.93876303261514],
[1652866800000, 70.90104755107274],
[1652867400000, 70.88125717103364],
[1652868000000, 70.8444581534568],
[1652868600000, 70.83116819745223],
[1652869200000, 70.80695233659286],
[1652869800000, 70.78930037247339],
[1652870400000, 70.77797110881338],
[1652871000000, 70.76931670780885],
[1652871600000, 70.75563854454809],
[1652872200000, 70.79371930127247],
[1652872800000, 70.77357429308584],
[1652873400000, 70.76413774455041],
[1652874000000, 70.75818318578223],
[1652874600000, 70.74528143703385],
[1652875200000, 70.71781618315985],
[1652875800000, 70.71648079933873],
[1652876400000, 70.73753653847236],
[1652877000000, 70.67878456435861],
[1652877600000, 70.6670539894],
[1652878200000, 70.64977139547577],
[1652878800000, 70.63461165642082],
[1652879400000, 70.67952944726895],
[1652883000000, 70.67775057351274],
[1652923200000, 70.66969076843228],
[1652923800000, 70.64448022885423],
[1652924400000, 70.42178480874081],
[1652925000000, 70.30421943531454],
],
bucket_size: "600s",
metric: {
group: "c9tm3tlath24js45edq0",
title: "",
label: "c8i18llath2blrusdjng-liugqdeMacBook-Pro.local",
description: "",
metricAgg: "",
field: "",
formatType: "num",
format: "",
tickFormat: "0,0.[00]",
units: "",
hasCalculation: false,
isDerivative: false,
},
color: "",
type: "",
},
{
timeRange: {
min: 0,
max: 0,
},
data: [
[1652839800000, 95.70319738807687],
[1652840400000, 95.70284407522763],
[1652841000000, 95.70281086682324],
[1652841600000, 95.70469760248969],
[1652842200000, 95.70102628198346],
[1652842800000, 95.70083095649696],
[1652843400000, 95.70046296778555],
[1652844000000, 95.70011767546563],
[1652844600000, 95.69972763883105],
[1652845200000, 95.69931647578093],
[1652845800000, 95.69910446076744],
[1652846400000, 95.70098631585648],
[1652847000000, 95.7006149824137],
[1652847600000, 95.69965374757152],
[1652848200000, 95.6998578103155],
[1652848800000, 95.69968340646507],
[1652849400000, 95.69940261967888],
[1652850000000, 95.69906179837743],
[1652850600000, 95.698855585449],
[1652851200000, 95.7076721949719],
[1652851800000, 95.70728424026196],
[1652852400000, 95.7071451950004],
[1652853000000, 95.70607815743095],
[1652853600000, 95.70571699470194],
[1652854200000, 95.7053787331439],
[1652854800000, 95.70507798035916],
[1652855400000, 95.7047728589457],
[1652856000000, 95.70466903575333],
[1652856600000, 95.70684645588047],
[1652857200000, 95.70642959313503],
[1652857800000, 95.7059886005418],
[1652858400000, 95.70564091912804],
[1652859000000, 95.7052143634876],
[1652859600000, 95.7047865109105],
[1652860200000, 95.70183932474764],
[1652860800000, 95.70422326497241],
[1652861400000, 95.70614180971687],
[1652862000000, 95.69475757278268],
[1652862600000, 95.70199007656903],
[1652863200000, 95.70591068195267],
[1652863800000, 95.69848449091558],
[1652864400000, 95.779079172332],
[1652865000000, 95.78250503051098],
[1652865600000, 95.77764650101508],
[1652866200000, 95.7880901858338],
[1652866800000, 95.78758775939893],
[1652867400000, 95.78718434383885],
[1652868000000, 95.78696389873708],
[1652868600000, 95.77996197663636],
[1652869200000, 95.7616742823976],
[1652869800000, 95.7620467762574],
[1652870400000, 95.77505795196774],
[1652871000000, 95.77431825438451],
[1652871600000, 95.77591969811637],
[1652872200000, 95.7761880616146],
[1652872800000, 95.77583502180464],
[1652873400000, 95.7754652583378],
[1652874000000, 95.77507679167918],
[1652874600000, 95.7460492332452],
[1652875200000, 95.73297140181668],
[1652875800000, 95.75158537801435],
[1652876400000, 95.73880232663596],
[1652877000000, 95.73565602656636],
[1652877600000, 95.79734249781357],
[1652878200000, 95.79863660168769],
[1652878800000, 95.7642865517338],
[1652879400000, 95.77120086235038],
[1652923200000, 95.74307566466034],
[1652923800000, 95.74239924393399],
[1652924400000, 95.77207298399226],
[1652925000000, 95.76465921624316],
],
bucket_size: "600s",
metric: {
group: "c9tm3tlath24js45edq0",
title: "",
label: "c8i18t5ath2blrusdjtg-0NSvaoO",
description: "",
metricAgg: "",
field: "",
formatType: "num",
format: "",
tickFormat: "0,0.[00]",
units: "",
hasCalculation: false,
isDerivative: false,
},
color: "",
type: "",
},
],
group: "c9tm3tlath24js45edq0",
order: 0,
},
});
},
//规则详情info
"GET /alerting/rule/:rule_id/info": function(req, res) {
res.send({
conditions: {
operator: "any",
items: [
{
minimum_period_match: 1,
operator: "gte",
values: ["1"],
severity: "warning",
expression:
"avg(payload.elasticsearch.cluster_stats.indices.count) >= 1",
},
],
},
enabled: false,
period_interval: "1m",
resource_name: "lsy_cluster_1",
resource_objects: [".infini_metrics"],
state: "active",
updated: "2022-05-11T16:53:54.055127+08:00",
});
},
};