feat: implement template cloning and extended item data retrieval
- Extend Template and ZabbixItem types in GraphQL schema to support full item hierarchy and cloning. - Update ZabbixQueryTemplatesRequest in src/datasources/zabbix-templates.ts to fetch comprehensive item configurations (type, status, history, delay, units, preprocessing, tags). - Implement raw value resolvers for ZabbixItem.type_int and ZabbixItem.status_int in src/api/resolvers.ts. - Add new MCP operations: mcp/operations/getTemplates.graphql and mcp/operations/importTemplates.graphql for template management via AI agents. - Add 'Cloning a Template with Items' recipe to docs/howtos/cookbook.md. - Update src/test/template_query.test.ts to ensure compatibility with extended datasource output.
This commit is contained in:
parent
67357d0bc3
commit
ef7afe65ab
8 changed files with 231 additions and 9 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import {ZabbixRequest, ParsedArgs, isZabbixErrorResult} from "./zabbix-request.js";
|
||||
import {ZabbixRequest, ParsedArgs, isZabbixErrorResult, ZabbixParams} from "./zabbix-request.js";
|
||||
import {ZabbixAPI} from "./zabbix-api.js";
|
||||
import {logger} from "../logging/logger.js";
|
||||
|
||||
|
||||
export interface ZabbixQueryTemplateResponse {
|
||||
templateid: string,
|
||||
host: string,
|
||||
uuid: string,
|
||||
name: string,
|
||||
items?: any[]
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -14,6 +16,14 @@ export class ZabbixQueryTemplatesRequest extends ZabbixRequest<ZabbixQueryTempla
|
|||
constructor(authToken?: string | null, cookie?: string | null,) {
|
||||
super("template.get", authToken, cookie);
|
||||
}
|
||||
|
||||
createZabbixParams(args?: ParsedArgs): ZabbixParams {
|
||||
return {
|
||||
"selectItems": "extend",
|
||||
"output": "extend",
|
||||
...args?.zabbix_params
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue