Skip to main content
Glama
mpeirone

zabbix-mcp-server

discoveryrule_get

Retrieve discovery rules from Zabbix with customizable filters for item IDs, host IDs, and template IDs. Returns JSON-formatted data for precise monitoring and integration.

Instructions

Get discovery rules from Zabbix with optional filtering.

Args:
    itemids: List of discovery rule 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 discovery rules

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNo
hostidsNo
itemidsNo
outputNoextend
searchNo
templateidsNo

Implementation Reference

  • The discoveryrule_get MCP tool handler function, registered via @mcp.tool() decorator. Retrieves discovery rules using Zabbix API with filtering parameters and returns JSON-formatted response.
    def discoveryrule_get(itemids: 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 discovery rules from Zabbix with optional filtering.
        
        Args:
            itemids: List of discovery rule 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 discovery rules
        """
        client = get_zabbix_client()
        params = {"output": output}
        
        if itemids:
            params["itemids"] = itemids
        if hostids:
            params["hostids"] = hostids
        if templateids:
            params["templateids"] = templateids
        if search:
            params["search"] = search
        if filter:
            params["filter"] = filter
        
        result = client.discoveryrule.get(**params)
        return format_response(result)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mpeirone/zabbix-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server