# neatlogic-alert-plugin-base **Repository Path**: neat-logic/neatlogic-alert-plugin-base ## Basic Information - **Project Name**: neatlogic-alert-plugin-base - **Description**: 告警自定义插件接口定义,包括转换,后续动作等扩展 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: develop4.0.0 - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 8 - **Created**: 2024-11-26 - **Last Updated**: 2026-03-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 中文 / [English](README.en.md) --- ## 关于 neatlogic-alert-plugin-base是告警适配器的接口,用于转换告警数据为统一格式,开发自己的适配器时需要实现IAdapter接口 ## 架构图 ![img_1.png](README_IMAGES/img_1.png) ## 开发规范 代码要符合JAVA SPI架构标准 ### 范例 1 实现IAdapter接口,处理数据 ```java package com.neatlogic.alert.plugin.adapater; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.neatlogic.alert.plugin.adapter.core.IAdapter; public class InformantAdapter implements IAdapter { @Override public JSONObject convert(String input) { JSONObject inputObj = JSON.parseObject(input); JSONObject outputObj = new JSONObject(); outputObj.put("title", inputObj.getString("title")); JSONObject attrObj = new JSONObject(); attrObj.put("ip", inputObj.getString("ip")); attrObj.put("state", inputObj.getString("state")); attrObj.put("hostname", inputObj.getString("hostname")); attrObj.put("incident_id", inputObj.getString("incident_id")); attrObj.put("informant_id", inputObj.getString("informant_id")); attrObj.put("obj_id", inputObj.getString("obj_id")); attrObj.put("obj_path", inputObj.getString("obj_path")); attrObj.put("category", inputObj.getString("category")); outputObj.put("attrObj", attrObj); return outputObj; } } ``` 2 创建服务发现文件 ![img.png](img.png) 文件内容 ``` com.neatlogic.alert.plugin.adapater.InformantAdapter ```