MCP HubMCP Hub
스킬 목록으로 돌아가기

detect-anomalies-aiops

pjt222
업데이트됨 Yesterday
17
2
17
GitHub에서 보기
기타aiapi

정보

이 스킬은 Isolation Forest, Prophet, LSTM과 같은 시계열 모델을 사용하여 운영 메트릭에 대한 AI 기반 이상 감지를 구현합니다. 진정한 이상 징후를 지능적으로 식별하고 경고를 연관시켜 근본 원인 분석을 수행함으로써 경고 피로를 줄여줍니다. 경고 양에 압도될 때, 계절적 패턴으로 인해 정적 임계값이 실패할 때, 또는 사전에 문제를 예측해야 할 때 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/detect-anomalies-aiops

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Detect Anomalies for AIOps

See Extended Examples for complete configuration files and templates.

Apply machine learning to detect anomalies in operational metrics, correlate alerts, and reduce false positives.

When to Use

  • Operations team overwhelmed by alert volume (>100 alerts/day)
  • Need to detect complex multi-metric anomalies (not threshold breaches)
  • Seasonal patterns make static thresholds ineffective
  • Want to predict issues before they impact users (proactive detection)
  • Need to correlate related alerts to identify root cause
  • Monitoring system generates too many false positives
  • Want to detect subtle performance degradation trends

Inputs

  • Required: Time series metrics from monitoring system (CPU, memory, latency, error rate)
  • Required: Historical data (30-90 days minimum)
  • Optional: Alert history with labels (true positive / false positive)
  • Optional: System topology (service dependencies)
  • Optional: Log data for correlation
  • Optional: Deployment/change events for context

Procedure

Step 1: Set Up Environment and Load Data

Install dependencies and prepare time series data for analysis.

# 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 and prepare 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 data loaded with regular intervals, missing values handled, features engineered for ML models.

If fail: If Prometheus connection fails, verify URL and network access, if data gaps exist use forward-fill or interpolation, ensure timestamp column is datetime type, check for memory issues with large date ranges (process in chunks).

Step 2: Implement Isolation Forest for Multivariate Anomaly Detection

Detect anomalies using unsupervised Isolation Forest algorithm.

# 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, typically 0.5-2% of points flagged as anomalies.

If fail: If too many anomalies (>5%), reduce contamination parameter or retrain on cleaner baseline period, if too few (<0.1%), increase contamination or check feature scaling, verify features have sufficient variance.

Step 3: Implement Prophet for Time Series Forecasting and Anomaly Detection

Use Facebook Prophet to model seasonality and detect 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 detected when actual values fall outside 99% confidence interval, forecasts generated for capacity planning.

If fail: If Prophet takes too long (>5 min per metric), reduce history to 30 days or disable weekly_seasonality, if too many false positives increase interval_width to 0.995, if missing seasonal patterns add custom seasonalities, ensure timezone consistency in timestamps.

Step 4: Correlate Alerts and Identify Root Cause

Group related anomalies and identify potential 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 identified based on dependency graph, incident summaries generated for investigation.

If fail: If all anomalies separate incidents, increase time_window_minutes, if root cause detection unclear define metric_relationships explicitly based on architecture, verify timestamp sorting is correct.

Step 5: Integrate with Alerting System

Send intelligent alerts with context and suppression of 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 incidents trigger PagerDuty pages, medium-severity go to Slack, low-severity logged only, duplicate alerts suppressed within 15-minute window.

If fail: Test webhook URLs with curl first, verify severity calculation produces reasonable values (0.5-0.9 range), check rate limiting doesn't suppress all alerts, ensure timezone handling is correct for last_alerts tracking.

Step 6: Deploy as Continuous Monitoring Service

Set up automated pipeline that 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 minutes, alerts sent for incidents, logs all activity.

If fail: Verify scheduler process stays alive (use systemd/supervisor for production), check Prometheus connectivity, ensure models are loaded successfully, implement dead man's switch alert if service stops running, monitor memory usage (reload models periodically if memory grows).

Validation

  • Historical data loaded correctly with no missing timestamps
  • Isolation Forest detects known anomalies from test set
  • Prophet models capture daily/weekly seasonality in visualizations
  • Alert correlation groups temporally-related anomalies
  • Root cause detection identifies upstream issues correctly
  • Intelligent alerting suppresses duplicate alerts
  • Severity calculation produces reasonable scores (0.5-0.9)
  • Monitoring service runs continuously without crashes for 7+ days
  • False positive rate < 10% (validated against labeled data)
  • True positive rate > 80% for critical incidents

Pitfalls

  • Training on anomalous data: Ensure baseline period used for training is 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% confidence intervals may flag normal peaks; start with 99.5% and tune based on false positives
  • Not handling missing data: Gaps in metrics cause model errors; implement robust preprocessing with interpolation
  • Alert fatigue from low severity: Filter alerts below severity threshold; focus on high-confidence anomalies
  • Ignoring system topology: Treating all metrics independently misses cascading failures; define dependency relationships
  • Model drift: Models trained on old data become stale; retrain monthly or when system changes
  • Resource contention: Running detection on every metric is expensive; prioritize critical services or sample metrics

Related Skills

  • monitor-model-drift - Detect when anomaly detection models degrade
  • monitor-data-integrity - Data quality checks before anomaly detection
  • setup-prometheus-monitoring - Collect operational metrics
  • forecast-operational-metrics - Capacity planning with Prophet forecasts

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-lite/skills/detect-anomalies-aiops
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

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개 이상의 독립적인 문제를 동시에 조사하고 해결하기 위해 다중 에이전트를 배치합니다. 공유 상태나 의존성 없이 해결 가능한 무관련 장애 시나리오에 맞게 설계되었습니다. 핵심 기능은 병렬 문제 해결로, 각 독립 문제 영역마다 하나의 에이전트를 할당하여 효율성을 극대화합니다.

스킬 보기