{"id":29225655,"url":"https://github.com/sxwebdev/sentinel","last_synced_at":"2025-07-03T07:11:18.938Z","repository":{"id":302465118,"uuid":"1012515358","full_name":"sxwebdev/sentinel","owner":"sxwebdev","description":"🛡️ Multi-protocol service monitoring system with real-time alerts and web dashboard. Supports HTTP/HTTPS, TCP, gRPC, and Redis monitoring with Telegram notifications.","archived":false,"fork":false,"pushed_at":"2025-07-02T13:56:57.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-02T14:47:34.331Z","etag":null,"topics":["alertmanager","devops","devops-tools","golang","monitoring"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sxwebdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-07-02T12:57:52.000Z","updated_at":"2025-07-02T13:58:51.000Z","dependencies_parsed_at":"2025-07-02T14:47:44.478Z","dependency_job_id":"d0867eca-181c-485c-851a-cea233319203","html_url":"https://github.com/sxwebdev/sentinel","commit_stats":null,"previous_names":["sxwebdev/sentinel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sxwebdev/sentinel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwebdev%2Fsentinel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwebdev%2Fsentinel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwebdev%2Fsentinel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwebdev%2Fsentinel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sxwebdev","download_url":"https://codeload.github.com/sxwebdev/sentinel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxwebdev%2Fsentinel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263279305,"owners_count":23441683,"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":["alertmanager","devops","devops-tools","golang","monitoring"],"created_at":"2025-07-03T07:11:18.351Z","updated_at":"2025-07-03T07:11:18.919Z","avatar_url":"https://github.com/sxwebdev.png","language":"Go","readme":"# Sentinel - Service Monitoring System\n\nSentinel is a lightweight, multi-protocol service monitoring system written in Go. It monitors HTTP/HTTPS, TCP, gRPC, and Redis services, providing real-time status updates and incident management with Telegram notifications.\n\n## Features\n\n- **Multi-Protocol Support**: HTTP/HTTPS, TCP, gRPC, Redis\n- **Real-time Monitoring**: Configurable check intervals and timeouts\n- **Incident Management**: Automatic incident creation and resolution\n- **Telegram Notifications**: Alert and recovery notifications\n- **Web Dashboard**: Clean, responsive web interface\n- **REST API**: Full API for integration with other tools\n- **Persistent Storage**: Incident history using ChainDB\n- **Configuration**: YAML-based configuration with environment variable support\n\n## Quick Start\n\n### Using Docker Compose (Recommended)\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/sxwebdev/sentinel\ncd sentinel\n```\n\n2. Create environment file:\n\n```bash\ncp .env.example .env\n# Edit .env with your Telegram bot credentials\n```\n\n3. Start the services:\n\n```bash\ndocker-compose up -d\n```\n\n4. Access the dashboard at http://localhost:8080\n\n### Manual Installation\n\n1. Install Go 1.21 or later\n2. Clone and build:\n\n```bash\ngit clone https://github.com/sxwebdev/sentinel\ncd sentinel\ngo mod download\ngo build -o sentinel ./cmd/server\n```\n\n3. Configure your services in `config.yaml`\n4. Set environment variables:\n\n```bash\nexport TELEGRAM_BOT_TOKEN=\"your_bot_token\"\nexport TELEGRAM_CHAT_ID=\"your_chat_id\"\n```\n\n5. Run:\n\n```bash\n./sentinel\n```\n\n## Configuration\n\n### Basic Configuration\n\nCreate a `config.yaml` file:\n\n```yaml\nserver:\n  port: 8080\n  host: \"0.0.0.0\"\n\nmonitoring:\n  global:\n    default_interval: 30s\n    default_timeout: 10s\n    default_retries: 3\n\ndatabase:\n  path: \"./data/incidents.db\"\n\ntelegram:\n  bot_token: \"${TELEGRAM_BOT_TOKEN}\"\n  chat_id: \"${TELEGRAM_CHAT_ID}\"\n  enabled: true\n\nservices:\n  - name: \"my-api\"\n    protocol: \"http\"\n    endpoint: \"https://api.example.com/health\"\n    interval: 60s\n    timeout: 5s\n    retries: 2\n    tags: [\"api\", \"critical\"]\n    config:\n      method: \"GET\"\n      expected_status: 200\n      headers:\n        Authorization: \"Bearer token\"\n```\n\n### Protocol-Specific Configuration\n\n#### HTTP/HTTPS\n\n```yaml\n- name: \"web-service\"\n  protocol: \"http\"\n  endpoint: \"https://example.com/health\"\n  config:\n    method: \"GET\" # HTTP method\n    expected_status: 200 # Expected status code\n    expected_text: \"OK\" # Optional: text to find in response\n    headers: # Optional: custom headers\n      User-Agent: \"Sentinel\"\n    body: '{\"ping\": \"pong\"}' # Optional: request body\n```\n\n#### TCP\n\n```yaml\n- name: \"database\"\n  protocol: \"tcp\"\n  endpoint: \"db.example.com:5432\"\n  config:\n    send_data: \"ping\" # Optional: data to send\n    expect_data: \"pong\" # Optional: expected response\n```\n\n#### gRPC\n\n```yaml\n- name: \"grpc-service\"\n  protocol: \"grpc\"\n  endpoint: \"grpc.example.com:50051\"\n  config:\n    service_name: \"myapp.MyService\" # Optional: specific service name\n    tls: true # Use TLS\n    server_name: \"grpc.example.com\" # TLS server name\n    insecure_tls: false # Skip TLS verification\n```\n\n#### Redis\n\n```yaml\n- name: \"redis-cache\"\n  protocol: \"redis\"\n  endpoint: \"redis.example.com:6379\"\n  config:\n    password: \"secret\" # Optional: Redis password\n    db: 0 # Redis database number\n```\n\n## Telegram Setup\n\n1. Create a Telegram bot:\n\n   - Message @BotFather on Telegram\n   - Send `/newbot` and follow instructions\n   - Save the bot token\n\n2. Get your chat ID:\n\n   - Add the bot to your group/channel\n   - Send a message to the bot\n   - Visit `https://api.telegram.org/bot\u003cTOKEN\u003e/getUpdates`\n   - Find your chat ID in the response\n\n3. Set environment variables:\n\n```bash\nexport TELEGRAM_BOT_TOKEN=\"1234567890:ABCdefGHIjklMNOpqrsTUVwxyz\"\nexport TELEGRAM_CHAT_ID=\"-1001234567890\"\n```\n\n## API Reference\n\n### Get All Services\n\n```bash\nGET /api/services\n```\n\n### Get Service Details\n\n```bash\nGET /api/services/{name}\n```\n\n### Get Service Incidents\n\n```bash\nGET /api/services/{name}/incidents\n```\n\n### Get Service Statistics\n\n```bash\nGET /api/services/{name}/stats?days=30\n```\n\n### Trigger Manual Check\n\n```bash\nPOST /api/services/{name}/check\n```\n\n### Get Recent Incidents\n\n```bash\nGET /api/incidents?limit=50\n```\n\n## Web Interface\n\n- **Dashboard** (`/`): Overview of all services\n- **Service Detail** (`/service/{name}`): Detailed view with incident history\n- **Auto-refresh**: Dashboard refreshes every 30 seconds\n\n## Monitoring Logic\n\n1. **Health Checks**: Each service is checked at configured intervals\n2. **Retry Logic**: Failed checks are retried with exponential backoff\n3. **State Changes**: Status changes trigger incident creation/resolution\n4. **Notifications**: Alerts sent only on status changes (UP ↔ DOWN)\n\n## Development\n\n### Project Structure\n\n```\nsentinel/\n├── cmd/server/           # Main application\n├── internal/\n│   ├── config/          # Configuration management\n│   ├── monitors/        # Protocol-specific monitors\n│   ├── storage/         # Data persistence\n│   ├── notifier/        # Notification system\n│   ├── scheduler/       # Monitoring scheduler\n│   ├── service/         # Business logic\n│   └── web/             # Web interface\n├── web/\n│   ├── static/          # CSS, JS, images\n│   └── templates/       # HTML templates\n└── config.yaml          # Configuration file\n```\n\n### Adding New Protocols\n\n1. Implement the `ServiceMonitor` interface in `internal/monitors/`\n2. Add protocol detection in `monitors.NewMonitor()`\n3. Update configuration validation in `config/config.go`\n\n### Building\n\n```bash\n# Development build\ngo build -o sentinel ./cmd/server\n\n# Production build with optimizations\nCGO_ENABLED=0 go build -ldflags=\"-w -s\" -o sentinel ./cmd/server\n\n# Cross-compile for Linux\nGOOS=linux GOARCH=amd64 go build -o sentinel-linux ./cmd/server\n```\n\n## Deployment\n\n### Systemd Service\n\nCreate `/etc/systemd/system/sentinel.service`:\n\n```ini\n[Unit]\nDescription=Sentinel Service Monitor\nAfter=network.target\n\n[Service]\nType=simple\nUser=sentinel\nWorkingDirectory=/opt/sentinel\nExecStart=/opt/sentinel/sentinel\nRestart=always\nRestartSec=5\nEnvironment=TELEGRAM_BOT_TOKEN=your_token\nEnvironment=TELEGRAM_CHAT_ID=your_chat_id\n\n[Install]\nWantedBy=multi-user.target\n```\n\nEnable and start:\n\n```bash\nsudo systemctl enable sentinel\nsudo systemctl start sentinel\n```\n\n### Docker\n\n```bash\n# Build image\ndocker build -t sentinel .\n\n# Run container\ndocker run -d \\\n  --name sentinel \\\n  -p 8080:8080 \\\n  -e TELEGRAM_BOT_TOKEN=\"your_token\" \\\n  -e TELEGRAM_CHAT_ID=\"your_chat_id\" \\\n  -v ./data:/root/data \\\n  sentinel\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests\n5. Submit a pull request\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Support\n\n- GitHub Issues: https://github.com/sxwebdev/sentinel/issues\n- Documentation: https://github.com/sxwebdev/sentinel/wiki\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxwebdev%2Fsentinel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsxwebdev%2Fsentinel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxwebdev%2Fsentinel/lists"}