Aegira Documentation

Everything you need to install, configure, and use Aegira.

Install

terminal
# Download
$ wget https://github.com/talatsajafa/Aegira-free-v1-releases/releases/download/v1.0.0/aegira-free-v1.0.0-x86_64.tar.gz
$ tar -xzf aegira-free-v1.0.0-x86_64.tar.gz

# Install (prompts for target)
$ sudo ./install.sh

Requires Linux x86_64. Docker is optional. The installer will guide you through target setup and optional email alerts.

Commands

Command Description
sudo aegira installInstall the Aegira service
sudo aegira statusCheck if Aegira is running
sudo aegira runStart monitoring in foreground
sudo aegira historyView past incidents
sudo aegira show-rulesList active rules (short)
sudo aegira rules listList all active rules (detailed)
sudo aegira rules show <id>View rule details
sudo aegira rules exportExport all rules as JSON
sudo aegira rules disable <id>Disable a rule
sudo aegira rules enable <id>Enable a disabled rule
sudo aegira configure service <name>Set target systemd service
sudo aegira configure container <name>Set target Docker container
sudo aegira configure multi <c1> <c2> ...Set multiple target containers
sudo aegira configure auto <name> [--container]Auto-configure service or container
sudo aegira configure alerts <on|off> [email]Enable/disable email alerts
sudo aegira docker-status <name>Inspect a container's state
aegira --helpShow usage

Custom Rules

Aegira Free allows up to 3 custom rules. Place JSON files in /etc/aegira/rules/custom/.

Adding a Custom Rule

  1. Create a JSON file in /etc/aegira/rules/custom/
    $ sudo nano /etc/aegira/rules/custom/my-rule.json
  2. Paste your rule JSON (see example below). Free allows up to 3 custom rules. Pro is unlimited.
  3. Reload Aegira:
    $ sudo systemctl restart aegira.service
  4. Verify it loaded:
    $ sudo aegira rules list
example.json
{
  "id": "redis_restart",
  "name": "Restart Redis on connection error",
  "severity": "high",
  "error_patterns": [
    "redis connection failed",
    "redis connection refused"
  ],
  "context_patterns": ["redis"],
  "trigger": {"type": "log"},
  "remediation": {
    "type": "service_restart",
    "service": "redis"
  },
  "verification": {
    "type": "service_active",
    "service": "redis"
  },
  "action": "auto_recover",
  "priority": 50
}

Rule Fields Reference

Field Required Description
idYesUnique rule ID (lowercase, no spaces)
nameYesHuman-readable name
severityNolow / medium / high / critical
error_patternsYesLog substrings that trigger the rule
context_patternsNoAdditional context substrings (higher match score)
triggerNolog / docker_exit / docker_health / docker_oom / http_health / container_probe
remediationYesservice_restart, container_restart, command, container_exec, command_sequence, alert_only
verificationYesservice_active, container_running, container_healthy, http_status, container_http_status, command_success, none
actionNoauto_recover / alert_only / dry_run / approval_required
priorityNoHigher = matched first (default 0)

Rule Examples

Restart a systemd service on log error:

{
  "id": "nginx_restart",
  "name": "Restart Nginx on connection error",
  "error_patterns": ["nginx: connection refused"],
  "trigger": {"type": "log"},
  "remediation": {"type": "service_restart", "service": "nginx"},
  "verification": {"type": "service_active", "service": "nginx"},
  "action": "auto_recover",
  "priority": 50
}

Restart a Docker container on exit 137:

{
  "id": "app_container_restart",
  "name": "Restart app container on exit 137",
  "error_patterns": ["exit code 137"],
  "trigger": {"type": "docker_exit", "container": "my-app", "exit_codes": [137]},
  "remediation": {"type": "container_restart", "container": "my-app"},
  "verification": {"type": "container_running", "container": "my-app"},
  "action": "auto_recover",
  "priority": 50
}

Heal a service inside a container without restarting it:

{
  "id": "nginx_reload",
  "name": "Reload nginx config inside container",
  "error_patterns": ["nginx config error"],
  "trigger": {"type": "log"},
  "remediation": {"type": "container_exec", "container": "nginx", "args": ["nginx", "-s", "reload"]},
  "verification": {"type": "container_http_status", "container": "nginx", "url": "http://127.0.0.1:8080/health", "expected_status": 200},
  "action": "auto_recover",
  "priority": 50
}

Alert only — no automatic remediation:

{
  "id": "disk_full_alert",
  "name": "Alert on disk full",
  "error_patterns": ["no space left on device"],
  "trigger": {"type": "log"},
  "remediation": {"type": "alert_only"},
  "verification": {"type": "none"},
  "action": "alert_only",
  "priority": 50
}

⚠️ Important

Rules execute as root. Destructive commands are blocked best-effort, not foolproof. Write your rules carefully.

Email Alerts (Optional)

Aegira can send Gmail alerts via Composio when incidents occur. You need a free Composio account.

During install, choose to enable alerts and provide:

  • Composio API key (from app.composio.dev)
  • Composio user ID
  • Recipient email

Or configure later:

$ sudo aegira configure alerts on you@example.com

Troubleshooting

Aegira service not running +
$ sudo systemctl status aegira.service
$ sudo journalctl -u aegira -n 100
Rule not matching +

Check /var/log/aegira/incident.log for rejection reasons. Common causes: missing error_patterns, invalid JSON, or target not configured.

Alerts not arriving +

Verify your Composio API key and user ID in /etc/aegira/composio.env. Then check the incident log: sudo grep -i alert /var/log/aegira/incident.log

Docker rules not firing +

Docker rules use TARGET_CONTAINER. You must configure a target: sudo aegira configure container <name>