Skip to main content
Glama
driosalido
by driosalido

delete_silence

Remove or expire an existing alert silence in Kubernetes clusters to restore monitoring for specific alerts.

Instructions

Delete (expire) an existing silence

Args: silence_id: ID of the silence to delete cluster: Cluster where the silence exists

Returns: Deletion result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
silence_idYes
clusterYes

Implementation Reference

  • The handler function 'delete_silence' implements the tool logic to verify existence and prepare a deletion request for a silence in a specified cluster.
    async def delete_silence(silence_id: str, cluster: str) -> str:
        """Delete (expire) an existing silence
    
        Args:
            silence_id: ID of the silence to delete
            cluster: Cluster where the silence exists
    
        Returns:
            Deletion result
        """
        try:
            # First verify the silence exists
            async with httpx.AsyncClient() as client:
                response = await client.post(
                    f"{KARMA_URL}/alerts.json",
                    json={},
                    headers={"Content-Type": "application/json"},
                    timeout=10.0,
                )
    
                if response.status_code != 200:
                    return (
                        f"Error fetching silence information: code {response.status_code}"
                    )
    
                data = response.json()
                silences = data.get("silences", {}).get(cluster, {})
    
                if silence_id not in silences:
                    # Try to find with partial match
                    found = False
                    for sid in silences:
                        if silence_id in sid:
                            silence_id = sid
                            found = True
                            break
    
                    if not found:
                        return f"Silence ID {silence_id} not found in cluster {cluster}"
    
                silence_info = silences.get(silence_id, {})
    
                return f"""
    āš ļø Silence Deletion Request:
    
    šŸ”• Silence ID: {silence_id}
    šŸ“ Cluster: {cluster}
    šŸ’¬ Original comment: {silence_info.get("comment", "N/A")}
    šŸ‘¤ Created by: {silence_info.get("createdBy", "unknown")}
    
    Note: Direct Alertmanager API integration is required to complete this deletion.
    To manually delete this silence, use the Karma UI or Alertmanager API directly.
    """
    
        except Exception as e:
            return f"Error deleting silence: {str(e)}"
  • The Pydantic model 'DeleteSilenceRequest' defines the input schema for the delete_silence tool.
    class DeleteSilenceRequest(BaseModel):
        silence_id: str
        cluster: str
  • The route for deleting silences is registered as a DELETE endpoint on '/silences' in the FastAPI app.
    "DELETE /silences - Delete an existing silence",

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/driosalido/mcp-karma'

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