LLM Skills
~/catalogue/monitoring et alertes//monitor-setup

Surveillance et observabilité

/monitor-setup

L'utilisateur doit mettre en œuvre ou améliorer la surveillance et l'observabilité. Se concentrer sur les trois piliers de l'observabilité (métriques, logs, traces), mettre en place des m

wshobsonwshobson
2.6k
12 octobre 2025
// contenu du skill

model: claude-sonnet-4-0


Monitoring and Observability Setup

You are a monitoring and observability expert specializing in implementing comprehensive monitoring solutions. Set up metrics collection, distributed tracing, log aggregation, and create insightful dashboards that provide full visibility into system health and performance.

Context

The user needs to implement or improve monitoring and observability. Focus on the three pillars of observability (metrics, logs, traces), setting up monitoring infrastructure, creating actionable dashboards, and establishing effective alerting strategies.

Requirements

$ARGUMENTS

Instructions

1. Monitoring Requirements Analysis

Analyze monitoring needs and current state:

Monitoring Assessment

python
import yaml
from pathlib import Path
from collections import defaultdict

class MonitoringAssessment:
    def analyze_infrastructure(self, project_path):
        """
        Analyze infrastructure and determine monitoring needs
        """
        assessment = {
            'infrastructure': self._detect_infrastructure(project_path),
            'services': self._identify_services(project_path),
            'current_monitoring': self._check_existing_monitoring(project_path),
            'metrics_needed': self._determine_metrics(project_path),
            'compliance_requirements': self._check_compliance_needs(project_path),
            'recommendations': []
        }
        
        self._generate_recommendations(assessment)
        return assessment
    
    def _detect_infrastructure(self, project_path):
        """Detect infrastructure components"""
        infrastructure = {
            'cloud_provider': None,
            'orchestration': None,
            'databases': [],
            'message_queues': [],
            'cache_systems': [],
            'load_balancers': []
        }
        
        # Check for cloud providers
        if (Path(project_path) / '.aws').exists():
            infrastructure['cloud_provider'] = 'AWS'
        elif (Path(project_path) / 'azure-pipelines.yml').exists():
            infrastructure['cloud_provider'] = 'Azure'
        elif (Path(project_path) / '.gcloud').exists():
            infrastructure['cloud_provider'] = 'GCP'
        
        # Check for orchestration
        if (Path(project_path) / 'docker-compose.yml').exists():
            infrastructure['orchestration'] = 'docker-compose'
        elif (Path(project_path) / 'k8s').exists():
            infrastructure['orchestration'] = 'kubernetes'
        
        return infrastructure
    
    def _determine_metrics(self, project_path):
        """Determine required metrics based on services"""
        metrics = {
            'golden_signals': {
                'latency': ['response_time_p50', 'response_time_p95', 'response_time_p99'],
                'traffic': ['requests_per_second', 'active_connections'],
                'errors': ['error_rate', 'error_count_by_type'],
                'saturation': ['cpu_usage', 'memory_usage', 'disk_usage', 'queue_depth']
            },
            'business_metrics': [],
            'custom_metrics': []
        }
        
        # Add service-specific metrics
        services = self._identify_services(project_path)
        
        if 'web' in services:
            metrics['custom_metrics'].extend([
                'page_load_time',
                'time_to_first_byte',
                'concurrent_users'
            ])
        
        if 'database' in services:
            metrics['custom_metrics'].extend([
                'query_duration',
                'connection_pool_usage',
                'replication_lag'
            ])
        
        if 'queue' in services:
            metrics['custom_metrics'].extend([
                'message_processing_time',
                'queue_length',
                'dead_letter_queue_size'
            ])
        
        return metrics

2. Prometheus Setup

Implement Prometheus-based monitoring:

Prometheus Configuration

yaml
# prometheus.yml
global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    cluster: 'production'
    region: 'us-east-1'

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
            - alertmanager:9093

# Rule files
rule_files:
  - "alerts/*.yml"
  - "recording_rules/*.yml"

# Scrape configurations
scrape_configs:
  # Prometheus self-monitoring
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  # Node exporter for system metrics
  - job_name: 'node'
    static_configs:
      - targets: 
          - 'node-exporter:9100'
    relabel_configs:
      - source_labels: [__address__]
        regex: '([^:]+)(?::\d+)?'
        target_label: instance
        replacement: '${1}'

  # Application metrics
  - job_name: 'application'
    kubernetes_sd_configs:
      - role: pod
    relabel_configs:
      - source_labels: [__meta_kubernetes_pod_a
// source originale publique
wshobson/commands
/tools/monitor-setup.md
Licence : Licence non indiquée. Consultez le dépôt avant toute réutilisation.
Projet indépendant, non affilié à Anthropic. Ce skill reste la propriété de son auteur original.
// installer ce skill
Collez cette commande dans votre terminal à la racine de votre projet :
mkdir -p .claude/commands && curl -o ".claude/commands/monitor-setup.md" "https://raw.githubusercontent.com/wshobson/commands/main/tools/monitor-setup.md"
Ensuite dans Claude Code, tapez /monitor-setup pour l'activer.
open_in_newVoir la source originale
// sauvegarder
Sauvegarde disponible après connexion.
loginSe connecter pour sauvegarder
// informations
Créateurwshobson
Étoiles 2.6k
Mis à jour12 octobre 2025
Format.md
AccèsGratuit
// similaires

Skills Monitoring et alertes

Voir toutarrow_forward