شعار Huawei Cloud Ecs Shutdown Experiment

Huawei Cloud Ecs Shutdown Experiment

مؤسسة
huaweicloud
huawei-cloud-ecs-shutdown-experiment

Full lifecycle ECS shutdown fault injection experiment for Huawei Cloud chaos engineering: prepare → execute → analyze. Phase 1 discovers target ECS instances, validates compatibility, generates experiment configuration. Phase 2 executes BatchStopServers shutdown, polls status, holds for duration, rolls back via BatchStartServers, verifies recovery, generates execution report. Phase 3 collects CES monitoring metrics and LTS application logs, analyzes error patterns, generates analysis report. Key safety: --dry-run, --auto-rollback, mandatory --yes confirmation, independent emergency rollback script. Triggers: ECS故障演练, ECS关机实验, chaos engineering, 故障注入, ECS shutdown experiment, 演练准备, 执行实验, 运行实验, 启动演练, 执行 ECS 关机故障演练, 分析应用日志, 查看应用表现, 应用日志分析, 故障影响分析, experiment prepare, experiment execute, analyze app logs, log analysis.

نظرة عامة

الناشرhuaweicloud
المستودعhuaweicloud-skills
اسم المهارةhuawei-cloud-ecs-shutdown-experiment
النجوم
59
التفريعات
24
الملفات المرفقة
23
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 23

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها huaweicloud على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Huawei Cloud Ecs Shutdown Experiment في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/computing/ecs/huawei-cloud-ecs-shutdown-experiment
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/huaweicloud/huaweicloud-skills.git /tmp/huaweicloud-skills
mkdir -p .claude/skills
cp -r /tmp/huaweicloud-skills/skills/computing/ecs/huawei-cloud-ecs-shutdown-experiment .claude/skills/huawei-cloud-ecs-shutdown-experiment
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Huawei Cloud Ecs Shutdown Experiment في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Huawei Cloud Ecs Shutdown Experiment تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Huawei Cloud Ecs Shutdown Experiment بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Huawei Cloud ECS Shutdown Chaos Experiment

⚠️ This skill performs real ECS shutdown operations in Phase 2. Ensure target instances can tolerate downtime. Emergency rollback is always available.

Overview

Full lifecycle ECS shutdown fault injection experiment for Huawei Cloud chaos engineering, covering three phases:

PhaseNameActionKey Output
1PrepareDiscover, validate, generate configexperiment.json + rollback_experiment.sh
2ExecuteShutdown → hold → rollback → verifyexecution-log.json + execution-report.md
3AnalyzeCollect CES metrics + LTS logs, analyze patternslog-analysis-result.json + log-analysis-report.md

Scope: standalone ECS instances in any availability zone (non-CCE).

Prerequisites

  • hcloud CLI (KooCLI) — installed and configured with AK/SK. See references/cli-installation-guide.md.
  • Python 3 — for discovery, validation, execution, and analysis scripts.
  • Environment variables: HW_ACCESS_KEY, HW_SECRET_KEY, HW_REGION_NAME (optional, default cn-north-4).
  • IAM permissions: varies by phase — see references/iam-policies.md for the full matrix.
  • Phase 3 only: LTS log group ID (find via hcloud LTS ListLogGroups or LTS console).

Environment check (run before any phase):

bash
bash scripts/check_env.sh --cli-region <region>

Phase 1: Prepare

Does NOT start the experiment. Only discovers targets, validates compatibility, and generates configuration files.

Step 1.1: Discover Target ECS Instances

bash
python3 scripts/discover_ecs.py --cli-region <region>
python3 scripts/discover_ecs.py --cli-region <region> --az cn-north-4a --status ACTIVE
python3 scripts/discover_ecs.py --cli-region <region> --name-pattern "web-"

Output: JSON with instance ID, name, status, AZ, flavor, charging mode, and tags.

Step 1.2: Validate Compatibility [CRITICAL GATE]

bash
python3 scripts/validate_targets.py --instances-file instances.json --cli-region <region>

