maintenance_get
Retrieve maintenance periods from Zabbix by specifying maintenance IDs, host group IDs, or host IDs. Returns JSON-formatted data in the desired output format for monitoring and analysis.
Instructions
Get maintenance periods from Zabbix.
Args:
maintenanceids: List of maintenance IDs to retrieve
groupids: List of host group IDs to filter by
hostids: List of host IDs to filter by
output: Output format
Returns:
str: JSON formatted list of maintenance periods
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupids | No | ||
| hostids | No | ||
| maintenanceids | No | ||
| output | No | extend |
Implementation Reference
- src/zabbix_mcp_server.py:1156-1184 (handler)The handler function for the 'maintenance_get' MCP tool. It is registered via the @mcp.tool() decorator and implements the logic to retrieve maintenance periods from the Zabbix API using the zabbix_utils client, formatting the response as JSON.@mcp.tool() def maintenance_get(maintenanceids: Optional[List[str]] = None, groupids: Optional[List[str]] = None, hostids: Optional[List[str]] = None, output: Union[str, List[str]] = "extend") -> str: """Get maintenance periods from Zabbix. Args: maintenanceids: List of maintenance IDs to retrieve groupids: List of host group IDs to filter by hostids: List of host IDs to filter by output: Output format (extend or list of specific fields) Returns: str: JSON formatted list of maintenance periods """ client = get_zabbix_client() params = {"output": output} if maintenanceids: params["maintenanceids"] = maintenanceids if groupids: params["groupids"] = groupids if hostids: params["hostids"] = hostids result = client.maintenance.get(**params) return format_response(result)