agentleFS
3akat-system3akat-system/nexus-starter/.claude/skills/log-monitor/SKILL.md

log-monitor

Skill0 starsChanged 6 months agoMITView on GitHub

Log Monitor Agent — server and PM2 process monitoring. TRIGGER when: логи, logs, мониторинг, monitoring, проверь сервер, check server, что с сервером, server status, статус серверов, здоровье серверов, server health, health check, проверь процессы, check processes, алерты, alerts, ошибки на сервере, server errors, uptime. Contains: PM2 log analysis, error detection, disk/memory check, process health, alert summary.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After check — write the report to Agent-Notes/monitoring-log.md (append).

    line 111
  2. Distinctive:

    Check ALL servers, do not stop at the first one

    line 114
  3. Distinctive:

    If a server is unreachable — mark ❌ and move to the next

    line 115
  4. Distinctive:

    Always count errors, not just "there are errors"

    line 116
  5. Distinctive:

    If a critical issue is found — suggest a specific action

    line 118

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill 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
SKILL.md

Log Monitor Agent — Server Monitoring

Role

You are the Log Monitor Agent. You check the health of all servers, analyze PM2 logs, find errors and issues, and produce a structured report.

Servers

ServerHostingIPSSHPM2 ProcessesExtra Checks
FujiBeget155.212.210.165ssh -i ~/.ssh/id_rsa root@155.212.210.165fuji-routes, staff-bot, orders-botHTTP :3000/api/ping
PlusOneBeget31.128.42.61ssh -i ~/.ssh/id_rsa root@31.128.42.61plusone-bot—
Aeza (NEXUS+VPN)Aeza46.226.162.87ssh -i ~/.ssh/vpn_server_key root@46.226.162.87nexus-bot-v2, nexus-max, nexus-local, nexus-dashboard, vpn-bot, vpn-landing, nexus-siteHTTPS nexusvpn.site, nexus-system.ru

SSH: Always use full ssh -i key root@IP. Aliases (ssh nexusvpn, ssh root@fuji) are unreliable in subagents.

Check Algorithm (run ALL steps)

1. Server Availability

ssh -o ConnectTimeout=10 -i ~/.ssh/id_rsa root@155.212.210.165 "echo OK" 2>&1
ssh -o ConnectTimeout=10 -i ~/.ssh/id_rsa root@31.128.42.61 "echo OK" 2>&1
ssh -o ConnectTimeout=10 -i ~/.ssh/vpn_server_key root@46.226.162.87 "echo OK" 2>&1

2. PM2 Status of All Processes

ssh -i ~/.ssh/id_rsa root@155.212.210.165 "pm2 jlist 2>/dev/null" | head -200
ssh -i ~/.ssh/id_rsa root@31.128.42.61 "pm2 jlist 2>/dev/null" | head -100
ssh -i ~/.ssh/vpn_server_key root@46.226.162.87 "pm2 jlist 2>/dev/null" | head -200

Parse JSON. Check:

  • status must be online (not errored, not stopped)
  • pm2_env.restart_time — if > 5 in the last hour = restart loop
  • monit.memory — if > 200MB = warning
  • monit.cpu — if > 80% = warning

3. Log Errors (last 30 lines per process)

ssh -i ~/.ssh/id_rsa root@155.212.210.165 "pm2 logs --lines 30 --nostream 2>&1" | head -100
ssh -i ~/.ssh/id_rsa root@31.128.42.61 "pm2 logs --lines 20 --nostream 2>&1" | head -50
ssh -i ~/.ssh/vpn_server_key root@46.226.162.87 "pm2 logs --lines 30 --nostream 2>&1" | head -100

Look for patterns:

  • Error, ERROR, ECONNREFUSED, ECONNRESET
  • FATAL, SIGTERM, SIGKILL, OOM
  • UnhandledPromiseRejection, TypeError, ReferenceError
  • ETIMEOUT, EPERM, EACCES
  • 502, 503, 500

4. Server Resources

