mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-17 22:02:14 +08:00
开放接口&近期BUG修复
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.xiaojukeji.kafka.manager.monitor.component.n9e;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.monitor.common.entry.MetricSinkPoint;
|
||||
import com.xiaojukeji.kafka.manager.monitor.component.n9e.entry.N9eMetricSinkPoint;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ListUtils;
|
||||
import com.xiaojukeji.kafka.manager.monitor.common.entry.*;
|
||||
import com.xiaojukeji.kafka.manager.monitor.component.n9e.entry.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -27,4 +29,127 @@ public class N9eConverter {
|
||||
}
|
||||
return n9ePointList;
|
||||
}
|
||||
|
||||
public static N9eStrategy convert2N9eStrategy(Strategy strategy, Integer monitorN9eNid) {
|
||||
if (strategy == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
N9eStrategy n9eStrategy = new N9eStrategy();
|
||||
n9eStrategy.setId(strategy.getId().intValue());
|
||||
n9eStrategy.setCategory(1);
|
||||
n9eStrategy.setName(strategy.getName());
|
||||
n9eStrategy.setNid(monitorN9eNid);
|
||||
n9eStrategy.setExcl_nid(new ArrayList<>());
|
||||
n9eStrategy.setPriority(strategy.getPriority());
|
||||
n9eStrategy.setAlert_dur(60);
|
||||
|
||||
List<N9eStrategyExpression> exprs = new ArrayList<>();
|
||||
for (StrategyExpression strategyExpression: strategy.getStrategyExpressionList()) {
|
||||
N9eStrategyExpression n9eStrategyExpression = new N9eStrategyExpression();
|
||||
n9eStrategyExpression.setMetric(strategyExpression.getMetric());
|
||||
n9eStrategyExpression.setFunc(strategyExpression.getFunc());
|
||||
n9eStrategyExpression.setEopt(strategyExpression.getEopt());
|
||||
n9eStrategyExpression.setThreshold(strategyExpression.getThreshold().intValue());
|
||||
n9eStrategyExpression.setParams(ListUtils.string2IntList(strategyExpression.getParams()));
|
||||
exprs.add(n9eStrategyExpression);
|
||||
}
|
||||
n9eStrategy.setExprs(exprs);
|
||||
|
||||
List<N9eStrategyFilter> tags = new ArrayList<>();
|
||||
for (StrategyFilter strategyFilter: strategy.getStrategyFilterList()) {
|
||||
N9eStrategyFilter n9eStrategyFilter = new N9eStrategyFilter();
|
||||
n9eStrategyFilter.setTkey(strategyFilter.getTkey());
|
||||
n9eStrategyFilter.setTopt(strategyFilter.getTopt());
|
||||
n9eStrategyFilter.setTval(Arrays.asList(strategyFilter.getTval()));
|
||||
tags.add(n9eStrategyFilter);
|
||||
}
|
||||
n9eStrategy.setTags(tags);
|
||||
|
||||
n9eStrategy.setRecovery_dur(0);
|
||||
n9eStrategy.setRecovery_notify(0);
|
||||
|
||||
StrategyAction strategyAction = strategy.getStrategyActionList().get(0);
|
||||
n9eStrategy.setConverge(ListUtils.string2IntList(strategyAction.getConverge()));
|
||||
n9eStrategy.setNotify_group(ListUtils.string2StrList(strategyAction.getNotifyGroup()));
|
||||
n9eStrategy.setNotify_user(new ArrayList<>());
|
||||
n9eStrategy.setCallback(strategyAction.getCallback());
|
||||
n9eStrategy.setEnable_stime("00:00");
|
||||
n9eStrategy.setEnable_etime("23:59");
|
||||
n9eStrategy.setEnable_days_of_week(ListUtils.string2IntList(strategy.getPeriodDaysOfWeek()));
|
||||
|
||||
n9eStrategy.setNeed_upgrade(0);
|
||||
n9eStrategy.setAlert_upgrade(new ArrayList<>());
|
||||
return n9eStrategy;
|
||||
}
|
||||
|
||||
public static List<Strategy> convert2StrategyList(List<N9eStrategy> n9eStrategyList) {
|
||||
if (n9eStrategyList == null || n9eStrategyList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<Strategy> strategyList = new ArrayList<>();
|
||||
for (N9eStrategy n9eStrategy: n9eStrategyList) {
|
||||
strategyList.add(convert2Strategy(n9eStrategy));
|
||||
}
|
||||
return strategyList;
|
||||
}
|
||||
|
||||
public static Strategy convert2Strategy(N9eStrategy n9eStrategy) {
|
||||
if (n9eStrategy == null) {
|
||||
return null;
|
||||
}
|
||||
Strategy strategy = new Strategy();
|
||||
strategy.setId(n9eStrategy.getId().longValue());
|
||||
strategy.setName(n9eStrategy.getName());
|
||||
strategy.setPriority(n9eStrategy.getPriority());
|
||||
strategy.setPeriodHoursOfDay("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23");
|
||||
strategy.setPeriodDaysOfWeek(ListUtils.intList2String(n9eStrategy.getEnable_days_of_week()));
|
||||
|
||||
List<StrategyExpression> strategyExpressionList = new ArrayList<>();
|
||||
for (N9eStrategyExpression n9eStrategyExpression: n9eStrategy.getExprs()) {
|
||||
StrategyExpression strategyExpression = new StrategyExpression();
|
||||
strategyExpression.setMetric(n9eStrategyExpression.getMetric());
|
||||
strategyExpression.setFunc(n9eStrategyExpression.getFunc());
|
||||
strategyExpression.setEopt(n9eStrategyExpression.getEopt());
|
||||
strategyExpression.setThreshold(n9eStrategyExpression.getThreshold().longValue());
|
||||
strategyExpression.setParams(ListUtils.intList2String(n9eStrategyExpression.getParams()));
|
||||
strategyExpressionList.add(strategyExpression);
|
||||
}
|
||||
strategy.setStrategyExpressionList(strategyExpressionList);
|
||||
|
||||
List<StrategyFilter> strategyFilterList = new ArrayList<>();
|
||||
for (N9eStrategyFilter n9eStrategyFilter: n9eStrategy.getTags()) {
|
||||
StrategyFilter strategyFilter = new StrategyFilter();
|
||||
strategyFilter.setTkey(n9eStrategyFilter.getTkey());
|
||||
strategyFilter.setTopt(n9eStrategyFilter.getTopt());
|
||||
strategyFilter.setTval(ListUtils.strList2String(n9eStrategyFilter.getTval()));
|
||||
strategyFilterList.add(strategyFilter);
|
||||
}
|
||||
strategy.setStrategyFilterList(strategyFilterList);
|
||||
|
||||
StrategyAction strategyAction = new StrategyAction();
|
||||
strategyAction.setNotifyGroup(ListUtils.strList2String(n9eStrategy.getNotify_group()));
|
||||
strategyAction.setConverge(ListUtils.intList2String(n9eStrategy.getConverge()));
|
||||
strategyAction.setCallback(n9eStrategy.getCallback());
|
||||
strategy.setStrategyActionList(Arrays.asList(strategyAction));
|
||||
|
||||
return strategy;
|
||||
}
|
||||
|
||||
public static List<NotifyGroup> convert2NotifyGroupList(N9eNotifyGroup n9eNotifyGroup) {
|
||||
if (n9eNotifyGroup == null || n9eNotifyGroup.getList() == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<NotifyGroup> notifyGroupList = new ArrayList<>();
|
||||
for (N9eNotifyGroupElem n9eNotifyGroupElem: n9eNotifyGroup.getList()) {
|
||||
NotifyGroup notifyGroup = new NotifyGroup();
|
||||
notifyGroup.setId(n9eNotifyGroupElem.getId().longValue());
|
||||
notifyGroup.setName(n9eNotifyGroupElem.getName());
|
||||
notifyGroup.setComment(n9eNotifyGroupElem.getNote());
|
||||
notifyGroupList.add(notifyGroup);
|
||||
}
|
||||
return notifyGroupList;
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,18 @@ package com.xiaojukeji.kafka.manager.monitor.component.n9e;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.HttpUtils;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import com.xiaojukeji.kafka.manager.monitor.component.AbstractMonitorService;
|
||||
import com.xiaojukeji.kafka.manager.monitor.common.entry.*;
|
||||
import com.xiaojukeji.kafka.manager.monitor.component.n9e.entry.N9eNotifyGroup;
|
||||
import com.xiaojukeji.kafka.manager.monitor.component.n9e.entry.N9eResult;
|
||||
import com.xiaojukeji.kafka.manager.monitor.component.n9e.entry.N9eStrategy;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 夜莺
|
||||
@@ -23,21 +24,28 @@ import java.util.Properties;
|
||||
public class N9eService extends AbstractMonitorService {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(N9eService.class);
|
||||
|
||||
@Value("${monitor.n9e.nid}")
|
||||
private Integer monitorN9eNid;
|
||||
|
||||
@Value("${monitor.n9e.user-token}")
|
||||
private String monitorN9eToken;
|
||||
|
||||
@Value("${monitor.n9e.base-url}")
|
||||
private String monitorN9eBaseUrl;
|
||||
|
||||
/**
|
||||
* 告警策略
|
||||
*/
|
||||
private static final String STRATEGY_ADD_URL = "/auth/v1/strategy/add";
|
||||
private static final String STRATEGY_ADD_URL = "/api/mon/stra";
|
||||
|
||||
private static final String STRATEGY_DEL_URL = "/auth/v1/strategy/del";
|
||||
private static final String STRATEGY_DEL_URL = "/api/mon/stra";
|
||||
|
||||
private static final String STRATEGY_MODIFY_URL = "/auth/v1/strategy/modify";
|
||||
private static final String STRATEGY_MODIFY_URL = "/api/mon/stra";
|
||||
|
||||
private static final String STRATEGY_QUERY_BY_NS_URL = "/auth/v1/strategy/query/ns";
|
||||
private static final String STRATEGY_QUERY_BY_NS_URL = "/api/mon/stra";
|
||||
|
||||
private static final String STRATEGY_QUERY_BY_ID_URL = "/api/mon/stra";
|
||||
|
||||
private static final String STRATEGY_QUERY_BY_ID_URL = "/auth/v1/strategy/query/id";
|
||||
|
||||
private static final String ALERT_QUERY_BY_NS_AND_PERIOD_URL = "/auth/v1/event/query/ns/period";
|
||||
|
||||
@@ -57,41 +65,121 @@ public class N9eService extends AbstractMonitorService {
|
||||
/**
|
||||
* 指标数据
|
||||
*/
|
||||
private static final String COLLECTOR_SINK_DATA_URL = "/api/collector/push";
|
||||
private static final String COLLECTOR_SINK_DATA_URL = "/api/transfer/push";
|
||||
|
||||
private static final String COLLECTOR_DOWNLOAD_DATA_URL = "/data/query/graph/dashboard/history";
|
||||
|
||||
/**
|
||||
* 告警组
|
||||
*/
|
||||
private static final String ALL_NOTIFY_GROUP_URL = "/auth/v1/usergroup/group/all";
|
||||
private static final String ALL_NOTIFY_GROUP_URL = "/api/mon/teams/all";
|
||||
|
||||
/**
|
||||
* 监控策略的增删改查
|
||||
*/
|
||||
@Override
|
||||
public Integer createStrategy(Strategy strategy) {
|
||||
return 0;
|
||||
String response = null;
|
||||
try {
|
||||
response = HttpUtils.postForString(
|
||||
monitorN9eBaseUrl + STRATEGY_ADD_URL,
|
||||
JSON.toJSONString(N9eConverter.convert2N9eStrategy(strategy, monitorN9eNid)),
|
||||
buildHeader()
|
||||
);
|
||||
N9eResult n9eResult = JSON.parseObject(response, N9eResult.class);
|
||||
if (!ValidateUtils.isBlank(n9eResult.getErr())) {
|
||||
LOGGER.error("create strategy failed, strategy:{} response:{}.", strategy, response);
|
||||
return null;
|
||||
}
|
||||
return (Integer) n9eResult.getDat();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("create strategy failed, strategy:{} response:{}.", strategy, response, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteStrategyById(Long strategyId) {
|
||||
return true;
|
||||
Map<String, List<Long>> params = new HashMap<>(1);
|
||||
params.put("ids", Arrays.asList(strategyId));
|
||||
|
||||
String response = null;
|
||||
try {
|
||||
response = HttpUtils.deleteForString(
|
||||
monitorN9eBaseUrl + STRATEGY_DEL_URL,
|
||||
JSON.toJSONString(params),
|
||||
buildHeader()
|
||||
);
|
||||
N9eResult n9eResult = JSON.parseObject(response, N9eResult.class);
|
||||
if (!ValidateUtils.isBlank(n9eResult.getErr())) {
|
||||
LOGGER.error("delete strategy failed, strategyId:{} response:{}.", strategyId, response);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("delete strategy failed, strategyId:{} response:{}.", strategyId, response, e);
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean modifyStrategy(Strategy strategy) {
|
||||
return true;
|
||||
String response = null;
|
||||
try {
|
||||
response = HttpUtils.putForString(
|
||||
monitorN9eBaseUrl + STRATEGY_MODIFY_URL,
|
||||
JSON.toJSONString(N9eConverter.convert2N9eStrategy(strategy, monitorN9eNid)),
|
||||
buildHeader()
|
||||
);
|
||||
N9eResult n9eResult = JSON.parseObject(response, N9eResult.class);
|
||||
if (!ValidateUtils.isBlank(n9eResult.getErr())) {
|
||||
LOGGER.error("modify strategy failed, strategy:{} response:{}.", strategy, response);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("modify strategy failed, strategy:{} response:{}.", strategy, response, e);
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Strategy> getStrategies() {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("nid", String.valueOf(monitorN9eNid));
|
||||
|
||||
String response = null;
|
||||
try {
|
||||
response = HttpUtils.get(monitorN9eBaseUrl + STRATEGY_QUERY_BY_NS_URL, params, buildHeader());
|
||||
N9eResult n9eResult = JSON.parseObject(response, N9eResult.class);
|
||||
if (!ValidateUtils.isBlank(n9eResult.getErr())) {
|
||||
LOGGER.error("get monitor strategies failed, response:{}.", response);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return N9eConverter.convert2StrategyList(JSON.parseArray(JSON.toJSONString(n9eResult.getDat()), N9eStrategy.class));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("get monitor strategies failed, response:{}.", response, e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Strategy getStrategyById(Long strategyId) {
|
||||
return new Strategy();
|
||||
String uri = STRATEGY_QUERY_BY_ID_URL + "/" + String.valueOf(strategyId);
|
||||
|
||||
String response = null;
|
||||
try {
|
||||
response = HttpUtils.get(monitorN9eBaseUrl + uri, new HashMap<>(0), buildHeader());
|
||||
N9eResult n9eResult = JSON.parseObject(response, N9eResult.class);
|
||||
if (!ValidateUtils.isBlank(n9eResult.getErr())) {
|
||||
LOGGER.error("get monitor strategy failed, response:{}.", response);
|
||||
return null;
|
||||
}
|
||||
return N9eConverter.convert2Strategy(JSON.parseObject(JSON.toJSONString(n9eResult.getDat()), N9eStrategy.class));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("get monitor strategy failed, response:{}.", response, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,6 +249,26 @@ public class N9eService extends AbstractMonitorService {
|
||||
|
||||
@Override
|
||||
public List<NotifyGroup> getNotifyGroups() {
|
||||
String response = null;
|
||||
try {
|
||||
response = HttpUtils.get(monitorN9eBaseUrl + ALL_NOTIFY_GROUP_URL, new HashMap<>(0), buildHeader());
|
||||
N9eResult n9eResult = JSON.parseObject(response, N9eResult.class);
|
||||
if (!ValidateUtils.isBlank(n9eResult.getErr())) {
|
||||
LOGGER.error("get notify group failed, response:{}.", response);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return N9eConverter.convert2NotifyGroupList(JSON.parseObject(JSON.toJSONString(n9eResult.getDat()), N9eNotifyGroup.class));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("get notify group failed, response:{}.", response, e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> buildHeader() {
|
||||
Map<String, String> header = new HashMap<>(2);
|
||||
header.put("Content-Type", "application/json");
|
||||
header.put("X-User-Token", monitorN9eToken);
|
||||
return header;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xiaojukeji.kafka.manager.monitor.component.n9e.entry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/10/19
|
||||
*/
|
||||
public class N9eNotifyGroup {
|
||||
private List<N9eNotifyGroupElem> list;
|
||||
|
||||
public List<N9eNotifyGroupElem> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<N9eNotifyGroupElem> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "N9eNotifyGroup{" +
|
||||
"list=" + list +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.xiaojukeji.kafka.manager.monitor.component.n9e.entry;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/10/19
|
||||
*/
|
||||
public class N9eNotifyGroupElem {
|
||||
private Integer creator;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String ident;
|
||||
|
||||
private String last_updated;
|
||||
|
||||
private Integer mgmt;
|
||||
|
||||
private String name;
|
||||
|
||||
private String note;
|
||||
|
||||
public Integer getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(Integer creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIdent() {
|
||||
return ident;
|
||||
}
|
||||
|
||||
public void setIdent(String ident) {
|
||||
this.ident = ident;
|
||||
}
|
||||
|
||||
public String getLast_updated() {
|
||||
return last_updated;
|
||||
}
|
||||
|
||||
public void setLast_updated(String last_updated) {
|
||||
this.last_updated = last_updated;
|
||||
}
|
||||
|
||||
public Integer getMgmt() {
|
||||
return mgmt;
|
||||
}
|
||||
|
||||
public void setMgmt(Integer mgmt) {
|
||||
this.mgmt = mgmt;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "N9eNotifyGroupElem{" +
|
||||
"creator=" + creator +
|
||||
", id=" + id +
|
||||
", ident='" + ident + '\'' +
|
||||
", last_updated='" + last_updated + '\'' +
|
||||
", mgmt=" + mgmt +
|
||||
", name='" + name + '\'' +
|
||||
", note='" + note + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.xiaojukeji.kafka.manager.monitor.component.n9e.entry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/10/18
|
||||
*/
|
||||
public class N9eStrategy {
|
||||
private Integer id;
|
||||
|
||||
private Integer category = 1;
|
||||
|
||||
/**
|
||||
* 策略名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 策略关联的对象树节点id
|
||||
*/
|
||||
private Integer nid;
|
||||
|
||||
private List<Integer> excl_nid = new ArrayList<>();
|
||||
|
||||
private Integer priority;
|
||||
|
||||
private Integer alert_dur = 60;
|
||||
|
||||
private List<N9eStrategyExpression> exprs;
|
||||
|
||||
private List<N9eStrategyFilter> tags;
|
||||
|
||||
private Integer recovery_dur;
|
||||
|
||||
private Integer recovery_notify;
|
||||
|
||||
private List<N9eStrategyAlertUpgrade> alert_upgrade = new ArrayList<>();
|
||||
|
||||
private List<Integer> converge;
|
||||
|
||||
private List<String> notify_group;
|
||||
|
||||
private List<Integer> notify_user;
|
||||
|
||||
private String callback;
|
||||
|
||||
private String enable_stime;
|
||||
|
||||
private String enable_etime;
|
||||
|
||||
private List<Integer> enable_days_of_week;
|
||||
|
||||
private Integer need_upgrade;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(Integer category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getNid() {
|
||||
return nid;
|
||||
}
|
||||
|
||||
public void setNid(Integer nid) {
|
||||
this.nid = nid;
|
||||
}
|
||||
|
||||
public List<Integer> getExcl_nid() {
|
||||
return excl_nid;
|
||||
}
|
||||
|
||||
public void setExcl_nid(List<Integer> excl_nid) {
|
||||
this.excl_nid = excl_nid;
|
||||
}
|
||||
|
||||
public Integer getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setPriority(Integer priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public Integer getAlert_dur() {
|
||||
return alert_dur;
|
||||
}
|
||||
|
||||
public void setAlert_dur(Integer alert_dur) {
|
||||
this.alert_dur = alert_dur;
|
||||
}
|
||||
|
||||
public List<N9eStrategyExpression> getExprs() {
|
||||
return exprs;
|
||||
}
|
||||
|
||||
public void setExprs(List<N9eStrategyExpression> exprs) {
|
||||
this.exprs = exprs;
|
||||
}
|
||||
|
||||
public List<N9eStrategyFilter> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(List<N9eStrategyFilter> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public Integer getRecovery_dur() {
|
||||
return recovery_dur;
|
||||
}
|
||||
|
||||
public void setRecovery_dur(Integer recovery_dur) {
|
||||
this.recovery_dur = recovery_dur;
|
||||
}
|
||||
|
||||
public Integer getRecovery_notify() {
|
||||
return recovery_notify;
|
||||
}
|
||||
|
||||
public void setRecovery_notify(Integer recovery_notify) {
|
||||
this.recovery_notify = recovery_notify;
|
||||
}
|
||||
|
||||
public List<N9eStrategyAlertUpgrade> getAlert_upgrade() {
|
||||
return alert_upgrade;
|
||||
}
|
||||
|
||||
public void setAlert_upgrade(List<N9eStrategyAlertUpgrade> alert_upgrade) {
|
||||
this.alert_upgrade = alert_upgrade;
|
||||
}
|
||||
|
||||
public List<Integer> getConverge() {
|
||||
return converge;
|
||||
}
|
||||
|
||||
public void setConverge(List<Integer> converge) {
|
||||
this.converge = converge;
|
||||
}
|
||||
|
||||
public List<String> getNotify_group() {
|
||||
return notify_group;
|
||||
}
|
||||
|
||||
public void setNotify_group(List<String> notify_group) {
|
||||
this.notify_group = notify_group;
|
||||
}
|
||||
|
||||
public List<Integer> getNotify_user() {
|
||||
return notify_user;
|
||||
}
|
||||
|
||||
public void setNotify_user(List<Integer> notify_user) {
|
||||
this.notify_user = notify_user;
|
||||
}
|
||||
|
||||
public String getCallback() {
|
||||
return callback;
|
||||
}
|
||||
|
||||
public void setCallback(String callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public String getEnable_stime() {
|
||||
return enable_stime;
|
||||
}
|
||||
|
||||
public void setEnable_stime(String enable_stime) {
|
||||
this.enable_stime = enable_stime;
|
||||
}
|
||||
|
||||
public String getEnable_etime() {
|
||||
return enable_etime;
|
||||
}
|
||||
|
||||
public void setEnable_etime(String enable_etime) {
|
||||
this.enable_etime = enable_etime;
|
||||
}
|
||||
|
||||
public List<Integer> getEnable_days_of_week() {
|
||||
return enable_days_of_week;
|
||||
}
|
||||
|
||||
public void setEnable_days_of_week(List<Integer> enable_days_of_week) {
|
||||
this.enable_days_of_week = enable_days_of_week;
|
||||
}
|
||||
|
||||
public Integer getNeed_upgrade() {
|
||||
return need_upgrade;
|
||||
}
|
||||
|
||||
public void setNeed_upgrade(Integer need_upgrade) {
|
||||
this.need_upgrade = need_upgrade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "N9eStrategy{" +
|
||||
"id=" + id +
|
||||
", category=" + category +
|
||||
", name='" + name + '\'' +
|
||||
", nid=" + nid +
|
||||
", excl_nid=" + excl_nid +
|
||||
", priority=" + priority +
|
||||
", alert_dur=" + alert_dur +
|
||||
", exprs=" + exprs +
|
||||
", tags=" + tags +
|
||||
", recovery_dur=" + recovery_dur +
|
||||
", recovery_notify=" + recovery_notify +
|
||||
", alert_upgrade=" + alert_upgrade +
|
||||
", converge=" + converge +
|
||||
", notify_group=" + notify_group +
|
||||
", notify_user=" + notify_user +
|
||||
", callback='" + callback + '\'' +
|
||||
", enable_stime='" + enable_stime + '\'' +
|
||||
", enable_etime='" + enable_etime + '\'' +
|
||||
", enable_days_of_week=" + enable_days_of_week +
|
||||
", need_upgrade=" + need_upgrade +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.xiaojukeji.kafka.manager.monitor.component.n9e.entry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/10/19
|
||||
*/
|
||||
public class N9eStrategyAlertUpgrade {
|
||||
private Integer duration;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private List<Integer> users;
|
||||
|
||||
private List<String> groups;
|
||||
|
||||
public Integer getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Integer duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public List<Integer> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<Integer> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public List<String> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void setGroups(List<String> groups) {
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "N9eStrategyAlertUpgrade{" +
|
||||
"duration=" + duration +
|
||||
", level=" + level +
|
||||
", users=" + users +
|
||||
", groups=" + groups +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.xiaojukeji.kafka.manager.monitor.component.n9e.entry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/10/18
|
||||
*/
|
||||
public class N9eStrategyExpression {
|
||||
private String metric;
|
||||
|
||||
private String func;
|
||||
|
||||
private String eopt;
|
||||
|
||||
private Integer threshold;
|
||||
|
||||
private List<Integer> params;
|
||||
|
||||
public String getMetric() {
|
||||
return metric;
|
||||
}
|
||||
|
||||
public void setMetric(String metric) {
|
||||
this.metric = metric;
|
||||
}
|
||||
|
||||
public String getFunc() {
|
||||
return func;
|
||||
}
|
||||
|
||||
public void setFunc(String func) {
|
||||
this.func = func;
|
||||
}
|
||||
|
||||
public String getEopt() {
|
||||
return eopt;
|
||||
}
|
||||
|
||||
public void setEopt(String eopt) {
|
||||
this.eopt = eopt;
|
||||
}
|
||||
|
||||
public Integer getThreshold() {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
public void setThreshold(Integer threshold) {
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
public List<Integer> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(List<Integer> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "N9eStrategyExpression{" +
|
||||
"metric='" + metric + '\'' +
|
||||
", func='" + func + '\'' +
|
||||
", eopt='" + eopt + '\'' +
|
||||
", threshold=" + threshold +
|
||||
", params=" + params +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.xiaojukeji.kafka.manager.monitor.component.n9e.entry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/10/18
|
||||
*/
|
||||
public class N9eStrategyFilter {
|
||||
private String topt;
|
||||
|
||||
private String tkey;
|
||||
|
||||
private List<String> tval;
|
||||
|
||||
public String getTopt() {
|
||||
return topt;
|
||||
}
|
||||
|
||||
public void setTopt(String topt) {
|
||||
this.topt = topt;
|
||||
}
|
||||
|
||||
public String getTkey() {
|
||||
return tkey;
|
||||
}
|
||||
|
||||
public void setTkey(String tkey) {
|
||||
this.tkey = tkey;
|
||||
}
|
||||
|
||||
public List<String> getTval() {
|
||||
return tval;
|
||||
}
|
||||
|
||||
public void setTval(List<String> tval) {
|
||||
this.tval = tval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "N9eStrategyFilter{" +
|
||||
"topt='" + topt + '\'' +
|
||||
", tkey='" + tkey + '\'' +
|
||||
", tval=" + tval +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
monitor:
|
||||
n9e:
|
||||
base-url: http://127.0.0.1/api
|
||||
Reference in New Issue
Block a user