{"id":22264834,"url":"https://github.com/xza85hrf/ollama_monitor","last_synced_at":"2026-03-01T12:31:33.056Z","repository":{"id":249314373,"uuid":"831155612","full_name":"Xza85hrf/Ollama_monitor","owner":"Xza85hrf","description":"Ollama Monitor is a Python script designed to test connectivity and performance of an Ollama server. It provides functionality for endpoint checking, load testing, and optional Prometheus metrics export.","archived":false,"fork":false,"pushed_at":"2025-11-16T19:24:19.000Z","size":74,"stargazers_count":8,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-16T21:06:39.074Z","etag":null,"topics":["cli-tools","endpoint-monitoring","health-check","performance-testing","python","server-monitoring"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xza85hrf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-19T19:46:16.000Z","updated_at":"2025-11-16T19:20:44.000Z","dependencies_parsed_at":"2025-01-30T12:46:31.998Z","dependency_job_id":"3d4c1e55-9a6e-46f9-a1e7-701e01303291","html_url":"https://github.com/Xza85hrf/Ollama_monitor","commit_stats":null,"previous_names":["xza85hrf/ollama_monitor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Xza85hrf/Ollama_monitor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xza85hrf%2FOllama_monitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xza85hrf%2FOllama_monitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xza85hrf%2FOllama_monitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xza85hrf%2FOllama_monitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xza85hrf","download_url":"https://codeload.github.com/Xza85hrf/Ollama_monitor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xza85hrf%2FOllama_monitor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29969243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T11:43:06.159Z","status":"ssl_error","status_checked_at":"2026-03-01T11:43:03.887Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-tools","endpoint-monitoring","health-check","performance-testing","python","server-monitoring"],"created_at":"2024-12-03T10:12:19.485Z","updated_at":"2026-03-01T12:31:33.037Z","avatar_url":"https://github.com/Xza85hrf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ollama Monitor\n\nOllama Monitor is a Python tool designed to help developers monitor the connectivity and performance of an Ollama server. Whether you're testing in development or conducting load tests in production, this tool ensures your API endpoints are healthy and functioning as expected.\n\n## Features\n\n- **Endpoint Health Checks**: Monitor API endpoints and measure their response times.\n- **Load Testing**: Test the load capacity of your Ollama server with customizable concurrency levels.\n- **Prometheus Metrics Export**: Easily expose performance metrics in Prometheus format.\n- **Configurable via YAML or CLI**: Customize your tests and settings with a configuration file or command-line arguments.\n\n## Installation\n\n### Prerequisites\n\n- Python 3.12 or higher\n- Docker (optional, for containerized deployment)\n\n### Install Locally\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/your-repo/ollama-monitor.git\n   cd ollama-monitor\n   ```\n\n2. Install the required dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n### Docker Setup\n\n1. Build the Docker image:\n   ```bash\n   docker build -t ollama-monitor .\n   ```\n\n2. Run the container:\n   ```bash\n   docker run -p 8000:8000 ollama-monitor\n   ```\n\nThis will expose Prometheus metrics on port 8000.\n\n## Configuration\n\nYou can configure the Ollama Monitor via a YAML file or use command-line options. Below is a minimal example configuration file:\n\n### `config.yaml` Example:\n\n```yaml\nbase_url: \"http://host.docker.internal:11434\"\ntimeout: 30\nendpoints:\n  \"/\":\n    path: \"/\"\n    method: \"GET\"\n    expected_status: 200\n  \"/api/generate\":\n    path: \"/api/generate\"\n    method: \"POST\"\n    expected_status: 200\n    headers:\n      Content-Type: \"application/json\"\n    body: {\"model\": \"llama3.1\", \"prompt\": \"Provide a summary of AI\", \"format\": \"json\", \"stream\": false}\n```\n\n## Usage\n\n### Basic Check\n\nRun the monitor using a default configuration:\n```bash\npython ollama_monitor.py\n```\n\n### Using a Custom Configuration File\n\nYou can specify a custom configuration file:\n```bash\npython ollama_monitor.py --config config.yaml\n```\n\n### Running with Prometheus Metrics\n\nEnable Prometheus metrics export:\n```bash\npython ollama_monitor.py --config config.yaml --prometheus\n```\n\n## Logging\n\nLogs are streamed to the console (`/dev/stdout`). A typical log entry includes:\n\n- Endpoint URL\n- Response status code\n- Response time\n- Errors (if any)\n\n## Load Testing\n\nTo perform load testing, specify the number of requests and concurrency level:\n```bash\npython ollama_monitor.py --load-test --num-requests 1000 --concurrency 20\n```\n\n## Environment Variables\n\n| Variable          | Description                                          | Default                  |\n|-------------------|------------------------------------------------------|--------------------------|\n| `OLLAMA_API_BASE`  | Base URL of the Ollama server                        | `http://127.0.0.1:11435`  |\n| `DEFAULT_TIMEOUT`  | Request timeout in seconds                           | `10`                     |\n| `RETRY_ATTEMPTS`   | Number of retry attempts                             | `3`                      |\n| `RETRY_DELAY`      | Delay between retries in seconds                     | `2`                      |\n\n## Report Generation\n\nThe monitor generates reports summarizing endpoint performance, including response times and status codes. Example report output:\n```\nOllama Monitor Report\n=====================\n\nEndpoint 1:\n  Status Code: 200\n  Response Time: 0.75 seconds\n\nEndpoint 2: An error occurred - TimeoutException\n```\n\n## Contributing\n\nContributions are welcome! Feel free to submit pull requests or issues.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxza85hrf%2Follama_monitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxza85hrf%2Follama_monitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxza85hrf%2Follama_monitor/lists"}