detect-anomalies-aiops
정보
이 스킬은 Isolation Forest, Prophet, LSTM과 같은 AI 모델을 사용하여 운영 시계열 데이터, 로그, 트레이스에서 진정한 이상 징후를 탐지합니다. 정적 임계값 방식을 넘어서 경고를 연관 분석하고 근본 원인 분석을 수행하여 경고 피로를 줄입니다. 경고 양에 압도될 때, 복잡한 다중 메트릭 이상 징후나 계절적 패턴을 다룰 때, 또는 사전 문제 예측을 위해 사용하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/detect-anomalies-aiopsClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
Detect Anomalies for AIOps
See Extended Examples for complete configuration files and templates.
Apply ML to find anomalies in operational metrics. Correlate alerts, cut false positives.
When Use
- Ops team drowning in alerts (>100/day)
- Need to detect complex multi-metric anomalies (not just threshold breaches)
- Seasonal patterns make static thresholds useless
- Want to predict issues before they hit users (proactive detection)
- Need to correlate related alerts → root cause
- Monitoring creates too many false positives
- Want to spot subtle perf degradation trends
Inputs
- Required: Time series metrics from monitoring (CPU, memory, latency, error rate)
- Required: Historical data (30-90 days min)
- Optional: Alert history with labels (true positive / false positive)
- Optional: System topology (service deps)
- Optional: Log data for correlation
- Optional: Deploy/change events for context
Steps
Step 1: Set Up Environment + Load Data
Install deps. Prep time series data.
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install anomaly detection libraries
pip install prophet scikit-learn pandas numpy
pip install tensorflow keras # for LSTM models
pip install pyod # Python Outlier Detection library
pip install statsmodels # for statistical methods
pip install prometheus-api-client # if using Prometheus
# Visualization
pip install plotly matplotlib seaborn
Load + prep data:
# aiops/data_loader.py
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
from typing import List, Dict
import logging
logging.basicConfig(level=logging.INFO)
# ... (see EXAMPLES.md for complete implementation)
Got: Time series loaded, regular intervals, missing values handled, features engineered for ML.
If fail: Prometheus connection fails? Check URL + network. Data gaps? Forward-fill or interpolate. Timestamp column must be datetime. Memory issues with big date ranges? Process in chunks.
Step 2: Impl Isolation Forest for Multivariate Anomaly Detection
Unsupervised Isolation Forest finds anomalies.
# aiops/isolation_forest_detector.py
from sklearn.ensemble import IsolationForest
from sklearn.preprocessing import StandardScaler
import pandas as pd
import numpy as np
from typing import Dict, List
import joblib
# ... (see EXAMPLES.md for complete implementation)
Got: Model trained on historical data. Anomalies detected with scores. Usually 0.5-2% of points flagged.
If fail: Too many anomalies (>5%)? Reduce contamination or retrain on cleaner baseline. Too few (<0.1%)? Increase contamination or check feature scaling. Features need variance.
Step 3: Impl Prophet for Time Series Forecasting + Anomaly Detection
Facebook Prophet models seasonality, finds deviations.
# aiops/prophet_detector.py
from prophet import Prophet
import pandas as pd
import numpy as np
from typing import Dict, Tuple
import logging
logger = logging.getLogger(__name__)
# ... (see EXAMPLES.md for complete implementation)
Got: Prophet models capture daily/weekly seasonality. Anomalies flagged when actual outside 99% CI. Forecasts for capacity planning.
If fail: Prophet too slow (>5 min per metric)? Cut history to 30 days or disable weekly_seasonality. Too many false positives? Raise interval_width to 0.995. Missing seasonal patterns? Add custom seasonalities. Check timezone consistency.
Step 4: Correlate Alerts + Find Root Cause
Group related anomalies. Identify root causes.
# aiops/alert_correlation.py
import pandas as pd
import numpy as np
from sklearn.cluster import DBSCAN
from typing import List, Dict
from datetime import timedelta
import networkx as nx
# ... (see EXAMPLES.md for complete implementation)
Got: Related anomalies grouped into incidents. Root causes from dependency graph. Incident summaries for investigation.
If fail: All anomalies separate incidents? Raise time_window_minutes. Root cause unclear? Define metric_relationships explicit from architecture. Check timestamp sort.
Step 5: Integrate with Alerting System
Send intelligent alerts with context. Suppress noise.
# aiops/intelligent_alerting.py
import requests
import logging
from typing import Dict, List
from datetime import datetime, timedelta
import json
logger = logging.getLogger(__name__)
# ... (see EXAMPLES.md for complete implementation)
Got: High-severity → PagerDuty. Medium → Slack. Low → logged only. Duplicate alerts suppressed in 15-min window.
If fail: Test webhook URLs with curl first. Severity calc should give 0.5-0.9 range. Rate limiting must not suppress all alerts. Check timezone for last_alerts tracking.
Step 6: Deploy as Continuous Monitoring Service
Auto-pipeline runs periodically.
# aiops/monitoring_service.py
import schedule
import time
import logging
from datetime import datetime, timedelta
from data_loader import MetricsDataLoader
from isolation_forest_detector import IsolationForestDetector
from prophet_detector import ProphetAnomalyDetector
# ... (see EXAMPLES.md for complete implementation)
Got: Service runs continuously. Detects anomalies every 5 min. Alerts sent for incidents. Logs all activity.
If fail: Scheduler process must stay alive (use systemd/supervisor for prod). Check Prometheus connection. Models must load OK. Add dead man's switch alert if service stops. Monitor memory (reload models periodically if growing).
Checks
- Historical data loaded, no missing timestamps
- Isolation Forest finds known anomalies in test set
- Prophet models capture daily/weekly seasonality
- Alert correlation groups temporally-related anomalies
- Root cause detection finds upstream issues
- Intelligent alerting suppresses duplicates
- Severity calc gives reasonable scores (0.5-0.9)
- Monitoring service runs continuously 7+ days, no crash
- False positive rate < 10% (vs labeled data)
- True positive rate > 80% for critical incidents
Pitfalls
- Training on anomalous data: Baseline period for training must be clean (no incidents). Manually review or use labeled data.
- Ignoring seasonality: Static models fail on daily/weekly patterns. Use Prophet or add time features.
- Too sensitive thresholds: 99% CI may flag normal peaks. Start 99.5%, tune by false positives.
- Not handling missing data: Gaps cause model errors. Robust preprocessing with interpolation.
- Alert fatigue from low severity: Filter below threshold. Focus on high-confidence.
- Ignoring system topology: Treating metrics independent misses cascading failures. Define deps.
- Model drift: Old-data models go stale. Retrain monthly or on system change.
- Resource contention: Running detection on every metric = expensive. Prioritize critical services or sample.
See Also
monitor-model-drift- Find when anomaly models degrademonitor-data-integrity- Data quality checks before anomaly detectionsetup-prometheus-monitoring- Collect operational metricsforecast-operational-metrics- Capacity planning with Prophet forecasts
GitHub 저장소
연관 스킬
llamaguard
기타LlamaGuard는 폭력 및 혐오 발언 등 6가지 안전 범주에서 LLM 입력과 출력을 조정하기 위한 Meta의 70-80억 파라미터 모델입니다. 94-95% 정확도를 제공하며 vLLM, Hugging Face 또는 Amazon SageMaker를 사용해 배포할 수 있습니다. 이 기술을 사용하여 AI 애플리케이션에 콘텐츠 필터링 및 안전 가드레일을 손쉽게 통합하세요.
cost-optimization
기타이 Claude Skill은 리소스 적정화, 태깅 전략, 지출 분석을 통해 개발자들이 클라우드 비용을 최적화할 수 있도록 지원합니다. AWS, Azure, GCP에서 클라우드 비용을 절감하고 비용 거버넌스를 구현하기 위한 프레임워크를 제공합니다. 인프라 비용을 분석하거나, 리소스를 적정화하거나, 예산 제약을 충족해야 할 때 사용하세요.
quantizing-models-bitsandbytes
기타이 스킬은 bitsandbytes를 사용하여 LLM을 8비트 또는 4비트 정밀도로 양자화하며, 최소한의 정확도 손실로 50-75%의 메모리 감소를 달성합니다. 제한된 GPU 메모리에서 더 큰 모델을 실행하거나 추론을 가속화하는 데 이상적이며, INT8, NF4, FP4와 같은 형식을 지원합니다. 이 스킬은 HuggingFace Transformers와 통합되어 QLoRA 학습 및 8비트 옵티마이저를 가능하게 합니다.
dispatching-parallel-agents
기타이 Claude Skill은 3개 이상의 독립적인 문제를 동시에 조사하고 해결하기 위해 다중 에이전트를 배치합니다. 공유 상태나 의존성 없이 해결 가능한 무관련 장애 시나리오에 맞게 설계되었습니다. 핵심 기능은 병렬 문제 해결로, 각 독립 문제 영역마다 하나의 에이전트를 할당하여 효율성을 극대화합니다.
