Iris is a comprehensive alert management and notification system designed to receive alerts from monitoring systems like Grafana and AlertManager, and dispatch notifications through multiple channels including SMS and email.
- Alert Management: Receive, store, and manage alerts from AlertManager
- Multi-Channel Notifications: Support for SMS (Kavenegar, Smsir)
- User & Role Management: Complete RBAC (Role-Based Access Control) system
- Group Management: Organize users into groups for efficient alert routing
- Web Dashboard: React-based web interface for monitoring and managing alerts
- Notification Providers: Configurable priority-based notification provider system
- Schedulers: Background workers for processing alerts and messages
- RESTful API: Comprehensive REST API for integration
- JWT Authentication: Secure token-based authentication
- CAPTCHA Support: Built-in CAPTCHA for user registration
├── cmd/server/ # Application entry point
├── internal/ # Internal application code
│ ├── bootstrap/ # Application initialization
│ ├── config/ # Configuration management
│ ├── logging/ # Logging setup
│ ├── schedulers/ # Background schedulers
│ ├── server/ # HTTP server setup
│ └── storage/ # Database connections
├── pkg/ # Reusable packages
│ ├── alerts/ # Alert management
│ ├── auth/ # Authentication
│ ├── groups/ # Group management
│ ├── http/ # HTTP handlers and middleware
│ ├── message/ # Message handling
│ ├── notifications/ # Notification providers
│ ├── roles/ # Role management
│ ├── storage/ # Data repositories
│ └── user/ # User management
├── migrations/ # Database migrations
└── web/ # React frontend application
- Go: 1.23.0 or higher
- PostgreSQL: 13 or higher
- Node.js: 16 or higher (for web frontend)
- Git: For version control
git clone https://github.com/lyralab/iris.git
cd irisgo mod downloadcd web
npm install
cd ..Create a PostgreSQL database:
CREATE DATABASE iris;
CREATE USER iris_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE iris TO iris_user;The application automatically runs migrations on startup, or you can run them manually:
# Migrations are located in the migrations/ directory
# They will be executed automatically when the application startsIris uses environment variables for configuration. Create a .env file in the root directory with the following variables:
# Database Configuration
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DATABASE_NAME=iris
POSTGRES_USER=iris_user
POSTGRES_PASS=your_password
POSTGRES_SSL=false
# HTTP Server Configuration
HTTP_PORT=9090
# Security
JWT_SECRET=your-secret-jwt-key-change-this-in-production
ADMIN_PASS=your-admin-password
# Application Mode
GO_ENV=debug # Use "release" for production
SIGNUP_ENABLED=true # Set to false to disable user registrationKAVENEGAR_API_TOKEN=your-kavenegar-api-token
KAVENEGAR_SENDER=your-sender-number
KAVENEGAR_ENABLED=true
KAVENEGAR_PRIORITY=1 # Lower number = higher prioritySMSIR_API_TOKEN=your-smsir-api-token
SMSIR_LINE_NUMBER=your-smsir-line-number
SMSIR_ENABLED=false
SMSIR_PRIORITY=2EMAIL_HOST=smtp.example.com
EMAIL_PORT=587
[email protected]
EMAIL_PASSWORD=your-email-password
[email protected]
EMAIL_ENABLED=false# Mobile/SMS Scheduler
MOBILE_SCHEDULER_START_AT=1s
MOBILE_SCHEDULER_INTERVAL=600s
MOBILE_SCHEDULER_WORKERS=1
MOBILE_SCHEDULER_QUEUE_SIZE=1
MOBILE_SCHEDULER_CACHE_CAPACITY=1
# Alert Scheduler
ALERT_SCHEDULER_START_AT=2s
ALERT_SCHEDULER_INTERVAL=10s
ALERT_SCHEDULER_WORKERS=1
ALERT_SCHEDULER_QUEUE_SIZE=10
# Message Status Scheduler
MESSAGE_STATUS_START_AT=10s
MESSAGE_STATUS_INTERVAL=10s
MESSAGE_STATUS_WORKERS=10
MESSAGE_STATUS_QUEUE_SIZE=100See .env.example for a complete configuration template.
# From the project root
go run cmd/server/main.goThe API server will start on http://localhost:9090 (or your configured HTTP_PORT).
# In a separate terminal
cd web
npm startThe web interface will be available at http://localhost:3000.
go build -o iris cmd/server/main.go./iriscd web
npm run buildThe production build will be created in the web/build directory. Serve it using a web server like Nginx or Apache.
Most endpoints require JWT authentication. Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
POST /v1/users/create
Content-Type: application/json
{
"username": "john.doe",
"firstname": "John",
"lastname": "Doe",
"password": "SecurePass123!",
"confirm-password": "SecurePass123!",
"email": "[email protected]"
}POST /v1/users/signin
Content-Type: application/json
{
"username": "john.doe",
"password": "SecurePass123!"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"username": "john.doe",
"role": "viewer"
}
}POST /v1/users/verify
Authorization: Bearer <admin-token>
Content-Type: application/json
{
"username": "john.doe"
}GET /v0/alerts
Authorization: Bearer <token>GET /v0/alerts/{alert_id}
Authorization: Bearer <token>GET /v0/alerts/?page=1&pagination=10&status=firing
Authorization: Bearer <token>Status values: firing, resolved
GET /v0/alerts/firingCount
Authorization: Bearer <token>not implemented yet
POST /v1/messages/alertmanager
Authorization: Basic admin:<ADMIN_PASS>
Content-Type: application/json
{
"version": "4",
"groupKey": "alert-group-1",
"status": "firing",
"receiver": "iris-webhook",
"alerts": [
{
"status": "firing",
"labels": {
"alertName": "HighCPU",
"method": "sms",
"receptor": "admin",
"severity": "critical"
},
"annotations": {
"summary": "CPU usage is above 90%"
},
"startsAt": "2024-01-12T12:34:32.908Z",
"fingerprint": "unique-fingerprint-123"
}
]
}GET /healthResponse:
{
"status": "healthy"
}For proper routing of notifications, include these labels in your alerts:
- receptor: The recipient's phone number or username (required)
- method: Notification method -
sms,call, oremail(required) - alertname: Name of the alert
- severity: Alert severity level (e.g.,
critical,warning,info)
Example Grafana alert configuration:
{
"labels": {
"alertname": "HighMemoryUsage",
"receptor": "group_name_1,group_name_2",
"method": "sms",
"severity": "critical"
},
"annotations": {
"summary": "Memory usage is above 80%",
"description": "Server XYZ has memory usage of 85%"
}
}The web dashboard provides:
- Dashboard: Overview of firing and resolved alerts
- Alert List: Paginated list of all alerts
- Alert Details: Detailed view of individual alerts
- User Authentication: Sign in to access the dashboard
Update web/src/config.js to point to your API server:
const base_url = 'http://127.0.0.1:9090';
const config = {
api: {
alertSummary: base_url + '/v0/alerts/firingCount',
firingIssues: base_url + '/v0/alerts/?page=1&pagination=10&status=firing',
resolvedIssues: base_url + '/v0/alerts/?page=1&pagination=10&status=resolved',
signin: base_url + '/v1/users/signin',
},
};
export default config;The system uses the following main tables:
- alerts: Stores all alert information
- users: User accounts
- roles: User roles and permissions
- groups: User groups for organization
- user_groups: Many-to-many relationship between users and groups
- providers: Notification provider configuration
- message: Outgoing notification messages
- Change Default Passwords: Always change the default admin password
- JWT Secret: Use a strong, unique JWT secret in production
- HTTPS: Use HTTPS in production environments
- Database Security: Use strong database passwords and restrict access
- API Keys: Keep notification provider API keys secure
- Disable Signup: Set
SIGNUP_ENABLED=falsein production if you don't want open registration
-
Error: "JWT_SECRET not set"
- Solution: Set the
JWT_SECRETenvironment variable
- Solution: Set the
-
Error: Database connection failed
- Solution: Check database credentials and ensure PostgreSQL is running
- Check that the appropriate notification provider is enabled
- Verify API tokens are correct
- Check scheduler configuration
- Review application logs for errors
- Verify the backend is running
- Check the
base_urlinweb/src/config.js - Ensure CORS is properly configured
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run specific package tests
go test ./pkg/alerts/...- Follow Go best practices and conventions
- Use meaningful variable and function names
- Add comments for exported functions
- Write tests for new features
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is proprietary software. All rights reserved.
For issues and questions:
- Create an issue on GitHub
- Contact the development team
- Initial release
- Alert management system
- Multi-channel notifications
- User and role management
- Web dashboard
- AlertManager integration