ari-monitoring-alerting
Real-time monitoring and alerting system for ARI
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Real-time monitoring and alerting system for ARI
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Discord slash commands, approval routing, channel policy, button interaction patterns for OpenClaw/ARI Discord integration
Obsidian vault integration patterns — vault-analyzer.ts, /ari-vault-* commands, morning briefing snippet, PARA structure, read-only enforcement
OpenClaw plugin development patterns — hooks, manifest structure, plugin SDK, APEX/CODEX enforcement
NOVA's P1 PayThePryce pipeline — market signal ingest, card detection, price monitoring, script generation, thumbnail generation, video assembly, approval gate
CHASE's P2 Pryceless Solutions pipeline — lead discovery, 5-criteria audit, LLM qualification, Prompt Forge 4-pass lock, demo generation, outreach approval gate
NOVA's thumbnail generation pipeline — Ideogram V3 via Fal.ai (primary) + DALL-E 3 fallback, 4-variant strategy, Pokemon TCG copyright rules,
| name | ari-monitoring-alerting |
| description | Real-time monitoring and alerting system for ARI |
| triggers | ["monitoring","alerting","metrics","system health"] |
Real-time monitoring of ARI's health, performance, and security with automated alerting.
interface SystemMetrics {
cpu: {
usage: number; // 0-100%
loadAvg: number[]; // 1, 5, 15 min
};
memory: {
used: number; // bytes
total: number; // bytes
heapUsed: number; // V8 heap
heapTotal: number;
};
uptime: number; // seconds
eventLoop: {
lag: number; // ms
utilization: number; // 0-1
};
}
interface AppMetrics {
requests: {
total: number;
perSecond: number;
latencyP50: number;
latencyP95: number;
latencyP99: number;
};
agents: {
[agent: string]: {
tasksCompleted: number;
tasksFailed: number;
avgDuration: number;
};
};
security: {
threatsBlocked: number;
riskScoreAvg: number;
injectionAttempts: number;
};
governance: {
votesHeld: number;
proposalsPassed: number;
proposalsRejected: number;
};
audit: {
eventCount: number;
chainValid: boolean;
lastVerified: string;
};
}
// src/ops/health.ts
interface HealthCheck {
name: string;
check: () => Promise<boolean>;
critical: boolean;
}
const healthChecks: HealthCheck[] = [
{
name: 'gateway',
check: async () => {
const res = await fetch('http://127.0.0.1:3141/health');
return res.ok;
},
critical: true
},
{
name: 'audit_chain',
check: async () => {
const result = await Audit.verifyChain();
return result.valid;
},
critical: true
},
{
name: 'agents',
check: async () => {
const statuses = await checkAllAgents();
return Object.values(statuses).every(s => s);
},
critical: true
},
{
name: 'memory_manager',
check: async () => {
return await memoryManager.healthCheck();
},
critical: false
},
{
name: 'disk_space',
check: async () => {
const free = await getDiskSpace();
return free > 1024 * 1024 * 100; // 100MB
},
critical: false
}
];
interface AlertRule {
name: string;
condition: (metrics: Metrics) => boolean;
severity: 'critical' | 'warning' | 'info';
cooldown: number; // ms between alerts
}
const alertRules: AlertRule[] = [
{
name: 'high_memory',
condition: (m) => m.system.memory.used / m.system.memory.total > 0.9,
severity: 'warning',
cooldown: 300000 // 5 min
},
{
name: 'security_threat',
condition: (m) => m.app.security.threatsBlocked > 10,
severity: 'critical',
cooldown: 60000 // 1 min
},
{
name: 'audit_invalid',
condition: (m) => !m.app.audit.chainValid,
severity: 'critical',
cooldown: 0 // Always alert
},
{
name: 'high_latency',
condition: (m) => m.app.requests.latencyP95 > 500,
severity: 'warning',
cooldown: 300000
},
{
name: 'agent_failure_rate',
condition: (m) => {
const agents = Object.values(m.app.agents);
const totalFailed = agents.reduce((sum, a) => sum + a.tasksFailed, 0);
const totalTasks = agents.reduce((sum, a) => sum + a.tasksCompleted + a.tasksFailed, 0);
return totalTasks > 0 && (totalFailed / totalTasks) > 0.1;
},
severity: 'warning',
cooldown: 600000
}
];
async function triggerAlert(rule: AlertRule, metrics: Metrics) {
const alert = {
rule: rule.name,
severity: rule.severity,
timestamp: new Date().toISOString(),
metrics: extractRelevantMetrics(rule, metrics)
};
// Log to audit
await eventBus.emit('audit:log', {
action: 'alert_triggered',
...alert
});
// Broadcast to dashboard
await eventBus.emit('monitoring:alert', alert);
// Log
logger[rule.severity === 'critical' ? 'error' : 'warn'](
alert,
`Alert: ${rule.name}`
);
}
// Metrics endpoint for dashboard
gateway.get('/metrics', async () => ({
system: await collectSystemMetrics(),
app: await collectAppMetrics(),
health: await runHealthChecks(),
alerts: getActiveAlerts()
}));
// WebSocket real-time updates
setInterval(async () => {
const metrics = await collectAllMetrics();
broadcaster.broadcast('metrics:update', metrics);
}, 5000);
# View current metrics
npx ari metrics
# View health status
npx ari doctor
# View active alerts
npx ari alerts
# Clear alert (with acknowledgment)
npx ari alerts ack <alert-id>
// Time-series storage for historical analysis
interface MetricPoint {
timestamp: string;
value: number;
}
// Store metrics with retention policy
const RETENTION = {
'1m': 24 * 60, // 24 hours of 1-min data
'5m': 7 * 24 * 12, // 7 days of 5-min data
'1h': 30 * 24 // 30 days of hourly data
};