graph_get
Retrieve and filter graphs from Zabbix using specific criteria such as graph, host, or template IDs. Outputs JSON-formatted graph data for integration and monitoring purposes.
Instructions
Get graphs from Zabbix with optional filtering.
Args:
graphids: List of graph IDs to retrieve
hostids: List of host IDs to filter by
templateids: List of template IDs to filter by
output: Output format
search: Search criteria
filter: Filter criteria
Returns:
str: JSON formatted list of graphs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | ||
| graphids | No | ||
| hostids | No | ||
| output | No | extend | |
| search | No | ||
| templateids | No |
Implementation Reference
- src/zabbix_mcp_server.py:1280-1316 (handler)The graph_get tool handler: retrieves graphs from Zabbix API. Registered via @mcp.tool() decorator. Uses get_zabbix_client() and format_response() helpers.@mcp.tool() def graph_get(graphids: Optional[List[str]] = None, hostids: Optional[List[str]] = None, templateids: Optional[List[str]] = None, output: Union[str, List[str]] = "extend", search: Optional[Dict[str, str]] = None, filter: Optional[Dict[str, Any]] = None) -> str: """Get graphs from Zabbix with optional filtering. Args: graphids: List of graph IDs to retrieve hostids: List of host IDs to filter by templateids: List of template IDs to filter by output: Output format (extend or list of specific fields) search: Search criteria filter: Filter criteria Returns: str: JSON formatted list of graphs """ client = get_zabbix_client() params = {"output": output} if graphids: params["graphids"] = graphids if hostids: params["hostids"] = hostids if templateids: params["templateids"] = templateids if search: params["search"] = search if filter: params["filter"] = filter result = client.graph.get(**params) return format_response(result)