# Fuji
ssh -i ~/.ssh/id_rsa root@155.212.210.165 "df -h / && free -m | head -3 && uptime"
# PlusOne
ssh -i ~/.ssh/id_rsa root@31.128.42.61 "df -h / && free -m | head -3 && uptime"
# Aeza
ssh -i ~/.ssh/vpn_server_key root@46.226.162.87 "df -h / && free -m | head -3 && uptime"

5. SSL Certificates (expiration)

# Fuji
ssh -i ~/.ssh/id_rsa root@155.212.210.165 "certbot certificates 2>/dev/null || echo 'certbot not installed'"
# Aeza
ssh -i ~/.ssh/vpn_server_key root@46.226.162.87 "certbot certificates 2>/dev/null || echo 'certbot not installed'"
# External check
for DOMAIN in nexusvpn.site nexus-system.ru panel.nexus-system.ru; do
  echo | openssl s_client -servername $DOMAIN -connect $DOMAIN:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null || echo "$DOMAIN: SSL ERROR"
done

6. Nginx Status

ssh -i ~/.ssh/id_rsa root@155.212.210.165 "nginx -t 2>&1 && systemctl is-active nginx"
ssh -i ~/.ssh/vpn_server_key root@46.226.162.87 "nginx -t 2>&1 && systemctl is-active nginx"

Report Format

## 🖥️ Monitoring Report — YYYY-MM-DD HH:MM

### Fuji (155.212.210.165)
- Availability: ✅/❌
- PM2: fuji-routes ✅ | staff-bot ✅ | orders-bot ✅
- Restarts: 0 in the last hour
- Memory: 120MB / 2048MB (6%)
- Disk: 4.2GB / 20GB (21%)
- SSL: valid until 2026-07-15
- Errors: none / error list

### NEXUS (46.226.162.87)
- Availability: ✅/❌
- PM2: nexus-bot ✅
- ...

### Issues Requiring Attention
1. ❌ [critical] description
2. ⚠️ [warning] description

### Recommendations
- what to do

Saving Results

After check — write the report to Agent-Notes/monitoring-log.md (append).

Rules

  1. Check ALL servers, do not stop at the first one
  2. If a server is unreachable — mark ❌ and move to the next
  3. Always count errors, not just "there are errors"
  4. Highlight NEW errors (that were not there before)
  5. If a critical issue is found — suggest a specific action

Agent Intelligence — Automatic Escalation

Decision Tree

What was found?
├─ Server unreachable (SSH timeout)
│  └─ CRITICAL → Telegram alert → suggest checking hosting panel
│
├─ PM2 process errored/stopped
│  ├─ 1 process → suggest: "run /debug-server [name]"
│  └─ All processes → server problem: disk full? OOM? → check df + free
│
├─ Restart loop (>5 restarts per hour)
│  └─ Read pm2 logs --err → show last error → suggest fix
│
├─ Disk > 85%
│  └─ ⚠️ → show du -sh /var/log/ + du -sh /root/ → suggest pm2 flush
│
├─ Memory > 85%
│  └─ ⚠️ → show top 5 processes by RAM → suggest max_memory_restart
│
├─ SSL < 7 days
│  └─ ⚠️ → "certbot renew --dry-run" → if OK, "certbot renew"
│
├─ New errors in logs (not in qa-lessons.md)
│  └─ Write to monitoring-log.md + suggest investigation
│
└─ Everything is OK
   └─ Short report in monitoring-log.md

Cross-Agent Integration

FoundCall
PM2 crashed→ /debug-server
Slow responses→ /db-health
SSL < 7 days→ Telegram alert
500 errors in logs→ /qa-agent (targeted)

Self-Learning

Append to Agent-Notes/monitoring-log.md (append, do not overwrite):

## YYYY-MM-DD HH:MM — [OK/WARN/FAIL]
- Fuji: OK | PlusOne: OK | Aeza: OK
- Errors: [list or "none"]
- Lesson: [what was new]

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.