Validation rules (see references/ecs-validation-rules.md for details):

  1. Status must be ACTIVE — can only shut down running instances
  2. Spot/bidding instance warning — may be released instead of stopped
  3. AS group association — shutdown may trigger auto-scaling activity
  4. Single-AZ risk — no cross-AZ redundancy if all targets in one AZ

Decision: errors → stop and fix; warnings only → review with user before proceeding.

Step 1.3: Generate Experiment Configuration

bash
python3 scripts/generate_experiment.py \
    --targets "i-xxx,i-yyy" --cli-region <region> --duration 300 --output-dir ./experiments

Output directory: {timestamp}-ecs-shutdown-{slug}/ containing experiment.json + README.md. See references/experiment-template-guide.md for schema.

Step 1.4: Deploy Experiment

bash
bash scripts/deploy_experiment.sh --experiment-dir ./experiments/{dir}/ --cli-region <region>

Generates rollback_experiment.sh (emergency rollback script) in the experiment directory.

Step 1.5: Review

Experiment is prepared but NOT started. Review experiment.json and README.md, then proceed to Phase 2 when ready.

Phase 2: Execute

Real shutdown operation. Target ECS instances are stopped. Ensure experiment.json from Phase 1 is available.

Step 2.1: Execute the Experiment

bash
# Real execution (--yes is mandatory; default refuses without it)
python3 scripts/execute_experiment.py --experiment-dir ./experiments/xxx/ --cli-region <region> --yes

# Dry Run (simulated, no API calls)
python3 scripts/execute_experiment.py --experiment-dir ./experiments/xxx/ --cli-region <region> --dry-run

# Auto-rollback when shutdown fails
python3 scripts/execute_experiment.py --experiment-dir ./experiments/xxx/ --cli-region <region> --auto-rollback --yes

6-phase execution flow (see references/execution-workflow.md for details):

PhaseActionDescription
1. Pre-checkQuery statusAll instances must be ACTIVE
2. ShutdownBatchStopServersInject the fault
3. MonitorPoll statusWait until all reach SHUTOFF
4. Waitsleep(duration)Hold with stop-condition checks
5. RollbackBatchStartServersRestore instances
6. VerifyPoll statusConfirm all back to ACTIVE

Output: execution-log.json with full execution timeline and state changes.

Step 2.2: Generate Execution Report

bash
python3 scripts/generate_report.py --log-file ./experiments/xxx/execution-log.json

Report contains: experiment overview, target instances, phase timeline, state changes, conclusions.

Emergency Rollback

If the experiment must be terminated early:

bash
python3 scripts/rollback_experiment.py --experiment-dir ./experiments/xxx/ --cli-region <region>
# Or pass instance IDs directly:
python3 scripts/rollback_experiment.py --ids "i-xxx,i-yyy" --cli-region <region>

Phase 3: Analyze

Collect CES monitoring metrics and LTS application logs to understand how applications respond to the infrastructure failure. Supports post-hoc mode (after experiment) and real-time mode (during experiment).

Step 3.1: Load Experiment Context

Auto-detect mode: execution-log.json found → post-hoc; falls back to experiment.json → real-time.

Step 3.2: Run Full Analysis Pipeline

bash
python3 scripts/analyze_logs.py \
    --experiment-dir ./experiments/xxx/ \
    --cli-region <region> \
    --log-group-id <lts-group-id>

# Dry run (verify workflow without API calls)
python3 scripts/analyze_logs.py --experiment-dir ./experiments/xxx/ --dry-run

The pipeline executes steps 3.3–3.6 automatically. See references/analysis-workflow.md for details.

Step 3.3: Collect CES Monitoring Metrics

Queries 6 metrics via hcloud CES ShowMetricData (see references/managed-service-logs.md → CES section):

NamespaceMetricLabelRequires Agent?
SYS.ECScpu_utilCPU UtilizationNo
SYS.ECSnetwork_incoming_bytes_aggregate_rateNetwork Incoming RateNo
SYS.ECSnetwork_outgoing_bytes_aggregate_rateNetwork Outgoing RateNo
SYS.ECSdisk_read_bytes_rateDisk Read RateNo
SYS.ECSdisk_write_bytes_rateDisk Write RateNo
AGT.ECSmem_usedPercentMemory UsageYes

