From 4692f12876b2b5696e7d8cb063a6dbf992f9ee30 Mon Sep 17 00:00:00 2001 From: Spencer Grimes Date: Fri, 15 Aug 2025 14:06:47 -0500 Subject: [PATCH] docs: Add README.md --- README.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c8a9267 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +# LLM-Powered Monitoring Agent + +This project is a self-hosted monitoring agent that uses a local Large Language Model (LLM) to detect anomalies in system and network data. It's designed to be a simple, self-contained Python script that can be easily deployed on a server. + +## 1. Installation + +To get started, you'll need to have Python 3.8 or newer installed. Then, follow these steps: + +1. **Clone the repository or download the files:** + + ```bash + git clone + cd + ``` + +2. **Create and activate a Python virtual environment:** + + ```bash + python -m venv venv + source venv/bin/activate # On Windows, use `venv\Scripts\activate` + ``` + +3. **Install the required Python libraries:** + + ```bash + pip install -r requirements.txt + ``` + +## 2. Setup + +Before running the agent, you need to configure it and ensure the necessary services are running. + +### Prerequisites + +- **Ollama:** The agent requires that [Ollama](https://ollama.com/) is installed and running on the server. +- **LLM Model:** You must have the `llama3.1:8b` model pulled and available in Ollama. You can pull it with the following command: + + ```bash + ollama pull llama3.1:8b + ``` + +### Configuration + +All configuration is done in the `config.py` file. You will need to replace the placeholder values with your actual credentials and URLs. + +- `DISCORD_WEBHOOK_URL`: Your Discord channel's webhook URL. This is used to send alerts. +- `HOME_ASSISTANT_URL`: The URL of your Home Assistant instance (e.g., `http://192.168.1.50:8123`). +- `HOME_ASSISTANT_TOKEN`: A Long-Lived Access Token for your Home Assistant instance. You can generate this in your Home Assistant profile settings. +- `GOOGLE_HOME_SPEAKER_ID`: The `media_player` entity ID for your Google Home speaker in Home Assistant (e.g., `media_player.kitchen_speaker`). + +## 3. Usage + +Once the installation and setup are complete, you can run the monitoring agent with the following command: + +```bash +python monitor_agent.py +``` + +The script will start a continuous monitoring loop. Every 5 minutes, it will: + +1. Collect simulated system and network data. +2. Send the data to the local LLM for analysis. +3. If the LLM detects an anomaly, it will send an alert to your configured Discord channel and broadcast a message to your Google Home speaker via Home Assistant. + +The script will print its status and any detected anomalies to the console.