feat: Alarm and receiving Chinese and English support #huacheng
This commit is contained in:
@@ -23,7 +23,8 @@ import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY;
|
||||
import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
||||
|
||||
/**
|
||||
* 告警记录
|
||||
* Alarm record entity 告警记录实体
|
||||
*
|
||||
* @author tom
|
||||
* @date 2021/12/9 15:37
|
||||
*/
|
||||
@@ -33,52 +34,68 @@ import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel(description = "告警记录实体")
|
||||
@ApiModel(description = "en: Alarm record entity zh: 告警记录实体")
|
||||
public class Alert {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@ApiModelProperty(value = "告警记录实体主键索引ID", example = "87584674384", accessMode = READ_ONLY, position = 0)
|
||||
@ApiModelProperty(value = "Alarm record entity primary key index ID",
|
||||
notes = "告警记录实体主键索引ID",
|
||||
example = "87584674384", accessMode = READ_ONLY, position = 0)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "告警目标对象: 监控可用性-available 指标-app.metrics.field",
|
||||
@ApiModelProperty(value = "Alert target object: monitor availability-available metrics-app.metrics.field",
|
||||
notes = "告警目标对象: 监控可用性-available 指标-app.metrics.field",
|
||||
example = "1", accessMode = READ_WRITE, position = 1)
|
||||
@Length(max = 255)
|
||||
private String target;
|
||||
|
||||
@ApiModelProperty(value = "告警对象关联的监控ID", example = "87432674336", accessMode = READ_WRITE, position = 2)
|
||||
@ApiModelProperty(value = "Monitoring ID associated with the alarm object",
|
||||
notes = "告警对象关联的监控ID",
|
||||
example = "87432674336", accessMode = READ_WRITE, position = 2)
|
||||
private Long monitorId;
|
||||
|
||||
@ApiModelProperty(value = "告警对象关联的监控名称", example = "Linux_192.132.23.1",
|
||||
accessMode = READ_WRITE, position = 3)
|
||||
@ApiModelProperty(value = "Monitoring name associated with the alarm object",
|
||||
notes = "告警对象关联的监控名称",
|
||||
example = "Linux_192.132.23.1", accessMode = READ_WRITE, position = 3)
|
||||
private String monitorName;
|
||||
|
||||
@ApiModelProperty(value = "告警关联的告警定义ID", example = "8743267443543", accessMode = READ_WRITE, position = 4)
|
||||
@ApiModelProperty(value = "Alarm definition ID associated with the alarm",
|
||||
notes = "告警关联的告警定义ID",
|
||||
example = "8743267443543", accessMode = READ_WRITE, position = 4)
|
||||
private Long alertDefineId;
|
||||
|
||||
@ApiModelProperty(value = "告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色",
|
||||
@ApiModelProperty(value = "Alarm level 0: high-emergency-critical alarm-red 1: medium-critical-critical alarm-orange 2: low-warning-warning alarm-yellow",
|
||||
notes = "告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色",
|
||||
example = "1", accessMode = READ_WRITE, position = 5)
|
||||
@Min(0)
|
||||
@Max(2)
|
||||
private byte priority;
|
||||
|
||||
@ApiModelProperty(value = "告警通知实际内容", example = "linux_192.134.32.1: 534543534 cpu usage high",
|
||||
@ApiModelProperty(value = "The actual content of the alarm notification",
|
||||
notes = "告警通知实际内容",
|
||||
example = "linux_192.134.32.1: 534543534 cpu usage high",
|
||||
accessMode = READ_WRITE, position = 6)
|
||||
@Length(max = 1024)
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "告警状态: 0-正常告警(待处理) 1-阈值触发但未达到告警次数 2-恢复告警 3-已处理",
|
||||
@ApiModelProperty(value = "Alarm status: 0-normal alarm (to be processed) 1-threshold triggered but not reached the number of alarms 2-recovered alarm 3-processed",
|
||||
notes = "告警状态: 0-正常告警(待处理) 1-阈值触发但未达到告警次数 2-恢复告警 3-已处理",
|
||||
example = "1", accessMode = READ_WRITE, position = 7)
|
||||
@Min(0)
|
||||
@Max(2)
|
||||
private byte status;
|
||||
|
||||
@ApiModelProperty(value = "告警阈值触发次数", example = "3", accessMode = READ_WRITE, position = 8)
|
||||
@ApiModelProperty(value = "Alarm threshold trigger times",
|
||||
notes = "告警阈值触发次数",
|
||||
example = "3", accessMode = READ_WRITE, position = 8)
|
||||
@Min(0)
|
||||
@Max(10)
|
||||
private int times;
|
||||
|
||||
@ApiModelProperty(value = "告警触发时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 9)
|
||||
@ApiModelProperty(value = "Alarm trigger time (timestamp in milliseconds)",
|
||||
notes = "告警触发时间(毫秒时间戳)",
|
||||
example = "1612198922000", accessMode = READ_ONLY, position = 9)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@ import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY;
|
||||
import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
||||
|
||||
/**
|
||||
* Message notification recipient entity
|
||||
* 消息通知接收人实体
|
||||
*
|
||||
* @author tomsun28
|
||||
* @date 2021/11/13 22:19
|
||||
*/
|
||||
@@ -33,56 +35,80 @@ import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel(description = "消息通知接收人实体")
|
||||
@ApiModel(description = "en: Message notification recipient entity,zh:消息通知接收人实体")
|
||||
public class NoticeReceiver {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@ApiModelProperty(value = "接收人实体主键索引ID", example = "87584674384", accessMode = READ_ONLY, position = 0)
|
||||
@ApiModelProperty(value = "Recipient entity primary key index ID",
|
||||
notes = "接收人实体主键索引ID",
|
||||
example = "87584674384", accessMode = READ_ONLY, position = 0)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "接收人名称", example = "tom", accessMode = READ_WRITE, position = 1)
|
||||
@ApiModelProperty(value = "Recipient name",
|
||||
notes = "接收人名称",
|
||||
example = "tom", accessMode = READ_WRITE, position = 1)
|
||||
@Length(max = 100)
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "通知信息方式: 0-手机短信 1-邮箱 2-webhook 3-微信公众号 4-企业微信机器人 5-钉钉机器人 6-飞书机器人", accessMode = READ_WRITE, position = 2)
|
||||
@ApiModelProperty(value = "Notification information method: 0-SMS 1-Email 2-webhook 3-WeChat Official Account 4-Enterprise WeChat Robot 5-DingTalk Robot 6-FeiShu Robot",
|
||||
notes = "通知信息方式: 0-手机短信 1-邮箱 2-webhook 3-微信公众号 4-企业微信机器人 5-钉钉机器人 6-飞书机器人",
|
||||
accessMode = READ_WRITE, position = 2)
|
||||
@Min(0)
|
||||
@Max(8)
|
||||
@NotNull
|
||||
private Byte type;
|
||||
|
||||
@ApiModelProperty(value = "手机号, 通知方式为手机短信时有效", example = "18923435643", accessMode = READ_WRITE, position = 3)
|
||||
@ApiModelProperty(value = "Mobile number: Valid when the notification method is SMS",
|
||||
notes = "手机号 : 通知方式为手机短信时有效",
|
||||
example = "18923435643", accessMode = READ_WRITE, position = 3)
|
||||
@Length(max = 100)
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "邮箱账号, 通知方式为邮箱时有效", example = "tom@qq.com", accessMode = READ_WRITE, position = 4)
|
||||
@ApiModelProperty(value = "Email account: Valid when the notification method is email",
|
||||
notes = "邮箱账号 : 通知方式为邮箱时有效",
|
||||
example = "tom@qq.com", accessMode = READ_WRITE, position = 4)
|
||||
@Length(max = 100)
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "URL地址, 通知方式为webhook有效", example = "https://www.tancloud.cn", accessMode = READ_WRITE, position = 5)
|
||||
@ApiModelProperty(value = "URL address: The notification method is valid for webhook",
|
||||
notes = "URL地址 : 通知方式为webhook有效",
|
||||
example = "https://www.tancloud.cn", accessMode = READ_WRITE, position = 5)
|
||||
@Length(max = 300)
|
||||
private String hookUrl;
|
||||
|
||||
@ApiModelProperty(value = "openId, 通知方式为微信公众号或企业微信机器人有效", example = "343432", accessMode = READ_WRITE, position = 6)
|
||||
@ApiModelProperty(value = "openId : The notification method is valid for WeChat official account or enterprise WeChat robot",
|
||||
notes = "openId : 通知方式为微信公众号或企业微信机器人有效",
|
||||
example = "343432", accessMode = READ_WRITE, position = 6)
|
||||
@Length(max = 300)
|
||||
private String wechatId;
|
||||
|
||||
@ApiModelProperty(value = "访问token, 通知方式为钉钉机器人有效", example = "34823984635647", accessMode = READ_WRITE, position = 7)
|
||||
@ApiModelProperty(value = "Access token : The notification method is valid for DingTalk robot",
|
||||
notes = "访问token : 通知方式为钉钉机器人有效",
|
||||
example = "34823984635647", accessMode = READ_WRITE, position = 7)
|
||||
@Length(max = 300)
|
||||
private String accessToken;
|
||||
|
||||
@ApiModelProperty(value = "此条记录创建者", example = "tom", accessMode = READ_ONLY, position = 7)
|
||||
@ApiModelProperty(value = "The creator of this record",
|
||||
notes = "此条记录创建者",
|
||||
example = "tom", accessMode = READ_ONLY, position = 7)
|
||||
private String creator;
|
||||
|
||||
@ApiModelProperty(value = "此条记录最新修改者", example = "tom", accessMode = READ_ONLY, position = 8)
|
||||
@ApiModelProperty(value = "This record was last modified by",
|
||||
notes = "此条记录最新修改者",
|
||||
example = "tom", accessMode = READ_ONLY, position = 8)
|
||||
private String modifier;
|
||||
|
||||
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 9)
|
||||
@ApiModelProperty(value = "Record creation time (millisecond timestamp)",
|
||||
notes = "记录创建时间(毫秒时间戳)",
|
||||
example = "1612198922000", accessMode = READ_ONLY, position = 9)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 10)
|
||||
@ApiModelProperty(value = "Record the latest modification time (timestamp in milliseconds)",
|
||||
notes = "记录最新修改时间(毫秒时间戳)",
|
||||
example = "1612198444000", accessMode = READ_ONLY, position = 10)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtUpdate;
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY;
|
||||
import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
||||
|
||||
/**
|
||||
* Notification strategy entity
|
||||
* 通知策略
|
||||
*
|
||||
* @author tomsun28
|
||||
* @date 2021/11/13 22:19
|
||||
*/
|
||||
@@ -31,45 +33,65 @@ import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel(description = "通知策略实体")
|
||||
@ApiModel(description = "en: Notify Policy Entity,zh: 通知策略实体")
|
||||
public class NoticeRule {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@ApiModelProperty(value = "通知策略实体主键索引ID", example = "87584674384", accessMode = READ_ONLY, position = 0)
|
||||
@ApiModelProperty(value = "Notification Policy Entity Primary Key Index ID",
|
||||
notes = "通知策略实体主键索引ID",
|
||||
example = "87584674384", accessMode = READ_ONLY, position = 0)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "策略名称", example = "dispatch-1", accessMode = READ_WRITE, position = 1)
|
||||
@ApiModelProperty(value = "Policy name",
|
||||
notes = "策略名称",
|
||||
example = "dispatch-1", accessMode = READ_WRITE, position = 1)
|
||||
@Length(max = 100)
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "接收人ID", example = "4324324", accessMode = READ_WRITE, position = 2)
|
||||
@ApiModelProperty(value = "Recipient ID",
|
||||
notes = "接收人ID",
|
||||
example = "4324324", accessMode = READ_WRITE, position = 2)
|
||||
@NotNull
|
||||
private Long receiverId;
|
||||
|
||||
@ApiModelProperty(value = "接收人标识", example = "tom", accessMode = READ_WRITE, position = 3)
|
||||
@ApiModelProperty(value = "Recipient identification",
|
||||
notes = "接收人标识",
|
||||
example = "tom", accessMode = READ_WRITE, position = 3)
|
||||
@Length(max = 100)
|
||||
@NotNull
|
||||
private String receiverName;
|
||||
|
||||
@ApiModelProperty(value = "是否启用此策略", example = "true", accessMode = READ_WRITE, position = 4)
|
||||
@ApiModelProperty(value = "Whether to enable this policy",
|
||||
notes = "是否启用此策略",
|
||||
example = "true", accessMode = READ_WRITE, position = 4)
|
||||
private boolean enable = true;
|
||||
|
||||
@ApiModelProperty(value = "是否转发所有", example = "false", accessMode = READ_WRITE, position = 5)
|
||||
@ApiModelProperty(value = "Whether to forward all",
|
||||
notes = "是否转发所有",
|
||||
example = "false", accessMode = READ_WRITE, position = 5)
|
||||
private boolean filterAll = true;
|
||||
|
||||
@ApiModelProperty(value = "此条记录创建者", example = "tom", accessMode = READ_ONLY, position = 7)
|
||||
@ApiModelProperty(value = "The creator of this record",
|
||||
notes = "此条记录创建者",
|
||||
example = "tom", accessMode = READ_ONLY, position = 7)
|
||||
private String creator;
|
||||
|
||||
@ApiModelProperty(value = "此条记录最新修改者", example = "tom", accessMode = READ_ONLY, position = 8)
|
||||
@ApiModelProperty(value = "This record was last modified by",
|
||||
notes = "此条记录最新修改者",
|
||||
example = "tom", accessMode = READ_ONLY, position = 8)
|
||||
private String modifier;
|
||||
|
||||
@ApiModelProperty(value = "记录创建时间(毫秒时间戳)", example = "1612198922000", accessMode = READ_ONLY, position = 9)
|
||||
@ApiModelProperty(value = "This record creation time (millisecond timestamp)",
|
||||
notes = "记录创建时间(毫秒时间戳)",
|
||||
example = "1612198922000", accessMode = READ_ONLY, position = 9)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtCreate;
|
||||
|
||||
@ApiModelProperty(value = "记录最新修改时间(毫秒时间戳)", example = "1612198444000", accessMode = READ_ONLY, position = 10)
|
||||
@ApiModelProperty(value = "Record the latest modification time (timestamp in milliseconds)",
|
||||
notes = "记录最新修改时间(毫秒时间戳)",
|
||||
example = "1612198444000", accessMode = READ_ONLY, position = 10)
|
||||
@Column(insertable = false, updatable = false)
|
||||
private LocalDateTime gmtUpdate;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user