Metrics summarized by phase (pre-shutdown / during-shutdown / post-recovery). Query uses period=300 (5-min aggregation for SYS.ECS).

Step 3.4: Collect Logs (LTS)

Queries LTS log group within experiment time window. --log-group-id is required (find via hcloud LTS ListLogGroups). Missing group / empty result = no LTS data, NOT "application unaffected" — check ICAgent config.

Step 3.5: Analyze Error Patterns

Local pattern matching (no network calls):

PatternSeverity
ERROR/Exception/Tracebackhigh
Connection refusedhigh
Timeouthigh
HTTP 5xxhigh
Reconnect/retrymedium
Degrade/circuit breakermedium
Recovery/restoredinfo

Step 3.6: Generate Analysis Report

bash
python3 scripts/generate_analysis_report.py --result-file ./experiments/xxx/log-analysis-result.json

Report contains: experiment overview, affected instances, LTS log sources, instance state timeline, CES monitoring metrics, error pattern statistics, error event timeline, application behavior assessment, improvement suggestions.

Parameter Confirmation

Before each phase's core operation, confirm with the user:

PhaseWhat to ConfirmMandatory?
1 (Generate)Target instance IDs + names, duration, validation warnings✅ Yes
2 (Execute)Experiment name, target count, duration, dry-run flag✅ Yes — --yes required for real execution
3 (Analyze)Experiment directory, detected mode, time window, LTS log group ID✅ Yes

Wait for explicit confirmation ("确认" / "confirm" / "ok") before proceeding.

Core Commands

<region> = region, defaults to cn-north-4 (HW_REGION_NAME overrides if set). The placeholder may be omitted at runtime — scripts fall back to the default region.

bash
# Environment check (all phases)
bash scripts/check_env.sh --cli-region <region>

# Phase 1: Prepare
python3 scripts/discover_ecs.py --cli-region <region>
python3 scripts/validate_targets.py --instances-file instances.json --cli-region <region>
python3 scripts/generate_experiment.py --targets "i-xxx,i-yyy" --cli-region <region> --duration 300
bash scripts/deploy_experiment.sh --experiment-dir ./experiments/{dir}/ --cli-region <region>

# Phase 2: Execute
python3 scripts/execute_experiment.py --experiment-dir ./experiments/xxx/ --cli-region <region> --yes
python3 scripts/generate_report.py --log-file ./experiments/xxx/execution-log.json
python3 scripts/rollback_experiment.py --experiment-dir ./experiments/xxx/ --cli-region <region>  # emergency

# Phase 3: Analyze
hcloud LTS ListLogGroups --cli-region=<region> --cli-output=json  # find log group
python3 scripts/analyze_logs.py --experiment-dir ./experiments/xxx/ --cli-region <region> --log-group-id <id>
python3 scripts/generate_analysis_report.py --result-file ./experiments/xxx/log-analysis-result.json

KooCLI Command Format Standard

All hcloud CLI commands follow this format:

hcloud <Service> <Action> --cli-region=<region> --cli-output=json [--param=value ...]
  • --cli-region=<region>: always explicit. KooCLI 7.2.x requires --param=value syntax (equals sign); space-separated --cli-region cn-north-4 is rejected with [USE_ERROR].
  • --cli-output=json: all commands, for machine-parseable output.
  • Batch operations use flat parameters (not --body):
    • Stop: --os-stop.servers.1.id=<id> --os-stop.type=SOFT
    • Start: --os-start.servers.1.id=<id>
  • Fetch in batch, filter locally: ListServersDetails with --limit=1000 + paging; no N+1 queries.
  • Credentials via environment variables: AK/SK passed through HW_ACCESS_KEY / HW_SECRET_KEY, never hardcoded.

Script Reference

