Terminal
Terminal/Skill
Generates an HTML health report for Alibaba Cloud Redis instances covering usage trends, big and hot keys, slow logs, alerts and fixes.
By Alibaba Cloud
Works with
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-kvstore-health-inspectionCore Rule: All inspections MUST be executed via
python3 scripts/health-inspect.py. The script encapsulates all correct API calls internally. The AI MUST NOT callaliyunCLI directly to collect inspection data.
health-inspect.py. The AI must not bypass the script by running aliyun r-kvstore directly. The only aliyun commands allowed for direct AI invocation are: aliyun configure list (check credentials), aliyun version (check version), aliyun configure set (set configuration), aliyun plugin (plugin management)describe-history-monitor-values API. NEVER use aliyun cms describe-metric-list/describe-metric-data as a substitutemodify-instance*, create-instance*, delete-instance* or any other APIs that modify instance stateYou do not need to run any scripts manually! This is an AI Agent skill — simply describe your needs in natural language.
Example 1: Single instance inspection
Inspect Redis instance r-bp1xxxxxxxxxxxx
Example 2: Multi-instance inspection
Inspect instances r-bp1xxxxxxxxxxxx and r-bp2yyyyyyyyyyyyyy
Example 3: Full account inspection (all instances)
Inspect all Redis instances in my account
Example 4: Specify Region
Inspect Redis instance r-bp1xxxxxxxxxxxx in cn-hangzhou region
Example 5: Resource usage with custom time range
Show resource usage for r-bp1xxxxxxxxxxxx in the last 3 days
Maps to --days 3
Example 6: Resource usage only
Show CPU and memory usage for r-bp1xxxxxxxxxxxx
Maps to --item resource
Example 7: Slow logs only
Analyze recent slow logs for r-bp1xxxxxxxxxxxx
Maps to --item slowlog
Example 8: Big/Hot key analysis
Check for big keys and hot keys in r-bp1xxxxxxxxxxxx
Maps to --item bigkey
Example 9: Combined inspection items
Show slow logs and alert history for r-bp1xxxxxxxxxxxx
Maps to --item slowlog --item alert
Example 10: Batch + specific items
Show CPU usage for all instances in the last 3 days
Maps to --all --days 3 --item resource
Example 11: Specify output format
Generate a Markdown report for r-bp1xxxxxxxxxxxx
Maps to --format markdown
python3 scripts/health-inspect.py. The AI's role is: identify user intent -> assemble correct script parameters -> execute script -> present report to user. Do NOT call aliyun CLI directly to collect any inspection data--allhealth-inspect.py r-xxx r-yyyhealth-inspect.py r-xxx--item parameters
--item resource--item session--item bigkey--item slowlog--item alert--item (e.g., --item resource --item slowlog)--item, default to full inspection--all has built-in instance discovery. The AI does not need to call describe-instances firstpython3 scripts/health-inspect.py <params> — one command completes all data collectionThis skill performs resource usage health inspection of Redis instances and generates standardized reports.
Inspection Dimensions (7 Sections):
Resource Metrics:
Architecture Support:
Instance Type Support:
Architecture: R-kvstore API (DescribeHistoryMonitorValues) + Aliyun CLI
Runtime Environment:
Required CLI Tools:
Python Dependencies:
# Uses only Python standard library: subprocess, json, os, sys, datetime
# All Alibaba Cloud API calls are made through aliyun CLI
Installation Verification:
Pre-check: Aliyun CLI >= 3.3.3 required Run
aliyun versionto verify >= 3.3.3. If not installed or version too low, seereferences/cli-installation-guide.mdfor detailed installation instructions, or runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto install/update. Then [MUST] runaliyun configure set --auto-plugin-install trueto enable automatic plugin installation. Then [MUST] runaliyun plugin updateto ensure plugins are up-to-date.
[MUST] CLI User-Agent — Every business API aliyun CLI invocation (e.g. aliyun r-kvstore …, aliyun das …, aliyun cms …) MUST carry the --user-agent flag with the full UA template defined in the Observability section below. System / utility commands MUST NOT carry --user-agent (see the exclusion list in the Observability section). Do NOT rely on the deprecated aliyun configure ai-mode mechanism or the ALIBABA_CLOUD_USER_AGENT environment variable — both have been retired.
This skill emits observability headers via the --user-agent flag on every business API aliyun CLI command. The deprecated aliyun configure ai-mode enable / disable / set-user-agent commands and the ALIBABA_CLOUD_USER_AGENT env var MUST NOT be used.
Scope rule (SA-2.11):
--user-agent): aliyun r-kvstore <action>, aliyun das <action>, aliyun cms <action>, etc.--user-agent): aliyun configure … (e.g. aliyun configure list, aliyun configure set), aliyun plugin … (e.g. aliyun plugin update, aliyun plugin install, aliyun plugin list), aliyun help, aliyun version, aliyun upgrade, aliyun --help.# 32-char lowercase hex without dashes (UUID v4)
export ALICLOUD_SKILL_SESSION_ID="$(uuidgen | tr -d '-' | tr 'A-F' 'a-f')"
AlibabaCloud-Agent-Skills/alibabacloud-kvstore-health-inspection/${ALICLOUD_SKILL_SESSION_ID}
The /{session-id} segment is mandatory — a UA without it will be rejected by SA-2.11 review.
--user-agent on every business API aliyun CLI commandApplies only to business product commands (r-kvstore / das / cms / etc.). System commands listed in the scope rule above MUST NOT have --user-agent appended.
# ✅ Business API command — UA REQUIRED
aliyun r-kvstore describe-instances \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-kvstore-health-inspection/${ALICLOUD_SKILL_SESSION_ID}"
# ❌ System / utility commands — UA MUST NOT be passed
aliyun configure list
aliyun plugin update
aliyun version
The Python script scripts/health-inspect.py automatically injects this UA on every internal business API aliyun invocation, and never on system commands. When the AI issues direct CLI calls, it MUST append --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-kvstore-health-inspection/${ALICLOUD_SKILL_SESSION_ID}" to business API commands only — and MUST NOT append it to aliyun configure …, aliyun plugin …, aliyun help, aliyun version, aliyun upgrade, or aliyun --help.
Do not skip the UA, alter the format, or omit the /{session-id} segment.
This skill uses read-only APIs only. No write permissions are required.
For the full permission policy and detailed descriptions, see references/ram-policies.md.
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
- Read
references/ram-policies.mdto get the full list of permissions required by this SKILL- Use
ram-permission-diagnoseskill to guide the user through requesting the necessary permissions- Pause and wait until the user confirms that the required permissions have been granted
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values
- NEVER ask the user to input AK/SK directly in the conversation or command line
- ONLY use
aliyun configure listto check credential statusaliyun configure listCheck the output for a valid profile.
If no valid profile exists, STOP here. Guide the user to configure credentials outside of this session.
| Parameter | Required/Optional | Description | Default |
|---|---|---|---|
| InstanceId | Required (omit with --all) | Redis instance ID (r-xxx), supports multiple | User must provide |
| RegionId | Optional | Instance region (auto-discovered if not provided) | Auto-discover |
| Days | Optional | Inspection time range (days) | 7 |
| Item | Optional | Specify inspection items (multiple allowed); omit for full inspection | Full |
| Profile | Optional | aliyun CLI profile name | Default profile |
| Output | Optional | Report output directory or file path | ~/Downloads/ |
| Format | Optional | Report format: html, markdown, text | html |
Item values:
| item | Inspection Content |
|---|---|
resource | CPU/memory/connection/bandwidth usage trends (data nodes + proxy nodes) |
session | Current session information, connection usage, source IP statistics |
bigkey | Big key / hot key analysis (large keys, big keys, hot keys, high traffic keys) |
slowlog | Slow log statistics and command analysis |
alert | Alert rules configuration and alert history |
python3 scripts/health-inspect.py <INSTANCE_ID> [options]
CLI Arguments:
| Argument | Short | Description |
|---|---|---|
INSTANCE_ID | (positional) | Redis instance ID, supports multiple; omit with --all |
--all | Inspect all Redis instances in the current account | |
--region | -r | Specify Region (auto-discovers if not specified) |
--days | -d | Inspection time range (days), default 7 |
--item | Specify inspection item (can be used multiple times); omit for full. Options: resource, session, bigkey, slowlog, alert | |
--profile | -p | Specify aliyun CLI profile name |
--output | -o | Specify report output directory or file path |
--format | -f | Report format: html (default), markdown, text |
Examples:
# Single instance (auto-discover Region)
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx
# Multi-instance
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx r-bp2yyyyyyyyyyyyyy
# All instances in account
python3 scripts/health-inspect.py --all
# All instances in specific Region
python3 scripts/health-inspect.py --all --region cn-hangzhou
# Custom time range (last 3 days)
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --days 3
# Resource usage only (CPU/memory/connection/bandwidth)
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item resource
# Big key and hot key analysis only
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item bigkey
# Slow logs only
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item slowlog
# Slow logs and alerts only
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item slowlog --item alert
# Batch + specific items
python3 scripts/health-inspect.py --all --item resource --item slowlog
# Markdown format
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --format markdown
# Custom output directory
python3 scripts/health-inspect.py --all -o /tmp/redis_report
# Full parameters
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx -p myprofile -r cn-hangzhou -d 14 -o ./report
The script completes all inspection steps automatically. For multi-instance runs, reports are output to a single directory with a summary page (index.html).
Item Selection Examples:
When the user specifies particular inspection items, map their intent to --item parameters:
# User says "check CPU and memory" -> resource item
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item resource
# User says "analyze slow commands" -> slowlog item
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item slowlog
# User says "find big keys" -> bigkey item
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item bigkey
# User says "check sessions and connections" -> session item
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item session
# User says "review alerts" -> alert item
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item alert
# User specifies multiple items
python3 scripts/health-inspect.py r-bp1xxxxxxxxxxxx --item resource --item bigkey --item slowlog
When the user does not specify items, omit the --item parameter to run full inspection (all 7 sections).
For manual step-by-step API call details, see
references/manual-workflow.md(only use when the script is unavailable).
For report output format templates (text + HTML/ECharts layout specs), see
references/report-format.md(only reference when adjusting report styles).
scripts/health-inspect.py — One-command inspection main scriptscripts/find-instance-region.py — Auto-discover instance Regionscripts/check-write-operation.sh — Write operation detection hookconfig/metrics.json — Metrics configuration per architecture typereferences/manual-workflow.md — Manual step-by-step API call detailsreferences/report-format.md — Inspection report output format specificationreferences/ram-policies.md — RAM permission policy and setup guidereferences/cli-installation-guide.md — Aliyun CLI installation and configuration guide