@johnny-joster/n9e-plugin 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index-full.ts +58 -0
- package/index-minimal.ts +14 -0
- package/index.ts +3 -47
- package/package.json +1 -1
package/index-full.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
+
import {
|
|
3
|
+
activeAlertsToolInputSchema,
|
|
4
|
+
activeAlertsToolHandler
|
|
5
|
+
} from "./src/tools/active-alerts.ts";
|
|
6
|
+
import {
|
|
7
|
+
historicalAlertsToolInputSchema,
|
|
8
|
+
historicalAlertsToolHandler
|
|
9
|
+
} from "./src/tools/historical-alerts.ts";
|
|
10
|
+
import {
|
|
11
|
+
alertRulesToolInputSchema,
|
|
12
|
+
alertRulesToolHandler
|
|
13
|
+
} from "./src/tools/alert-rules.ts";
|
|
14
|
+
import {
|
|
15
|
+
alertMutesToolInputSchema,
|
|
16
|
+
alertMutesToolHandler
|
|
17
|
+
} from "./src/tools/alert-mutes.ts";
|
|
18
|
+
|
|
19
|
+
export default function(api: OpenClawPluginApi) {
|
|
20
|
+
try {
|
|
21
|
+
// Register tool: Query active alerts
|
|
22
|
+
api.registerTool({
|
|
23
|
+
name: "n9e_query_active_alerts",
|
|
24
|
+
description: "查询夜莺平台当前活跃的告警事件。支持按严重级别(1=严重,2=警告,3=提示)、规则名称筛选。用于回答\"当前有哪些告警\"、\"最近的告警\"、\"有没有严重告警\"等问题。",
|
|
25
|
+
inputSchema: activeAlertsToolInputSchema,
|
|
26
|
+
handler: activeAlertsToolHandler
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Register tool: Query historical alerts
|
|
30
|
+
api.registerTool({
|
|
31
|
+
name: "n9e_query_historical_alerts",
|
|
32
|
+
description: "查询夜莺平台历史告警事件。支持按时间范围、严重级别、规则名称筛选。用于回答\"昨天有哪些告警\"、\"过去一周的告警趋势\"、\"历史告警记录\"等问题。",
|
|
33
|
+
inputSchema: historicalAlertsToolInputSchema,
|
|
34
|
+
handler: historicalAlertsToolHandler
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Register tool: Query alert rules
|
|
38
|
+
api.registerTool({
|
|
39
|
+
name: "n9e_query_alert_rules",
|
|
40
|
+
description: "查询夜莺平台配置的告警规则。支持按规则名称、数据源、启用状态筛选。用于回答\"有哪些告警规则\"、\"CPU相关的规则配置\"、\"查看内存监控规则\"等问题。",
|
|
41
|
+
inputSchema: alertRulesToolInputSchema,
|
|
42
|
+
handler: alertRulesToolHandler
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Register tool: Query alert mutes
|
|
46
|
+
api.registerTool({
|
|
47
|
+
name: "n9e_query_alert_mutes",
|
|
48
|
+
description: "查询夜莺平台告警屏蔽配置。用于回答\"哪些告警被屏蔽了\"、\"查看告警屏蔽规则\"、\"为什么没有收到告警\"等问题。",
|
|
49
|
+
inputSchema: alertMutesToolInputSchema,
|
|
50
|
+
handler: alertMutesToolHandler
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
api.logger.info("N9e plugin loaded successfully");
|
|
54
|
+
} catch (error) {
|
|
55
|
+
api.logger.error("Failed to load N9e plugin:", error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
package/index-minimal.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
+
|
|
3
|
+
export default function(api: OpenClawPluginApi) {
|
|
4
|
+
try {
|
|
5
|
+
api.logger.info("N9e plugin loading...");
|
|
6
|
+
|
|
7
|
+
// 不注册任何工具,只是测试插件能否加载
|
|
8
|
+
|
|
9
|
+
api.logger.info("N9e plugin loaded successfully");
|
|
10
|
+
} catch (error) {
|
|
11
|
+
api.logger.error("Failed to load N9e plugin:", error);
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,56 +1,12 @@
|
|
|
1
1
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
-
import {
|
|
3
|
-
activeAlertsToolInputSchema,
|
|
4
|
-
activeAlertsToolHandler
|
|
5
|
-
} from "./src/tools/active-alerts.ts";
|
|
6
|
-
import {
|
|
7
|
-
historicalAlertsToolInputSchema,
|
|
8
|
-
historicalAlertsToolHandler
|
|
9
|
-
} from "./src/tools/historical-alerts.ts";
|
|
10
|
-
import {
|
|
11
|
-
alertRulesToolInputSchema,
|
|
12
|
-
alertRulesToolHandler
|
|
13
|
-
} from "./src/tools/alert-rules.ts";
|
|
14
|
-
import {
|
|
15
|
-
alertMutesToolInputSchema,
|
|
16
|
-
alertMutesToolHandler
|
|
17
|
-
} from "./src/tools/alert-mutes.ts";
|
|
18
2
|
|
|
19
3
|
export default function(api: OpenClawPluginApi) {
|
|
20
4
|
try {
|
|
21
|
-
|
|
22
|
-
api.registerTool({
|
|
23
|
-
name: "n9e_query_active_alerts",
|
|
24
|
-
description: "查询夜莺平台当前活跃的告警事件。支持按严重级别(1=严重,2=警告,3=提示)、规则名称筛选。用于回答\"当前有哪些告警\"、\"最近的告警\"、\"有没有严重告警\"等问题。",
|
|
25
|
-
inputSchema: activeAlertsToolInputSchema,
|
|
26
|
-
handler: activeAlertsToolHandler
|
|
27
|
-
});
|
|
5
|
+
api.logger.info("N9e plugin loading...");
|
|
28
6
|
|
|
29
|
-
|
|
30
|
-
api.registerTool({
|
|
31
|
-
name: "n9e_query_historical_alerts",
|
|
32
|
-
description: "查询夜莺平台历史告警事件。支持按时间范围、严重级别、规则名称筛选。用于回答\"昨天有哪些告警\"、\"过去一周的告警趋势\"、\"历史告警记录\"等问题。",
|
|
33
|
-
inputSchema: historicalAlertsToolInputSchema,
|
|
34
|
-
handler: historicalAlertsToolHandler
|
|
35
|
-
});
|
|
7
|
+
// 不注册任何工具,只是测试插件能否加载
|
|
36
8
|
|
|
37
|
-
|
|
38
|
-
api.registerTool({
|
|
39
|
-
name: "n9e_query_alert_rules",
|
|
40
|
-
description: "查询夜莺平台配置的告警规则。支持按规则名称、数据源、启用状态筛选。用于回答\"有哪些告警规则\"、\"CPU相关的规则配置\"、\"查看内存监控规则\"等问题。",
|
|
41
|
-
inputSchema: alertRulesToolInputSchema,
|
|
42
|
-
handler: alertRulesToolHandler
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Register tool: Query alert mutes
|
|
46
|
-
api.registerTool({
|
|
47
|
-
name: "n9e_query_alert_mutes",
|
|
48
|
-
description: "查询夜莺平台告警屏蔽配置。用于回答\"哪些告警被屏蔽了\"、\"查看告警屏蔽规则\"、\"为什么没有收到告警\"等问题。",
|
|
49
|
-
inputSchema: alertMutesToolInputSchema,
|
|
50
|
-
handler: alertMutesToolHandler
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
api.logger.info("N9e plugin loaded successfully");
|
|
9
|
+
api.logger.info("N9e plugin loaded successfully");
|
|
54
10
|
} catch (error) {
|
|
55
11
|
api.logger.error("Failed to load N9e plugin:", error);
|
|
56
12
|
throw error;
|