oraclecloud-debug-bundle
Collect OCI instance diagnostics — serial console, cloud-init logs, metadata, and VCN flow logs — into a single debug bundle. Use when an OCI instance is unresponsive, stuck in provisioning, or showing infrastructure errors. Trigger with "oraclecloud debug bundle", "oci diagnostics", "oci serial console", "oci instance debug".
Best use case
oraclecloud-debug-bundle is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Collect OCI instance diagnostics — serial console, cloud-init logs, metadata, and VCN flow logs — into a single debug bundle. Use when an OCI instance is unresponsive, stuck in provisioning, or showing infrastructure errors. Trigger with "oraclecloud debug bundle", "oci diagnostics", "oci serial console", "oci instance debug".
Teams using oraclecloud-debug-bundle should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/oraclecloud-debug-bundle/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How oraclecloud-debug-bundle Compares
| Feature / Agent | oraclecloud-debug-bundle | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Collect OCI instance diagnostics — serial console, cloud-init logs, metadata, and VCN flow logs — into a single debug bundle. Use when an OCI instance is unresponsive, stuck in provisioning, or showing infrastructure errors. Trigger with "oraclecloud debug bundle", "oci diagnostics", "oci serial console", "oci instance debug".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
SKILL.md Source
# Oracle Cloud Debug Bundle
## Overview
Collect comprehensive diagnostics from an unresponsive OCI compute instance without touching the OCI Console. When an instance reports "unavailable due to an issue with the underlying infrastructure" or cloud-init failures, you need serial console output, cloud-init logs, instance metadata, and VCN flow logs — all gathered via CLI commands into a single tar archive for root-cause analysis or support ticket attachment.
**Purpose:** Generate a self-contained debug bundle (`.tar.gz`) with all the data OCI Support will ask for, collected in under 60 seconds.
## Prerequisites
- **OCI CLI installed and configured** — `oci --version` returns 3.x+, `~/.oci/config` is valid (see `oraclecloud-install-auth`)
- **Python 3.8+** with the OCI SDK — `pip install oci`
- **Compartment OCID** — the compartment containing the target instance
- **Instance OCID** — format: `ocid1.instance.oc1.{region}.aaaa...`
- **IAM policies** granting `inspect instance-console-histories`, `read instances`, `read vcn-flow-logs` in the target compartment
## Instructions
### Step 1: Set Target Variables
```bash
export INSTANCE_OCID="ocid1.instance.oc1.iad.YOUR_INSTANCE_OCID"
export COMPARTMENT_OCID="ocid1.compartment.oc1..YOUR_COMPARTMENT_OCID"
export BUNDLE_DIR="oci-debug-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BUNDLE_DIR"
```
### Step 2: Capture Instance Metadata
```bash
oci compute instance get \
--instance-id "$INSTANCE_OCID" \
--query 'data.{state:"lifecycle-state",shape:shape,ad:"availability-domain",created:"time-created",fault:"fault-domain"}' \
--output json > "$BUNDLE_DIR/instance-metadata.json"
echo "Instance state: $(jq -r '.state' "$BUNDLE_DIR/instance-metadata.json")"
```
### Step 3: Retrieve Serial Console History
The serial console captures kernel panics, boot failures, and cloud-init output — even when SSH is unreachable:
```bash
# Create a console history capture
CAPTURE_ID=$(oci compute instance-console-history capture \
--instance-id "$INSTANCE_OCID" \
--query 'data.id' --raw-output)
echo "Console history capture: $CAPTURE_ID"
# Wait for capture to complete, then download
sleep 10
oci compute instance-console-history get-content \
--instance-console-history-id "$CAPTURE_ID" \
> "$BUNDLE_DIR/serial-console.log"
echo "Serial console: $(wc -l < "$BUNDLE_DIR/serial-console.log") lines"
```
### Step 4: Extract Cloud-Init Logs via Instance Agent
If the instance agent is running, pull cloud-init logs via the run-command plugin:
```bash
COMMAND_ID=$(oci instance-agent command create \
--compartment-id "$COMPARTMENT_OCID" \
--target '{"instanceId":"'"$INSTANCE_OCID"'"}' \
--content '{"source":{"sourceType":"TEXT","text":"cat /var/log/cloud-init.log | tail -200"}}' \
--timeout-in-seconds 30 \
--query 'data.id' --raw-output)
sleep 15
oci instance-agent command get \
--command-id "$COMMAND_ID" \
--query 'data."delivery-state"' --raw-output
# Retrieve output
oci instance-agent command get-content \
--command-id "$COMMAND_ID" \
> "$BUNDLE_DIR/cloud-init.log"
```
### Step 5: Collect VCN Flow Logs
```bash
oci logging search \
--search-query "search \"$COMPARTMENT_OCID\" | where source = 'vcn' | sort by datetime desc" \
--time-start "$(date -u -d '-1 hour' +%Y-%m-%dT%H:%M:%SZ)" \
--time-end "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--output json > "$BUNDLE_DIR/vcn-flow-logs.json" 2>&1 || echo "Flow logs unavailable" > "$BUNDLE_DIR/vcn-flow-logs.json"
```
### Step 6: Query Instance Metrics
```python
import oci
import datetime
import json
config = oci.config.from_file("~/.oci/config")
monitoring = oci.monitoring.MonitoringClient(config)
end = datetime.datetime.utcnow()
start = end - datetime.timedelta(hours=1)
response = monitoring.summarize_metrics_data(
compartment_id="COMPARTMENT_OCID",
summarize_metrics_data_details=oci.monitoring.models.SummarizeMetricsDataDetails(
namespace="oci_computeagent",
query='CpuUtilization[5m]{resourceId = "INSTANCE_OCID"}.max()',
start_time=start.isoformat() + "Z",
end_time=end.isoformat() + "Z",
),
)
with open("oci-debug-bundle/instance-metrics.json", "w") as f:
json.dump([item.__dict__ for item in response.data], f, indent=2, default=str)
```
### Step 7: Package the Bundle
```bash
# Add a summary header
cat > "$BUNDLE_DIR/README.txt" << EOF
OCI Debug Bundle
Instance: $INSTANCE_OCID
Captured: $(date -u)
Contents:
instance-metadata.json - Lifecycle state, shape, AD, fault domain
serial-console.log - Serial console history (boot output, kernel msgs)
cloud-init.log - Cloud-init execution log (last 200 lines)
vcn-flow-logs.json - VCN flow log entries (last 1 hour)
instance-metrics.json - CPU utilization metrics (last 1 hour)
EOF
tar -czf "$BUNDLE_DIR.tar.gz" "$BUNDLE_DIR"
echo "Bundle ready: $BUNDLE_DIR.tar.gz ($(du -h "$BUNDLE_DIR.tar.gz" | cut -f1))"
```
## Output
Successful completion produces:
- A `oci-debug-YYYYMMDD-HHMMSS.tar.gz` archive containing five diagnostic files
- Instance metadata showing current lifecycle state, shape, and fault domain
- Serial console log capturing boot output, kernel messages, and cloud-init status
- Cloud-init execution logs (last 200 lines) retrieved via the instance agent
- VCN flow logs for the last hour to identify network-level issues
- CPU utilization metrics to detect resource exhaustion
## Error Handling
| Error | Code | Cause | Solution |
|-------|------|-------|----------|
| NotAuthorizedOrNotFound | 404 | Missing IAM policy or wrong OCID | Add `allow group <grp> to inspect instance-console-histories in compartment <comp>` |
| NotAuthenticated | 401 | Expired or invalid API key | Re-validate config: `oci iam user get --user-id $(grep ^user ~/.oci/config \| cut -d= -f2)` |
| Instance agent unreachable | — | Agent not running or instance stopped | Fall back to serial console history only (Step 3) |
| TooManyRequests | 429 | Rate limited on console history API | Wait 30 seconds and retry — OCI does not return a Retry-After header |
| InternalError | 500 | OCI service issue | Retry after 60 seconds; check https://ocistatus.oraclecloud.com |
| Flow logs empty | — | VCN flow logs not enabled | Enable flow logs: VCN > Subnet > Flow Logs > Enable |
## Examples
**Quick one-liner to check if instance is reachable:**
```bash
oci compute instance get --instance-id "$INSTANCE_OCID" \
--query 'data."lifecycle-state"' --raw-output
# Expected: RUNNING, STOPPED, or TERMINATED
```
**Automated bundle script (saves as `oci-debug.sh`):**
```bash
#!/bin/bash
set -euo pipefail
INSTANCE_OCID="${1:?Usage: oci-debug.sh <instance-ocid>}"
COMPARTMENT_OCID="${2:?Usage: oci-debug.sh <instance-ocid> <compartment-ocid>}"
BUNDLE="oci-debug-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BUNDLE"
oci compute instance get --instance-id "$INSTANCE_OCID" --output json > "$BUNDLE/metadata.json"
CAPTURE=$(oci compute instance-console-history capture --instance-id "$INSTANCE_OCID" --query 'data.id' --raw-output)
sleep 10
oci compute instance-console-history get-content --instance-console-history-id "$CAPTURE" > "$BUNDLE/serial.log"
tar -czf "$BUNDLE.tar.gz" "$BUNDLE" && rm -rf "$BUNDLE"
echo "Bundle: $BUNDLE.tar.gz"
```
## Resources
- [OCI Instance Console Connections](https://docs.oracle.com/en-us/iaas/Content/Compute/References/serialconsole.htm) — serial console access and history capture
- [OCI CLI Reference](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm) — full command-line interface documentation
- [OCI Python SDK Reference](https://docs.oracle.com/en-us/iaas/tools/python/latest/) — MonitoringClient and ComputeClient APIs
- [VCN Flow Logs](https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/vcn_flow_logs.htm) — enabling and querying flow logs
- [SDK Troubleshooting](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdk_troubleshooting.htm) — common auth and connectivity issues
- [OCI Known Issues](https://docs.oracle.com/en-us/iaas/Content/knownissues.htm) — current platform-known issues
## Next Steps
After collecting the debug bundle, review `oraclecloud-incident-runbook` for guided triage and recovery actions, or `oraclecloud-common-errors` for decoding specific error codes in the serial console output.Related Skills
workhuman-debug-bundle
Workhuman debug bundle for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman debug bundle".
wispr-debug-bundle
Wispr Flow debug bundle for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr debug bundle".
webflow-debug-bundle
Collect Webflow debug evidence for support tickets and troubleshooting. Gathers SDK version, token validation, rate limit status, site connectivity, CMS health, and error logs into a single diagnostic bundle. Trigger with phrases like "webflow debug", "webflow support bundle", "collect webflow logs", "webflow diagnostic", "webflow troubleshoot".
vercel-debug-bundle
Collect Vercel debug evidence for support tickets and troubleshooting. Use when encountering persistent issues, preparing support tickets, or collecting diagnostic information for Vercel problems. Trigger with phrases like "vercel debug", "vercel support bundle", "collect vercel logs", "vercel diagnostic".
veeva-debug-bundle
Veeva Vault debug bundle for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva debug bundle".
vastai-debug-bundle
Collect Vast.ai debug evidence for support tickets and troubleshooting. Use when encountering persistent issues, preparing support tickets, or collecting diagnostic information for Vast.ai problems. Trigger with phrases like "vastai debug", "vastai support bundle", "collect vastai logs", "vastai diagnostic".
twinmind-debug-bundle
Collect comprehensive diagnostic information for TwinMind issues. Use when preparing support requests, investigating complex problems, or gathering evidence for bug reports. Trigger with phrases like "twinmind debug", "twinmind diagnostics", "collect twinmind info", "twinmind support bundle".
together-debug-bundle
Together AI debug bundle for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together debug bundle".
techsmith-debug-bundle
TechSmith debug bundle for Snagit COM API and Camtasia automation. Use when working with TechSmith screen capture and video editing automation. Trigger: "techsmith debug bundle".
supabase-debug-bundle
Collect Supabase diagnostic info for troubleshooting and support tickets. Use when debugging connection failures, auth issues, Realtime drops, Storage errors, RLS misconfigurations, or preparing a support escalation. Trigger: "supabase debug", "supabase diagnostics", "supabase support bundle", "collect supabase logs", "debug supabase connection".
stackblitz-debug-bundle
Collect WebContainer diagnostic info: boot state, file system, process list. Use when working with WebContainers or StackBlitz SDK. Trigger: "stackblitz debug".
speak-debug-bundle
Collect diagnostic information for Speak API issues: auth verification, audio format validation, session inspection, and network testing. Use when implementing debug bundle features, or troubleshooting Speak language learning integration issues. Trigger with phrases like "speak debug bundle", "speak debug bundle".