Keira is a high-performance web server monitoring application built with PHP 8.3 and amphp. It allows you to monitor multiple servers at high frequency (e.g., 100 servers every 500ms) and provides real-time alerts when issues are detected.
- High-frequency monitoring: Monitor hundreds of servers with configurable intervals
- Real-time alerts: Get instant Slack notifications when servers experience issues
- WebSocket support: Real-time updates via WebSocket
- RESTful API: Access monitoring data via a simple API
- Signal handling: Control the application with UNIX signals
- Configurable thresholds: Set custom alert thresholds for each server
- TLS error handling: Option to ignore TLS certificate errors
- 24-hour data retention: Automatically cleans up old monitoring data
- PHP 8.3+
- amphp libraries
# Clone the repository
git clone https://github.com/uzulla/Keira.git
cd Keira
# Install dependencies
composer install
Create a configuration file in JSON format:
{
"slack": {
"webhook_url": "https://hooks.slack.com/services/T00000000/B0000000/XXXXXXXXXXXXXXXXXXXXXXXX",
"channel": "#alerts-channel"
},
"monitors": [
{
"id": "service-api-1",
"url": "https://example.com/api/health",
"interval_ms": 500,
"timeout_ms": 1000,
"expected_status": 200,
"expected_content": "OK",
"alert_threshold": 3,
"ignore_tls_error": true,
"is_active": true
}
]
}
# Start the monitor with a configuration file (command line argument)
php bin/keira.php --config=/path/to/config.json
# Alternatively, use an environment variable to specify the config path
export KEIRA_CONFIG_PATH=/path/to/config.json
php bin/keira.php
# Build the Docker image
docker build -t keira .
# Run Keira
docker run keira
# Run Keira and if you want to kill with C-c
docker run -it keira
# Run Keira with a your configuration file.
docker run -v /path/to/your/config.json:/keira/config.json keira
# Expose API and WebSocket ports
docker run -v /path/to/your/config.json:/keira/config.json -p 8080:8080 -p 8081:8081 keira
SIGHUP
: Reload configuration (preserves monitoring data)SIGUSR1
: Pause monitoring (preserves data)SIGUSR2
: Resume monitoring
GET /monitors
: List all monitorsGET /monitor/{id}
: Get status of a specific monitor- WebSocket
/realtime/
: Real-time monitoring updates
MIT