# Examples

SnowKill GitHub repository features a few complete examples, which may help you to get started.

In order to be able to run all examples, please install with SnowKill with extra `examples` option:

```
pip install snowkill[examples]
```

### Environment variables

You may have to set additional environment variables to run examples below. The full list of samples environment variables:

```bash
export SNOWFLAKE_ACCOUNT=ginfuwg-us67634
export SNOWFLAKE_USER=admin_monitor
export SNOWFLAKE_PASSWORD=...

export SNOWFLAKE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----"

export SNOWSIGHT_BASE_URL="https://app.snowflake.com/ginfuwg/us67634/"

export SNOWFLAKE_TARGET_TABLE=utils.monitor.snowkill_log

export POSTGRES_DSN="dbname=snowkill"
export POSTGRES_TARGET_TABLE=snowkill_log

export SLACK_TOKEN="xoxb-..."
export SLACK_CHANNEL="#snowflake-monitor"

export SMTP_HOST=smtp-relay.brevo.com
export SMTP_PORT=587
export SMTP_USER="..."
export SMTP_PASSWORD="xsmtpsib-..."
export SENDER_EMAIL="..."
export RECEIVER_EMAIL="..."
```

### SMTP setup

Some examples feature Slack notifications. The instructions how to set up a Slack applications are available on [Getting Started](https://docs.snowkill.net/getting-started) page.

Some examples feature Email notifications. You may use [Brevo](https://www.brevo.com/) to set up a free SMTP server for testing purposes.

***

### 1) Basic example

{% embed url="<https://github.com/littleK0i/SnowKill/blob/master/example/01_basic.py>" %}

Complete example featuring basic usage of SnowKill:

1. Authorise by password
2. Apply all types of checks
3. Store and deduplicate in Snowflake table
4. Format and send new check results to Slack

### 2) Private key auth

{% embed url="<https://github.com/littleK0i/SnowKill/blob/master/example/02_private_key_auth.py>" %}

An example featuring authorization by private key. It is highly recommended to use private keys for production environment instead of passwords.

### 3) Postgres storage

{% embed url="<https://github.com/littleK0i/SnowKill/blob/master/example/03_postgres.py>" %}

An example featuring Postgres table used as storage for SnowKill logs and deduplication checks. It is recommended to use Postgres or another OLTP database to store SnowKill logs, at least until "UniStore" becomes officially available in Snowflake.

### 4) Markdown email

{% embed url="<https://github.com/littleK0i/SnowKill/blob/master/example/04_markdown_email.py>" %}

An example featuring formatting notification message as markdown and sending it via email. Slack message composition is different from classic markdown syntax. But SnowKill provides a formatter for classic markdown, which can be used with other messenger apps or with different types of notification channels. Email is just an example.

### 5) Filters

{% embed url="<https://github.com/littleK0i/SnowKill/blob/master/example/05_filter.py>" %}

An example featuring use of filters to limit the scope of condition checks.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snowkill.net/examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
