{"id":26678357,"url":"https://github.com/telexintegrations/haproxy-monitor","last_synced_at":"2025-10-07T00:38:18.046Z","repository":{"id":278784541,"uuid":"936763847","full_name":"telexintegrations/HAProxy-monitor","owner":"telexintegrations","description":"An output and Interval integration to monitor HAProxy through telex","archived":false,"fork":false,"pushed_at":"2025-02-24T08:41:08.000Z","size":148,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T05:15:29.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/telexintegrations.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}},"created_at":"2025-02-21T16:39:27.000Z","updated_at":"2025-02-24T08:41:11.000Z","dependencies_parsed_at":"2025-02-21T17:44:47.210Z","dependency_job_id":"acd61402-a959-4d26-af4c-c93fb94cb003","html_url":"https://github.com/telexintegrations/HAProxy-monitor","commit_stats":null,"previous_names":["telexintegrations/haproxy-monitor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/telexintegrations/HAProxy-monitor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FHAProxy-monitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FHAProxy-monitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FHAProxy-monitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FHAProxy-monitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telexintegrations","download_url":"https://codeload.github.com/telexintegrations/HAProxy-monitor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FHAProxy-monitor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263233955,"owners_count":23434890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-03-26T05:15:31.670Z","updated_at":"2025-10-07T00:38:13.001Z","avatar_url":"https://github.com/telexintegrations.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HAProxy Monitor\n\nAn integration for monitoring HAProxy statistics through Telex webhooks. This service collects HAProxy metrics and sends formatted reports to specified Telex channels at configured intervals.\n\n## Features\n\n- Real-time HAProxy statistics monitoring\n- Customizable monitoring intervals\n- Detailed health reports including:\n  - Backend server status\n  - Session statistics\n  - Error tracking and breakdown\n  - Response time metrics\n- Secure authentication support\n- Webhook integration with Telex\n\n## Prerequisites\n\n- Python 3.8+\n- HAProxy instance with stats endpoint enabled\n- Telex webhook URL\n\n## Installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/yourusername/haproxy-monitor.git\ncd haproxy-monitor\n```\n\n2. Create and activate a virtual environment:\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n3. Install dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n## Configuration\n\nThe application requires the following configuration:\n\n1. HAProxy Stats Endpoint URL\n2. Authentication credentials (if enabled)\n3. Telex webhook URL\n4. Monitoring interval (cron format)\n\n## Usage\n\n1. Start the FastAPI server:\n\n```bash\nuvicorn app.main:app --host 0.0.0.0 --port 8000\n```\n\n2. The integration endpoint will be available at:\n\n- Integration configuration: `GET /integration.json`\n- Monitoring endpoint: `POST /tick`\n\n## API Endpoints\n\n### GET /integration.json\n\nReturns the integration configuration including:\n\n- Application metadata\n- Required settings\n- Permissions\n- Integration type and category\n\n### POST /tick\n\nTriggers the monitoring check and sends reports to Telex.\n\nRequired payload structure:\n\n```json\n{\n    \"channel_id\": \"string\",\n    \"return_url\": \"string\",\n    \"settings\": [\n        {\n            \"label\": \"string\",\n            \"type\": \"string\",\n            \"required\": boolean,\n            \"default\": \"string\"\n        }\n    ]\n}\n```\n\n## Monitoring Output\n\nThe monitor generates detailed reports including:\n\n- Backend server status (UP/DOWN)\n- Total sessions handled\n- Server uptime\n- Failed health checks\n- Current and maximum queue lengths\n- Response times\n- Error statistics\n\n## Example Report\n\n![HAProxy Monitor Report](static/screenshot.png)\n\nThis is an example of a health report sent to your Telex channel showing:\n\n- Backend servers' status with UP/DOWN indicators\n- Session statistics for each backend\n- Error counts and breakdowns\n- Response time metrics in milliseconds\n\n## Setting up with Telex\n\n### Prerequisites Setup\n\n1. HAProxy Load Balancer Setup:\n\n   - Install and configure HAProxy on your server\n   - Configure HAProxy as a load balancer for your backend services\n   - Ensure your HAProxy configuration is properly routing traffic\n\n2. Enable HAProxy Statistics:\n   - Add the following to your HAProxy configuration file (/etc/haproxy/haproxy.cfg):\n   ```conf\n   listen stats\n    bind *:9000\n    stats refresh 60s\n    stats uri /haproxy_stats\n    stats auth admin:admin # Replace with secure credentials\n   ```\n   - Restart HAProxy to apply changes:\n   ```bash\n   sudo systemctl restart haproxy\n   ```\n\n### Telex Integration Setup\n\n1. Access your Telex organization dashboard\n2. Navigate to the channel where you want to receive HAProxy monitoring alerts\n3. Click on \"Add Integration\" and search for \"HAProxy Monitor\"\n4. Configure the required settings:\n   - **Interval**: How often to check HAProxy stats (e.g., \"_/5 _ \\* \\* \\*\" for every 5 minutes)\n   - **Stats Endpoint**: Your HAProxy stats URL (e.g., \"http://your-haproxy:9000/haproxy_stats;csv\")\n   - **Username**: Stats page username (as configured in haproxy.cfg)\n   - **Password**: Stats page password (as configured in haproxy.cfg)\n5. Click \"Save\" to activate the integration\n\n### Verification\n\n1. The integration will start sending reports based on your configured interval\n2. You should receive a health report in your Telex channel containing:\n   - Backend server status\n   - Session statistics\n   - Error counts\n   - Response time metrics\n\n### Troubleshooting\n\n- Ensure your HAProxy stats endpoint is accessible from the internet\n- Verify the authentication credentials match your HAProxy configuration\n- Check that your firewall allows access to the stats endpoint port\n- Monitor the HAProxy logs for any authentication failures\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Notes\n\n- The integration is currently configured to run every minute for testing purposes.\n- Initially, I was getting the stats from the HAProxy server directly through the stats socket, but unless you are running the integration on the same machine as the HAProxy server, you will need to use the stats endpoint instead. Future integrations will improve this.\n- The next integration will be to monitor the HAProxy server and the backend servers and send alerts if they go down.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fhaproxy-monitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelexintegrations%2Fhaproxy-monitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fhaproxy-monitor/lists"}