Feature: Auto-create incidents after 10 failed checks with rich descriptions

- Add description and failed_check_count fields to incidents table
- Update handleIncident() to use configurable threshold (default 10 checks)
- Auto-generate incident description with:
  - Number of consecutive failures
  - Last error message/reason
  - First failure timestamp
- Add API endpoints: GET/POST /api/settings/incident-threshold
- Add UI settings field to configure incident failure threshold
- Server: Get threshold from database settings (persistent across restarts)
- Default threshold: 10 consecutive failed checks per resource
This commit is contained in:
nmemmert committed 2025-12-16 13:24:20 -05:00
1 parent 6b00530a89
commit 5330c8932f
10 files changed
+106 -29

No files matched your search

+30 -15
View File
@@ -16,21 +16,22 @@ function SettingsWizard() {
check_interval: 60000,
timeout: 5000,
timezone: 'UTC',
retention_days: 7,
auto_cleanup_enabled: false,
consecutive_failures: 3,
grace_period: 300,
downtime_threshold: 600,
alert_retry_count: 3,
alert_retry_delay: 60,
fallback_webhook: '',
global_quiet_hours_start: '',
global_quiet_hours_end: '',
escalation_hours: 4,
default_sort: 'name',
items_per_page: 20,
refresh_interval: 5000,
theme: 'light',
retention_days: 7,
auto_cleanup_enabled: false,
consecutive_failures: 3,
grace_period: 300,
downtime_threshold: 600,
alert_retry_count: 3,
alert_retry_delay: 60,
fallback_webhook: '',
global_quiet_hours_start: '',
global_quiet_hours_end: '',
escalation_hours: 4,
default_sort: 'name',
items_per_page: 20,
refresh_interval: 5000,
theme: 'light',
incident_failure_threshold: 10,
});
const [testResult, setTestResult] = useState(null);
@@ -353,6 +354,20 @@ function SettingsWizard() {
<small>Timezone for timestamps and alerts</small>
</div>
</div>
<div className="form-row">
<div className="form-group">
<label>Incident Failure Threshold</label>
<input
type="number"
value={settings.incident_failure_threshold || 10}
onChange={(e) => setSettings({ ...settings, incident_failure_threshold: parseInt(e.target.value) })}
min="1"
max="100"
/>
<small>Number of consecutive failed checks before automatically creating an incident (default: 10)</small>
</div>
</div>
</div>
</div>