trigger_create
Define and configure custom triggers in Zabbix monitoring to detect specific conditions. Set description, expression, severity, status, and comments to automate issue alerts.
Instructions
Create a new trigger in Zabbix.
Args:
description: Trigger description
expression: Trigger expression
priority: Severity (0=not classified, 1=info, 2=warning, 3=average, 4=high, 5=disaster)
status: Status (0=enabled, 1=disabled)
comments: Additional comments
Returns:
str: JSON formatted creation result
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comments | No | ||
| description | Yes | ||
| expression | Yes | ||
| priority | No | ||
| status | No |
Input Schema (JSON Schema)
{
"properties": {
"comments": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Comments"
},
"description": {
"title": "Description",
"type": "string"
},
"expression": {
"title": "Expression",
"type": "string"
},
"priority": {
"default": 0,
"title": "Priority",
"type": "integer"
},
"status": {
"default": 0,
"title": "Status",
"type": "integer"
}
},
"required": [
"description",
"expression"
],
"type": "object"
}
Implementation Reference
- src/zabbix_mcp_server.py:509-540 (handler)The main handler function for the 'trigger_create' MCP tool. It is decorated with @mcp.tool() which handles both implementation and registration in FastMCP. The function creates a new trigger in Zabbix by calling the ZabbixAPI client's trigger.create method after validating permissions and formatting parameters.@mcp.tool() def trigger_create(description: str, expression: str, priority: int = 0, status: int = 0, comments: Optional[str] = None) -> str: """Create a new trigger in Zabbix. Args: description: Trigger description expression: Trigger expression priority: Severity (0=not classified, 1=info, 2=warning, 3=average, 4=high, 5=disaster) status: Status (0=enabled, 1=disabled) comments: Additional comments Returns: str: JSON formatted creation result """ validate_read_only() client = get_zabbix_client() params = { "description": description, "expression": expression, "priority": priority, "status": status } if comments: params["comments"] = comments result = client.trigger.create(**params) return format_response(result)