### Install Dependencies and Setup Frontend Source: https://github.com/keephq/keep/blob/main/docs/development/getting-started.mdx Install Python virtual environment, Poetry, and project dependencies. Also, set up the frontend environment variables. ```bash python3.11 -m venv venv; source venv/bin/activate; pip install poetry; poetry install; cd keep-ui && npm i && cd ..; cp keep-ui/.env.local.example keep-ui/.env.local; echo "\n\n\n\nNEXTAUTH_SECRET=\"$(openssl rand -hex 32)\"" >> keep-ui/.env.local; ``` -------------------------------- ### Apply a Workflow Example Source: https://github.com/keephq/keep/blob/main/docs/cli/installation.mdx Test the installation by applying a sample workflow from a YAML file. This will upload the workflow to your Keep UI. ```shell keep workflow apply -f examples/workflows/query_clickhouse.yml ``` -------------------------------- ### Minimal Complete Provider Example Source: https://github.com/keephq/keep/blob/main/docs/providers/adding-a-new-provider.mdx A basic template for a provider implementation, including essential methods like `__init__`, `validate_config`, `dispose`, `_query`, and `_notify`. This serves as a starting point for creating new providers. ```python from keep.providers.base.base_provider import BaseProvider from keep.providers.models.provider_config import ProviderConfig from keep.contextmanager.contextmanager import ContextManager class MyProvider(BaseProvider): PROVIDER_DISPLAY_NAME = "My Service" PROVIDER_CATEGORY = ["Monitoring", "Incident Management"] PROVIDER_TAGS = ["alert", "messaging"] def __init__( self, context_manager: ContextManager, provider_id: str, config: ProviderConfig, webhook_template: Optional[str] = None, webhook_description: Optional[str] = None, webhook_markdown: Optional[str] = None, provider_description: Optional[str] = None, ): super().__init__( context_manager, provider_id, config, webhook_template, webhook_description, webhook_markdown, provider_description ) def validate_config(self): # Validate the provider configuration pass def dispose(self): # Clean up resources pass def _query(self, **kwargs): # Implement query logic pass def _notify(self, **kwargs): # Implement notification logic pass ``` -------------------------------- ### Install Dependencies Source: https://github.com/keephq/keep/blob/main/keep-ui/README.md Run this command to install the necessary dependencies for the Keep UI project. ```bash npm install ``` ```bash yarn install ``` -------------------------------- ### Complete Provider Example Source: https://github.com/keephq/keep/blob/main/docs/providers/provider-methods.mdx Defines a provider with custom 'Mute Alert' and 'Get Metrics' methods, demonstrating action and view types. ```python class MonitoringProvider(BaseProvider): PROVIDER_DISPLAY_NAME = "Monitoring Service" PROVIDER_METHODS = [ ProviderMethod( name="Mute Alert", description="Mute an alert for a specified duration", func_name="mute_alert", type="action", scopes=["alerts:write"], category="Alert Management", ), ProviderMethod( name="Get Metrics", description="Retrieve metrics for a service", func_name="get_metrics", type="view", scopes=["metrics:read"], category="Observability", ), ] def mute_alert(self, alert_id: str, duration_minutes: int = 60) -> dict: """ Mute an alert for the specified duration. Args: alert_id: The ID of the alert to mute duration_minutes: Duration to mute in minutes (default: 60) Returns: dict: Confirmation of the mute action """ # Implementation here response = self._api_call(f"/alerts/{alert_id}/mute", {"duration": duration_minutes}) return {"success": True, "muted_until": response["muted_until"]} def get_metrics(self, service_name: str, metric_type: str, time_range: str = "1h") -> list: """ Get metrics for a specific service. Args: service_name: Name of the service metric_type: Type of metric (cpu, memory, latency, etc.) time_range: Time range for metrics (default: "1h") Returns: list: List of metric data points """ # Implementation here return self._query(f"metrics.{metric_type}", service=service_name, range=time_range) ``` -------------------------------- ### Start Development Server Source: https://github.com/keephq/keep/blob/main/keep-ui/README.md Use this command to start the development server for Keep UI. Access the application in your browser at http://localhost:3000. ```bash npm run dev ``` ```bash yarn dev ``` -------------------------------- ### Keep Installation Script for Docker Compose Source: https://github.com/keephq/keep/blob/main/docs/deployment/docker.mdx This script installs Keep using Docker Compose. It creates a state directory, downloads necessary docker-compose files, and starts the services. ```bash #!/bin/bash # Keep install script for docker compose set -e echo "Creating state directory." mkdir -p state test -e state || echo "Unable to create folder" echo "Changing directory ownership to non-privileged user." chown -R 999:999 state || echo "Unable to change directory ownership, changing permissions instead." && chmod -R 0777 state which curl &> /dev/null || echo "curl not installed" curl https://raw.githubusercontent.com/keephq/keep/main/docker-compose.yml --output docker-compose.yml curl https://raw.githubusercontent.com/keephq/keep/main/docker-compose.common.yml --output docker-compose.common.yml docker compose up -d ``` -------------------------------- ### Install LiteLLM Source: https://github.com/keephq/keep/blob/main/docs/deployment/local-llm/keep-with-litellm.mdx Install LiteLLM using pip. This is a prerequisite for running LiteLLM locally. ```bash pip install litellm ``` -------------------------------- ### List Installable Providers CLI Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/provider-list.mdx To list only the providers that you can install, use the `--available` or `-a` flag. This helps in discovering new providers. ```bash Usage: keep provider list [OPTIONS] List providers. Options: -a, --available List provider that you can install. --help Show this message and exit. ``` -------------------------------- ### List All Providers CLI Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/provider-list.mdx Use this command to list all providers. This includes providers that are available for installation and those that are already installed. ```bash Usage: keep provider list [OPTIONS] ``` -------------------------------- ### Start Llama.cpp Server Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/llamacpp-provider.mdx Start the Llama.cpp server with HTTP interface. Ensure the model path is correct and the server is accessible. ```bash ./server --model /path/to/your/model.gguf --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Run Docs Locally with Mintlify Source: https://github.com/keephq/keep/blob/main/docs/README.md Install Mintlify globally and then run the development server to view the documentation locally. Ensure you have Node.js and npm installed. ```bash npm i -g mintlify mintlify dev ``` -------------------------------- ### Start Proxy Environment with Docker Compose Source: https://github.com/keephq/keep/blob/main/proxy/README.md Command to start the proxy services defined in the docker-compose-proxy.yml file. ```bash docker compose -f docker-compose-proxy.yml up ``` -------------------------------- ### ArgoCD ConfigMap Example Source: https://github.com/keephq/keep/blob/main/keep/providers/argocd_provider/README.md An example of the ArgoCD configuration map (`argocd-cm`) after adding the admin account configuration. ```yaml # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: v1 ################ This is the new part########### data: accounts.admin: apiKey, login ################################################ kind: ConfigMap metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"v1","kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app.kubernetes.io/name":"argocd-cm","app.kubernetes.io/part-of":"argocd"},"name":"argocd-cm","namespace":"argocd"}} creationTimestamp: "2024-12-27T15:40:06Z" labels: app.kubernetes.io/name: argocd-cm app.kubernetes.io/part-of: argocd name: argocd-cm namespace: argocd resourceVersion: "807860" uid: e2d8722f-e3bc-4299-9bb6-669b2873acdd ``` -------------------------------- ### Install ArgoCD Source: https://github.com/keephq/keep/blob/main/keep/providers/argocd_provider/README.md Installs ArgoCD into the Kubernetes cluster. Ensure Docker and Kubernetes are running. ```bash kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml ``` -------------------------------- ### Advanced Query Example Source: https://github.com/keephq/keep/blob/main/docs/providers/provider-methods.mdx An example demonstrating various parameter types for a provider method. ```APIDOC ## Advanced Query ### Description Query metrics with advanced filtering options. ### Method This is a view type method. ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters - **metric_name** (str) - Required - The name of the metric to query. #### Query Parameters - **time_range** (Literal["1h", "6h", "24h", "7d"]) - Optional - The time range for the query. Defaults to "1h". - **include_metadata** (bool) - Optional - Whether to include metadata in the response. Defaults to false. - **limit** (int) - Optional - The maximum number of results to return. - **start_time** (datetime) - Optional - The start time for the query. If not provided, the query will use the `time_range`. ### Request Example ```python provider.advanced_query( metric_name="cpu_usage", time_range="24h", include_metadata=True, limit=100, start_time=datetime(2023, 10, 27, 9, 0, 0) ) ``` ### Response #### Success Response (200) - **data** (dict) - The query results, potentially including metadata. #### Response Example ```json { "data": { "metric_name": "cpu_usage", "time_range": "24h", "results": [ {"timestamp": "...", "value": "..."} ], "metadata": { "source": "server-1", "region": "us-east-1" } } } ``` ``` -------------------------------- ### Install a Provider Source: https://context7.com/keephq/keep/llms.txt Installs a new provider by providing its type and authentication credentials. Credentials are stored in the configured secret manager. Requires authentication and content type. ```bash curl -s -X POST http://localhost:8080/providers/install \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "provider_id": "prod-pagerduty", "provider_name": "PagerDuty Production", "provider_type": "pagerduty", "provider_config": { "api_key": "your-pagerduty-api-key", "api_token": "your-integration-key" } }' | jq '{id, type, name}' ``` -------------------------------- ### Test Keep CLI Installation Source: https://github.com/keephq/keep/blob/main/docs/cli/installation.mdx Verify that the Keep CLI has been installed correctly by checking its version. ```shell keep version ``` -------------------------------- ### Install a Provider Source: https://context7.com/keephq/keep/llms.txt Installs a new provider by providing its type and authentication credentials. Credentials are stored in the configured secret manager. ```APIDOC ## POST /providers/install — Install a Provider ### Description Installs a new provider by providing its type and authentication credentials. Credentials are stored in the configured secret manager. ### Method POST ### Endpoint /providers/install ### Parameters #### Request Body - **provider_id** (string) - Required - A unique identifier for the provider instance. - **provider_name** (string) - Required - A human-readable name for the provider. - **provider_type** (string) - Required - The type of the provider (e.g., "pagerduty", "slack"). - **provider_config** (object) - Required - Configuration details for the provider, including authentication credentials. ``` -------------------------------- ### Workflow Directory Structure Example Source: https://github.com/keephq/keep/blob/main/docs/deployment/provision/workflow.mdx Illustrates the expected directory structure for workflow configuration files. ```bash ├── workflow1.yaml ├── workflow2.yaml └── workflow3.yaml ``` -------------------------------- ### Configure Provider with YAML Source: https://github.com/keephq/keep/blob/main/docs/deployment/provision/provider.mdx Example of a provider configuration file in YAML format for use with `KEEP_PROVIDERS_DIRECTORY`. This example configures a VictoriaMetrics provider. ```yaml name: keepVictoriaMetrics type: victoriametrics authentication: VMAlertHost: http://localhost VMAlertPort: 1234 install_webhook: false deduplication_rules: deduplication_rule_name_example_1: description: deduplication rule name example 1 fingerprint_fields: - fingerprint - source - service full_deduplication: true ignore_fields: - name - lastReceived ``` -------------------------------- ### Install Keep CLI with Poetry Source: https://github.com/keephq/keep/blob/main/docs/cli/installation.mdx Install the Keep CLI using poetry. This is an alternative to using pip for managing dependencies. ```shell poetry install ``` -------------------------------- ### Start LiteLLM with HuggingFace Model Source: https://github.com/keephq/keep/blob/main/docs/deployment/local-llm/keep-with-litellm.mdx Start the LiteLLM proxy server locally, configured to use a specific HuggingFace model. The server will be accessible at http://0.0.0.0:4000. ```bash litellm --model huggingface/bigcode/starcoder ``` -------------------------------- ### Start ELK Environment with Docker Compose Source: https://github.com/keephq/keep/blob/main/elk/README.md Use this command to start the ELK stack services defined in the docker-compose-elk.yml file. ```bash docker compose -f docker-compose-elk.yml up ``` -------------------------------- ### Start NetBox Instance Source: https://github.com/keephq/keep/blob/main/keep/providers/netbox_provider/README.md Launch the NetBox Community instance using Docker Compose. This command builds and starts all necessary services defined in the Docker Compose files. ```bash docker compose up ``` -------------------------------- ### Install Keep with Ingress-HAProxy Source: https://github.com/keephq/keep/blob/main/docs/deployment/kubernetes/installation.mdx Installs the Keep application using its Helm chart, enabling ingress with the HAProxy controller. Specify the ingress class name. ```bash # Add the Helm repository helm repo add keephq https://keephq.github.io/helm-charts # Install Keep with ingress enabled helm install keep keephq/keep -n keep --create-namespace --set global.ingress.className=haproxy ``` -------------------------------- ### Install ArgoCD CLI (Mac/Linux) Source: https://github.com/keephq/keep/blob/main/keep/providers/argocd_provider/README.md Installs the ArgoCD command-line interface using Homebrew for macOS and Linux systems. ```bash brew install argocd ``` -------------------------------- ### Start Loki with Docker Compose Source: https://github.com/keephq/keep/blob/main/keep/providers/grafana_loki_provider/README.md Starts the Loki services defined in the docker-compose.yaml file. This command should be run from the directory containing the docker-compose.yaml file. ```bash docker-compose -f docker-compose.yaml up ``` -------------------------------- ### Start Loki with Docker Compose and Basic Auth Source: https://github.com/keephq/keep/blob/main/keep/providers/grafana_loki_provider/README.md Starts the Loki server using the provided docker-compose.auth.yml file, enabling basic HTTP authentication. Ensure this command is executed from the directory containing the compose file. ```bash docker compose -f docker-compose.auth.yml up ``` -------------------------------- ### Start Databend Container with Docker Source: https://github.com/keephq/keep/blob/main/keep/providers/databend_provider/README.md Run this command to start a Databend container. It maps port 8000 and sets default user credentials. ```bash docker run \ -p 8000:8000 \ -e QUERY_DEFAULT_USER=databend \ -e QUERY_DEFAULT_PASSWORD=databend \ datafuselabs/databend ``` -------------------------------- ### Clone Clickhouse Secure Setup Repository Source: https://github.com/keephq/keep/blob/main/keep/providers/clickhouse_provider/README.md Clones the repository containing ClickHouse setup files for secure connections and navigates into the specific directory. ```bash git clone cd /keep/providers/clickhouse_provider/clickhouse-secure ``` -------------------------------- ### Install Keep with Ingress-NGINX Source: https://github.com/keephq/keep/blob/main/docs/deployment/kubernetes/installation.mdx Installs the Keep application using its Helm chart, enabling ingress with the Nginx controller. Ensure the Helm repository is added first. ```bash # Add the Helm repository helm repo add keephq https://keephq.github.io/helm-charts # Install Keep with ingress enabled helm install keep keephq/keep -n keep --create-namespace ``` -------------------------------- ### Install HAProxy Ingress Controller with Helm Source: https://github.com/keephq/keep/blob/main/docs/deployment/kubernetes/installation.mdx Installs or upgrades the HAProxy Ingress controller using Helm. Ensure you have the correct repository added. ```bash # simplest way to install helm upgrade --install haproxy-ingress haproxy-ingress \ --repo https://haproxy-ingress.github.io/charts \ --namespace ingress-haproxy --create-namespace ``` -------------------------------- ### Fetch Data from MySQL Source: https://github.com/keephq/keep/blob/main/docs/workflows/syntax/steps-and-actions.mdx Example of a step to fetch data from a MySQL database using a specific query. ```yaml steps: - name: get-user-data provider: type: mysql config: "{{ providers.mysql-prod }}" with: query: "SELECT * FROM users WHERE id = 1" single_row: true ``` -------------------------------- ### Install Flux CLI and Bootstrap Flux CD Source: https://github.com/keephq/keep/blob/main/keep/providers/fluxcd_provider/README.md Installs the Flux CLI and bootstraps Flux CD on a Kubernetes cluster using GitHub. Ensure you replace placeholders with your actual GitHub username and repository name. ```bash # Install Flux CLI # For macOS/Linux brew install fluxcd/tap/flux # For Windows # Download from https://github.com/fluxcd/flux2/releases # Check prerequisites flux check --pre # Bootstrap Flux CD flux bootstrap github \ --owner= \ --repository= \ --path=clusters/my-cluster \ --personal ``` -------------------------------- ### Query Kubernetes Pods Source: https://github.com/keephq/keep/blob/main/docs/workflows/syntax/steps-and-actions.mdx Example of a step to query Kubernetes for running pods using a specific command type. ```yaml steps: - name: get-pods provider: type: k8s config: "{{ providers.k8s-cluster }}" with: command_type: get_pods ``` -------------------------------- ### Run Keycloak with Docker Compose Source: https://github.com/keephq/keep/blob/main/keycloak/readme.md Use this command to start Keycloak and its dependencies defined in the docker-compose.yaml file. ```bash docker-compose -f keycloak/docker-compose.yaml up ``` -------------------------------- ### Setup Webhook Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/site24x7-provider.mdx Configures a webhook in Site24x7 to send alert data to a specified Keep API URL. ```APIDOC ## Setup Webhook ### Description This method sets up a webhook in Site24x7 to forward alert data to your Keep API endpoint. It requires authentication details and the target API URL. ### Method ```python setup_webhook(tenant_id: str, keep_api_url: str, api_key: str, setup_alerts: bool = True) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **tenant_id** (str): Tenant identifier. - **keep_api_url** (str): URL to send alert data. - **api_key** (str): API key for authentication. - **setup_alerts** (bool): Whether to setup alerting capabilities (default is True). ### Request Example ```python site24x7_provider.setup_webhook( tenant_id="your_tenant_id", keep_api_url="https://your.keep.api/webhook", api_key="your_api_key", setup_alerts=True ) ``` ### Response None ``` -------------------------------- ### Apply ApplicationSet Example Source: https://github.com/keephq/keep/blob/main/keep/providers/argocd_provider/README.md Applies a sample ApplicationSet configuration to create dummy applications 'app-1' and 'app-2'. Navigate to the 'argocd_provider' directory before running. ```bash kubectl apply -f applicationset.yaml ``` -------------------------------- ### Example IAM Policy for S3 Provider Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/s3-provider.mdx This IAM policy grants the necessary permissions for the S3 provider to list buckets, get objects, and get bucket locations. It is required during the provider's installation for configuration validation. ```json { "Version": "2025-01-15", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject", "s3:GetBucketLocation", "s3:ListAllMyBuckets" ], "Resource": "*" } ] } ``` -------------------------------- ### Auto-Generated QuickChart Snippet Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/quickchart-provider.mdx This snippet is auto-generated and likely represents a default or example configuration for the QuickChart provider. It's useful for quick setup or understanding basic provider integration. ```javascript import { providers } from "keep"; const quickChartProvider = providers.quickchart({ apiKey: "YOUR_QUICKCHART_API_KEY", }); ``` -------------------------------- ### Create Loki Directory and Navigate Source: https://github.com/keephq/keep/blob/main/keep/providers/grafana_loki_provider/README.md Creates a directory for Loki and changes the current working directory to it. This is the initial step for both setup methods. ```bash mkdir loki cd loki ``` -------------------------------- ### CLI Usage Example Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/mappings-create.mdx This shows the basic command structure for creating a mapping rule. Use this to understand the command's entry point. ```bash Usage: keep mappings create [OPTIONS] ``` -------------------------------- ### Install or Upgrade Helm Release Source: https://github.com/keephq/keep/blob/main/docs/deployment/secret-store.mdx Use these Helm commands to install a new instance or upgrade an existing installation of Keep, applying the updated `values.yaml`. ```bash # If installing for the first time helm install keep keephq/keep \ -f values.yaml \ --namespace keep # If updating existing installation helm upgrade keep keephq/keep \ -f values.yaml \ --namespace keep ``` -------------------------------- ### Start VMauth with Authentication Configuration Source: https://github.com/keephq/keep/blob/main/keep/providers/victorialogs_provider/README.md Launches the VMauth binary, enabling authentication and proxying requests to VictoriaLogs. Ensure the VMauth binary and configuration file are correctly placed. ```bash /path/to/vmauth -auth.config=/path/to/auth/config.yml ``` -------------------------------- ### Start Keycloak Development Server Source: https://github.com/keephq/keep/blob/main/keycloak/readme.md Launches a Keycloak development instance with administrative credentials pre-configured. Ensure to use a specific image tag for stability. ```bash docker run --name phasetwo_test --rm -p 8181:8080 \ -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin \ quay.io/phasetwo/phasetwo-keycloak:latest \ start-dev ``` -------------------------------- ### MonitoringProvider Example Source: https://github.com/keephq/keep/blob/main/docs/providers/provider-methods.mdx An example of a provider class with custom methods for muting alerts and retrieving metrics. ```APIDOC ## Mute Alert ### Description Mute an alert for a specified duration. ### Method This is an action type method. ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters - **alert_id** (str) - Required - The ID of the alert to mute #### Query Parameters - **duration_minutes** (int) - Optional - Duration to mute in minutes (default: 60) ### Request Example ```python provider.mute_alert(alert_id="alert-123", duration_minutes=120) ``` ### Response #### Success Response (200) - **success** (bool) - Confirmation of the mute action - **muted_until** (datetime) - The timestamp until which the alert is muted #### Response Example ```json { "success": true, "muted_until": "2023-10-27T10:00:00Z" } ``` ``` ```APIDOC ## Get Metrics ### Description Retrieve metrics for a service. ### Method This is a view type method. ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters - **service_name** (str) - Required - Name of the service - **metric_type** (str) - Required - Type of metric (cpu, memory, latency, etc.) #### Query Parameters - **time_range** (str) - Optional - Time range for metrics (default: "1h") ### Request Example ```python provider.get_metrics(service_name="web-server", metric_type="cpu", time_range="24h") ``` ### Response #### Success Response (200) - **metrics** (list) - List of metric data points #### Response Example ```json [ { "timestamp": "2023-10-27T09:00:00Z", "value": 0.75 }, { "timestamp": "2023-10-27T09:05:00Z", "value": 0.78 } ] ``` ``` -------------------------------- ### Install Keep CLI with Pip Source: https://github.com/keephq/keep/blob/main/docs/cli/installation.mdx Install the Keep CLI using pip, ensuring Python 3.11 is used for optimal compatibility. MacOS users may need to install Python and PostgreSQL via Homebrew first. ```shell # MacOS if python or pip not present: # brew install python@3.11 # brew install postgresql pip3.11 install . ``` -------------------------------- ### Base Provider - Start Consumer Source: https://github.com/keephq/keep/blob/main/docs/providers/adding-a-new-provider.mdx This method should be implemented by providers that have a consumer. It is intended to return the consumer instance. If not implemented, it returns None. ```python def start_consume(self): """Get the consumer for the provider. should be implemented by the provider if it has a consumer. for an example, see Kafka Provider Returns: Consumer: The consumer for the provider. """ return ``` -------------------------------- ### CLI Help: Version Command Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/cli-version.mdx Shows the detailed help message for the version command, including available options. ```bash Usage: keep version [OPTIONS] Get the library version. Options: --help Show this message and exit. ``` -------------------------------- ### Run Provider for Manual Testing Source: https://github.com/keephq/keep/blob/main/docs/providers/adding-a-new-provider.mdx Execute your provider directly from the command line to test its initialization and basic capabilities. Ensure you are in the provider's directory. ```bash cd keep python -m keep.providers.yourservice_provider.yourservice_provider ``` -------------------------------- ### Start Proxy Environment in Detached Mode Source: https://github.com/keephq/keep/blob/main/proxy/README.md Command to start the proxy services in detached mode, running in the background. ```bash docker compose -f docker-compose-proxy.yml up -d ``` -------------------------------- ### CLI Help and Options Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/mappings-create.mdx This provides a detailed breakdown of all available options for the 'keep mappings create' command, including required fields and constraints. Use this to construct specific commands. ```bash Usage: keep mappings create [OPTIONS] Create a mapping rule. Options: -n, --name TEXT The name of the mapping. [required] -d, --description TEXT The description of the mapping. -f, --file PATH The mapping file. Must be a CSV file. [required] -m, --matchers TEXT The matchers of the mapping, as a comma- separated list of strings. [required] -p, --priority INTEGER RANGE The priority of the mapping, higher priority means this rule will execute first. [0<=x<=100] --help Show this message and exit. ``` -------------------------------- ### Show CLI Provider Help Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/cli-provider.mdx Displays the general usage and available options for the provider command. Use this to understand the command structure and available subcommands. ```bash Usage: cli provider [OPTIONS] COMMAND [ARGS]... Manage providers. Options: --help Show this message and exit. Commands: connect delete list List providers. ``` -------------------------------- ### CLI Usage: Version Command Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/cli-version.mdx Displays the basic usage instructions for the version command. ```bash Usage: keep version [OPTIONS] ``` -------------------------------- ### Install Keep without Ingress Source: https://github.com/keephq/keep/blob/main/docs/deployment/kubernetes/installation.mdx Installs the Keep application using its Helm chart but disables ingress. This is not recommended for network access. ```bash # Add the Helm repository helm repo add keephq https://keephq.github.io/helm-charts # Install Keep without ingress enabled. # You won't be able to access Keep from the network. helm install keep keephq/keep -n keep --create-namespace \ --set global.ingress.enabled=false ``` -------------------------------- ### Verify HAProxy Ingress Controller Installation Source: https://github.com/keephq/keep/blob/main/docs/deployment/kubernetes/installation.mdx Checks if the HAProxy Ingress controller is installed and running by listing pods in the 'ingress-haproxy' namespace. ```bash kubectl get ingressclass NAME CONTROLLER PARAMETERS AGE haproxy haproxy-ingress.github.io/controller 4h19m kubectl get pods -n ingress-haproxy -l app.kubernetes.io/instance=haproxy-ingress NAME READY STATUS RESTARTS AGE haproxy-ingress-controller-x4n2z 1/1 Running 0 4h19m ``` -------------------------------- ### Navigate to Docker Compose Directory Source: https://github.com/keephq/keep/blob/main/keep/providers/libre_nms_provider/README.md Change directory into the cloned repository and then into the examples/compose subdirectory to access the Docker Compose files. ```bash cd docker cd examples/compose ``` -------------------------------- ### Check ingress-nginx Installation Source: https://github.com/keephq/keep/blob/main/docs/deployment/kubernetes/installation.mdx Verify if the ingress-nginx controller is installed and running in the 'ingress-nginx' namespace. Also checks for the 'nginx' ingress class. ```bash # By default, the ingress-nginx will be installed under the ingress-nginx namespace kubectl -n ingress-nginx get pods NAME READY STATUS RESTARTS AGE ingress-nginx-controller-d49697d5f-hjhbj 1/1 Running 0 4h19m # Or check for the ingress class kubectl get ingressclass NAME CONTROLLER PARAMETERS AGE nginx k8s.io/ingress-nginx 4h19m ``` -------------------------------- ### Teams Workflow Example Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/teams-provider.mdx A basic workflow example for sending a Teams message using adaptive cards. This configuration is for YAML workflows. ```yaml id: 6bc7c72e-ab3d-4913-84dd-08b9323195ae description: Teams Adaptive Cards Example disabled: false triggers: - type: manual - filters: - key: source value: r".*" type: alert consts: {} name: Keep Teams Adaptive Cards owners: [] services: [] steps: [] actions: - name: teams-action provider: config: "{{ providers.teams }}" type: teams with: message: "" sections: '[{"type": "TextBlock", "text": "{{alert.name}}"}, {"type": "TextBlock", "text": "Tal from Keep"}]' typeCard: message # Optional: Add mentions to notify specific users # mentions: '[{"id": "user@example.com", "name": "User Name"}]' ``` -------------------------------- ### Run LiteLLM with Docker Source: https://github.com/keephq/keep/blob/main/docs/deployment/local-llm/keep-with-litellm.mdx Start the LiteLLM proxy server using Docker, exposing it on port 4000 and configuring it to use a HuggingFace model. ```bash docker run -p 4000:4000 litellm/litellm --model huggingface/bigcode/starcoder ``` -------------------------------- ### Site24x7 Provider Setup Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/site24x7-provider.mdx Initialize the Site24x7 Provider with authentication credentials and configuration to enable webhook integration and alert management. ```APIDOC ## Site24x7 Provider Initialization ### Description To use the Site24x7 Provider, initialize it with the necessary authentication credentials and provider configuration. This involves setting up Zoho account credentials (Client ID, Client Secret, and Refresh Token) in the `Site24x7ProviderAuthConfig`. ### Method ```python Site24x7Provider(auth_config: Site24x7ProviderAuthConfig, **kwargs) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from keep.providers.site24x7_provider.site24x7_provider import Site24x7Provider from keep.providers.site24x7_provider.site24x7_provider_auth_config import Site24x7ProviderAuthConfig auth_config = Site24x7ProviderAuthConfig( client_id="your_client_id", client_secret="your_client_secret", refresh_token="your_refresh_token" ) site24x7_provider = Site24x7Provider(auth_config=auth_config) ``` ### Response None ``` -------------------------------- ### Configure and Use Console Provider Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/console-provider.mdx Demonstrates how to configure and use the console provider to send a notification. Ensure the provider_id is set to 'mock' and provider_type to 'console'. ```python config = { "description": "Console Output Provider", "authentication": {}, } provider = ProvidersFactory.get_provider( provider_id='mock', provider_type="console", provider_config=config ) provider.notify( message="Simple alert showing context with name: {name}".format( name="John Doe" ) ) ``` -------------------------------- ### Install ingress-nginx with Helm Source: https://github.com/keephq/keep/blob/main/docs/deployment/kubernetes/installation.mdx Installs or upgrades the ingress-nginx controller using Helm. It enables snippet annotations and sets the risk level for annotations. ```bash # simplest way to install # we set snippet-annotations to true to allow rewrites # see https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#allow-snippet-annotations helm upgrade --install ingress-nginx ingress-nginx \ --repo https://kubernetes.github.io/ingress-nginx \ --set controller.config.allow-snippet-annotations=true \ --set controller.config.annotations-risk-level=Critical \ --namespace ingress-nginx --create-namespace ``` -------------------------------- ### Extraction Create CLI Help Source: https://github.com/keephq/keep/blob/main/docs/cli/commands/extraction-create.mdx Detailed help information for the extraction create command, outlining all available options and their requirements. ```bash Usage: cli.py extraction create [OPTIONS] Create a extraction rule. Options: -n, --name TEXT The name of the extraction. [required] -d, --description TEXT The description of the extraction. -p, --priority INTEGER RANGE The priority of the extraction, higher priority means this rule will execute first. [0<=x<=100] --pre BOOLEAN Whether this rule should be applied before or after the alert is standardized. -a, --attribute TEXT Event attribute name to extract from. [required] -r, --regex TEXT The regex rule to extract by. Regex format should be like python regex pattern for group matching. [required] -c, --condition TEXT CEL based condition. [required] --help Show this message and exit. ``` -------------------------------- ### Spin up Keep with Docker Compose Source: https://github.com/keephq/keep/blob/main/docs/deployment/docker.mdx Use this command to download the start script and spin up Keep with the latest Docker images. ```shell curl https://raw.githubusercontent.com/keephq/keep/main/start.sh | sh ``` -------------------------------- ### Start Checkmk Docker Container Source: https://github.com/keephq/keep/blob/main/keep/providers/checkmk_provider/README.md Launches the Checkmk container with persistent storage, port mappings, and time synchronization. Ensure to map ports 8080 for web UI and 8000 for API access. ```bash docker container run -dit \ -p 8080:5000 \ -p 8000:8000 \ --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 \ -v monitoring:/omd/sites \ --name monitoring \ -v /etc/localtime:/etc/localtime:ro \ --restart always \ checkmk/check-mk-cloud:2.3.0p19 ``` -------------------------------- ### Jira Transition Error Example Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/jira-provider.mdx This example shows the error message returned by the Jira provider when an invalid transition name is specified, listing available transitions. ```text Transition 'Invalid' not found. Available transitions: To Do, In Progress, Done, Closed ``` -------------------------------- ### Example Extraction Rule for Mailgun Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/mailgun-provider.mdx Defines an example extraction rule to parse the 'subject' field of an incoming email. It uses a regular expression to capture the severity. ```regex Key: subject Value: (?P\w+): ``` -------------------------------- ### vLLM Provider Configuration Example Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/vllm-provider.mdx This snippet demonstrates a typical configuration for the vLLM provider, including setting the API endpoint and an optional API key for authentication. Ensure the API URL points to your vLLM deployment. ```javascript import { Keep } from '@keephq/keep-sdk'; const keep = new Keep({ // ... other Keep configurations providers: { vllm: { // Required: The API endpoint of your vLLM deployment api_url: 'http://localhost:8000/v1', // Optional: API key if your deployment requires authentication api_key: 'YOUR_API_KEY', }, }, }); ``` -------------------------------- ### Get Current UTC Datetime Source: https://github.com/keephq/keep/blob/main/docs/workflows/syntax/functions.mdx Use `keep.utcnow` to get the current date and time in Coordinated Universal Time (UTC). This is useful for logging and time-sensitive operations. ```yaml steps: - name: example-step provider: type: mock with: message: keep.utcnow() ``` -------------------------------- ### OpenSearch Serverless Query DSL Example Source: https://github.com/keephq/keep/blob/main/docs/providers/documentation/opensearchserverless-provider.mdx This is an example of a standard OpenSearch query DSL object used for searching documents. It specifies the index to query and the search criteria. ```json { "query": { "match_all": {} }, "size": 1 } ``` -------------------------------- ### Example CEL Expression for Filtering Source: https://github.com/keephq/keep/blob/main/docs/alerts/presets.mdx A practical example of a CEL expression that filters alerts by severity and service. Use this to ensure only critical alerts from specific services are displayed. ```cel severity == 'critical' && service.contains('database') ```