agentleFS
mchittinenimchittineni/cloud-platform-skills/.cursor/rules/skills/linux-sysadmin-troubleshooting.mdc

cloud-platform-skills / skills

Cursor rule1 starsChanged 3 months agoMITView on GitHub

Linux host troubleshooting with the USE method (Utilization, Saturation, Errors): high load average, memory pressure and OOM kills, disk and inode exhaustion, I/O wait, processes hung in D state, socket and DNS failures. Use when a server or VM is degraded, crawling, or unresponsive and needs live hands-on diagnosis, when writes fail with 'No space left on device' despite free space, or when a stuck process must be traced.

The file

We split this linux-sysadmin-troubleshooting.mdc into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    When diagnosing an unresponsive or degraded Linux node, follow the USE Method (Utilization, Saturation, and Errors) systematically across …

    line 25
  2. Very specific:

    Do: Always inspect Inodes (df -i) if df -h shows disk space available but writes fail with No space left on device.

    line 101
  3. Very specific:

    Do: Look at CPU %steal in virtualized cloud environments (AWS EC2 / GCP Compute Engine) to identify noisy neighbors.

    line 102
  4. Very specific:

    Don't: Never use kill -9 (SIGKILL) immediately.

    line 103
  5. Very specific:

    Don't: Avoid running heavy find / commands during peak traffic without -xdev to avoid crossing network mounts.

    line 104

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
linux-sysadmin-troubleshooting.mdc
---
description: "Linux host troubleshooting with the USE method (Utilization, Saturation, Errors): high load average, memory pressure and OOM kills, disk and inode exhaustion, I/O wait, processes hung in D state, socket and DNS failures. Use when a server or VM is degraded, crawling, or unresponsive and needs live hands-on diagnosis, when writes fail with 'No space left on device' despite free space, or when a stuck process must be traced."
globs:
alwaysApply: false
---

# Linux SysAdmin & Production Troubleshooting Guide

## When to Use This Skill

**Triggers — load this skill when:**

- A node shows high load, memory pressure, disk-full, or I/O wait and you need a systematic first-pass diagnosis
- You need the exact command sequence (top/ps/strace/vmstat/iostat/ss/dig) for a live incident
- You are teaching or reviewing baseline Linux operational competence

**Route elsewhere when:**

- Container-level or Kubernetes-scheduling symptoms -> `docker-containerization-basics` or `helm-kubernetes-deployment`
- Fleet-wide metric collection and alert rules -> `infrastructure-host-monitoring`
- Suspected compromise rather than performance fault -> `secops-incident-triage-forensics`

## 1. Diagnostic Decision Tree

When diagnosing an unresponsive or degraded Linux node, follow the **USE Method** (Utilization, Saturation, and Errors) systematically across CPU, Memory, Disk I/O, and Network.

```text
                  [High Latency / Alert]
                            |
           +----------------+----------------+
           |                |                |
         [CPU]            [Memory]        [Disk / IO]
       top / htop      free -m / vmstat   iostat -xz 1
       mpstat -P ALL   dmesg | grep oom   df -h / df -i
```

---

## 2. Standard Diagnostic Commands

### CPU & Process Inspection

```bash
# 1. Check load average against core count
uptime
nproc

# 2. Top processes sorted by CPU / Memory
top -b -n 1 | head -n 20
ps aux --sort=-%cpu | head -n 10
ps aux --sort=-%mem | head -n 10

# 3. Trace system calls of a stuck process
strace -p <PID> -f -c
```

### Memory & OOM Diagnostics

```bash
# Detailed memory breakdown
free -h --wide

# Check if kernel OOM-killer terminated processes
dmesg -T | grep -i -E "oom|out of memory|killed process"
journalctl -k --grep="Out of memory" -n 50
```

### Disk & Storage Troubleshooting

```bash
# Check filesystem space and Inode exhaustion
df -h
df -i

# Find top 10 space-consuming directories
du -ahx /var/log 2>/dev/null | sort -rh | head -n 10

# Disk I/O utilization & wait times (%util, await)
iostat -xz 1 5
```

### Networking & Socket State

```bash
# Check listening ports and active sockets
ss -tulpn

# Inspect socket queue backlog
ss -s

# Test connection, latency, and DNS resolution
curl -Iv https://example.internal
dig +trace +short api.service.internal
nc -zv 10.0.1.50 443
```

---

## 3. Best Practices & Anti-Patterns

- **Do**: Always inspect Inodes (`df -i`) if `df -h` shows disk space available but writes fail with `No space left on device`.
- **Do**: Look at CPU `%steal` in virtualized cloud environments (AWS EC2 / GCP Compute Engine) to identify noisy neighbors.
- **Don't**: Never use `kill -9` (`SIGKILL`) immediately; attempt graceful `kill -15` (`SIGTERM`) first to allow socket closures and data flushing.
- **Don't**: Avoid running heavy `find /` commands during peak traffic without `-xdev` to avoid crossing network mounts.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.