maintenance_create
Schedule maintenance periods in Zabbix by specifying start and end times, host or group IDs, and time periods. Streamline system updates and downtime management with JSON-formatted results.
Instructions
Create a new maintenance period in Zabbix.
Args:
name: Maintenance name
active_since: Start time (Unix timestamp)
active_till: End time (Unix timestamp)
groupids: List of host group IDs
hostids: List of host IDs
timeperiods: List of time periods
description: Maintenance description
Returns:
str: JSON formatted creation result
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| active_since | Yes | ||
| active_till | Yes | ||
| description | No | ||
| groupids | No | ||
| hostids | No | ||
| name | Yes | ||
| timeperiods | No |
Implementation Reference
- src/zabbix_mcp_server.py:1186-1226 (handler)The handler function for the 'maintenance_create' tool, decorated with @mcp.tool() for registration. It creates a new maintenance period using the Zabbix API, validates read-only mode, prepares parameters, calls client.maintenance.create, and formats the response.@mcp.tool() def maintenance_create(name: str, active_since: int, active_till: int, groupids: Optional[List[str]] = None, hostids: Optional[List[str]] = None, timeperiods: Optional[List[Dict[str, Any]]] = None, description: Optional[str] = None) -> str: """Create a new maintenance period in Zabbix. Args: name: Maintenance name active_since: Start time (Unix timestamp) active_till: End time (Unix timestamp) groupids: List of host group IDs hostids: List of host IDs timeperiods: List of time periods description: Maintenance description Returns: str: JSON formatted creation result """ validate_read_only() client = get_zabbix_client() params = { "name": name, "active_since": active_since, "active_till": active_till } if groupids: params["groupids"] = groupids if hostids: params["hostids"] = hostids if timeperiods: params["timeperiods"] = timeperiods if description: params["description"] = description result = client.maintenance.create(**params) return format_response(result)