ScriptPhasePurpose
scripts/check_env.shAllEnvironment verification
scripts/discover_ecs.py1Discover ECS instances
scripts/validate_targets.py1Validate target compatibility
scripts/generate_experiment.py1Generate experiment config
scripts/deploy_experiment.sh1Deploy experiment (local mode)
scripts/execute_experiment.py2Main execution script (6-phase flow)
scripts/monitor_instances.py2Instance status monitoring
scripts/rollback_experiment.py2Emergency rollback
scripts/generate_report.py2Generate execution report
scripts/collect_logs.py3LTS log collection + ECS endpoint query
scripts/collect_ces_metrics.py3CES monitoring metrics collection
scripts/analyze_logs.py3Main analysis pipeline orchestrator
scripts/generate_analysis_report.py3Generate Markdown analysis report

Reference Documents

DocumentPhaseDescription
references/cli-installation-guide.mdAllhcloud KooCLI installation and configuration
references/iam-policies.mdAllIAM permissions by phase
references/ecs-validation-rules.md1Validation rules with rationale
references/experiment-template-guide.md1experiment.json schema
references/execution-workflow.md2Detailed execution workflow (per-phase I/O, exceptions)
references/monitoring-guide.md2Monitoring guide (state machine, polling, CES alarms)
references/analysis-workflow.md3Detailed analysis workflow
references/managed-service-logs.md3Managed-service log reference (CES, LTS, audit)
references/verification-method.mdAllVerification methodology (all phases)
references/acceptance-criteria.mdAllAcceptance criteria (all phases)

Key Safety Features

  1. Dry Run mode — --dry-run simulates the full flow without API calls (Phase 2 & 3)
  2. Auto-rollback — --auto-rollback starts instances back up when shutdown fails
  3. Independent rollback script — rollback_experiment.py is standalone, does not depend on main script state
  4. Full logging — execution-log.json records per-phase timestamps and state changes
  5. Pre-check gate — verifies all instances are ACTIVE before execution
  6. Stop-condition early rollback — CES alarm fires → skip remaining duration → rollback immediately
  7. Mandatory confirmation — real execution requires explicit --yes; otherwise refuses
  8. Environment variable whitelist — child processes receive only necessary vars, not full os.environ

ECS Instance State Machine

Stop:    ACTIVE → STOPPING → SHUTOFF
Start:   SHUTOFF → STARTING → ACTIVE
Abnormal: any → ERROR

Limitations

  • Depends on hcloud CLI with sufficient ECS permissions (BatchStopServers, BatchStartServers, ListServersDetails)
  • AS group check requires AS API access (skipped if unavailable)
  • CES SYS.ECS metrics are aggregated at 5-minute granularity (period=300); shorter periods return empty
  • CES API may be unreachable in sandboxed environments — see references/managed-service-logs.md → CES section
  • AGT.ECS metrics (memory) require telescope/uniagent Agent installed inside the ECS
  • LTS collection requires ICAgent shipping logs to a LTS log group; missing group = no data, not "unaffected"
  • Does not support composite scenarios (e.g., multi-action AZ-level interruption) — focused on single ECS shutdown
  • In real-time mode instance_timeline is unavailable, so recovery-time analysis is skipped
  • Error-pattern analysis is based on string matching and may miss unusual log formats

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Huawei Cloud Ecs Shutdown Experiment؟

Full lifecycle ECS shutdown fault injection experiment for Huawei Cloud chaos engineering: prepare → execute → analyze. Phase 1 discovers target ECS instances, validates compatibility, generates experiment configuration. Phase 2 executes BatchStopServers shutdown, polls status, holds for duration, rolls back via BatchStartServers, verifies recovery, generates execution report. Phase 3 collects CES monitoring metrics and LTS application logs, analyzes error patterns, generates analysis report. Key safety: --dry-run, --auto-rollback, mandatory --yes confirmation, independent emergency rollbac...

لماذا تستخدم Huawei Cloud Ecs Shutdown Experiment على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Huawei Cloud Ecs Shutdown Experiment عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Huawei Cloud Ecs Shutdown Experiment في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/computing/ecs/huawei-cloud-ecs-shutdown-experiment. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Huawei Cloud Ecs Shutdown Experiment؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Huawei Cloud Ecs Shutdown Experiment؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Huawei Cloud Ecs Shutdown Experiment معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Huawei Cloud Ecs Shutdown Experiment مجانية؟

نعم. نشرها huaweicloud على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