Xpersona
S

Server-Mate

CLAWHUB · Unverified

Build or extend a lightweight server monitoring and AI operations workflow for Linux hosts running Nginx or Apache, with optional centralized remote monitoring through the BT-Panel (Baota) HTTP API. Use when Codex needs to collect psutil metrics, parse access, error, or auth logs (locally OR pulled

62
Rank
84
Safety
1.1k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17050jbyjd1x0p5mb5z41j5n983hd2e:server-mate
  1. Install using `clawhub skill install s17050jbyjd1x0p5mb5z41j5n983hd2e:server-mate` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/tankeito/server-mate before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-tankeito-server-mate/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

150,884 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: server-mate
version: 1.6.1
description: Build or extend a lightweight server monitoring and AI operations workflow for Linux hosts running Nginx or Apache, with optional centralized remote monitoring through the BT-Panel (Baota) HTTP API. Use when Codex needs to collect psutil metrics, parse access, error, or auth logs (locally OR pulled remotely from BT panels with no probe on the target host), design JSON payloads or APIs, add webhook alerts, generate PDF ops reports with SSL expiry summaries, answer natural-language monitoring questions, or implement guarded auto-ban and auto-heal behaviors.
homepage: https://github.com/tankeito/server-mate
metadata:
  clawdbot:
    files:
      - scripts/*
      - references/*
      - config.example.yaml
      - user-guide.md
      - _meta.json
---

# Server Mate

Version: `1.6.1`

Use this skill to design or implement a two-plane monitoring system:
- a Python agent that tails local logs OR pulls remote logs through the BT-Panel HTTP API (centralized, agentless), and samples host metrics
- an OpenClaw-side analyzer that aggregates data, explains failures, answers questions, and sends alerts

The same Agent serves both layouts: leave `panel_id` empty on a site to keep the legacy local-tail path; set `panel_id` on a site to pull its access / error logs remotely with no probe installed on the target host.

## Start

- Confirm the environment first: Linux distribution, Nginx or Apache, PHP-FPM layout, log paths, webhook target, and whether automated actions may touch a live host.
- Keep collection read-only until the user explicitly asks for automation. Add alerting before any auto-ban or auto-heal behavior.
- In OpenClaw deployments, `OPENAI_API_KEY` is injected by the runtime when AI analysis is enabled. Do not ask the user to export it manually. Treat webhook URLs or tokens in `config.yaml` as secrets and do not commit them.
- Treat `./data/GeoIP.conf` the same way. It may contain MaxMind `AccountID` and `LicenseKey`, so keep it local-only and out of Git.
- Prefer MaxMind's official GeoLite2 workflow through `./data/GeoIP.conf` and `geoipupdate`. Treat the built-in public mirror fallback only as an operator-reviewed bootstrap path when no local `.mmdb` file is present.
- Treat auto-ban and auto-heal as privileged features. They may execute operator-supplied firewall or service restart commands and should stay disabled or `dry_run: true` until reviewed.
- Use the references progressively instead of loading everything at once:
  - Read [references/architecture.md](references/architecture.md) for overall design, component boundaries, and rollout order.
  - Read [references/data-contracts.md](references/data-contracts.md) before defining JSON payloads, storage schemas, metrics, or natural-language query handlers.
  - Read [references/ops-playbook.md](references/ops-playbook.md) before implementing thresholds, webhooks, reports, auto-ban, or self-heal logic.
  - Read [references/sqlite-schema.md](referenc

README.md

English | [Chinese](README_ZH.md)

---

# Server-Mate | Lightweight Server Monitoring and AI Ops

> A two-plane monitoring system for Linux hosts running Nginx or Apache, now with **lightweight centralized remote monitoring** via BT-Panel API — one Agent, many servers, no remote installation required.

[![Version](https://img.shields.io/badge/version-1.6.1-blue.svg)]()
[![OpenClaw](https://img.shields.io/badge/OpenClaw-Skill-success.svg)]()
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Platform](https://img.shields.io/badge/Platform-CentOS%2FUbuntu%2FDebian-lightgrey.svg)](https://linux.org)
[![Python](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://python.org)
[![Web Server](https://img.shields.io/badge/Web%20Server-Nginx%2FApache-orange.svg)](https://nginx.org)

---

## Overview

**Server-Mate** is a lightweight server monitoring and AI operations workflow for Linux web hosts running Nginx or Apache.

As of v1.5.x, Server-Mate collects a **comprehensive Linux system metrics stack** across four layers — CPU detail, memory/swap, disk IOPS, network rates, process accounting, inode usage, TCP connection states, and systemd service health — all via `psutil` and the standard library with zero new dependencies. It also retains the v1.4.x **Centralized Remote Monitoring** architecture: a single Agent host can monitor an entire fleet by pulling logs through the BT-Panel (Baota) HTTP API with no remote installation required.

It splits responsibilities into two planes:
- **Server Agent**: a Python collector that tails local logs (or pulls remote logs through BT-Panel), samples host metrics, and writes SQLite rollups
- **AI Analyzer**: an OpenClaw-side layer that generates reports, pushes webhooks, explains issues, and drives guarded automation

### Key Features

- **Centralized remote collection**: pull Nginx / Apache logs from many hosts through BT-Panel API — no agent, daemon, or extra package on the remote machines
- **Real-time metrics**: CPU, memory, disk, load, and network I/O via `psutil`
- **Extended Linux metrics — Layer 1**: CPU user/system/iowait; memory available; swap usage; per-cycle disk IOPS and network Mbps; NIC error and drop counters
- **Extended Linux metrics — Layer 2**: process count, zombie detection, and top-5 CPU/memory process ranking
- **Extended Linux metrics — Layer 3**: root-disk inode usage; configurable extra partition monitoring (e.g. `/data`, `/home`)
- **Extended Linux metrics — Layer 4**: TCP connection state breakdown (ESTABLISHED / TIME_WAIT / CLOSE_WAIT); systemd service health probes
- **Log parsing**: normalized Nginx and Apache access/error log processing
- **Traffic analytics**: PV, UV, IP count, QPS, bandwidth, and status-code breakdowns
- **Spider detection**: crawler-family recognition and traffic separation
- **Smart alerts**: DingTalk, WeCom, Feishu, and Telegram webhook delivery
- **10 new alert kinds**: `iowait_high`, `swap_high`

_meta.json

{
  "ownerId": "kn791bxpmse6nv4nqy8skgg2n182b5t2",
  "slug": "server-mate",
  "version": "1.6.1",
  "publishedAt": 1782824726558
}

references/architecture.md

# Architecture

## Goal

Build a lightweight monitoring stack for CentOS servers that can live next to Baota/BT panel instead of replacing it. Split responsibilities cleanly:
- Server agent: collect host metrics, parse access and error logs, emit structured events
- OpenClaw-side analyzer: aggregate, answer questions, enrich errors, trigger alerts, and manage guarded automation

## Deployment assumptions

- Expect CentOS or another RHEL-like host.
- Expect Nginx, Apache, or both behind Baota/BT panel.
- Do not assume any vendor-specific log tree. Always verify the actual `access_log` and `error_log` directives or set explicit paths in `config.yaml`.
- Expect PHP-FPM for many PHP sites, but do not assume a single service name. Some environments use `php-fpm`, others use versioned units or init scripts.
- Expect webhook targets such as WeCom, DingTalk, or ServerChan to be configured outside the core parser.

## Component layout

1. Agent process
   - Sample `cpu`, memory, disk, load, and network I/O with `psutil`
   - Tail `access.log` and `error.log`
   - Convert lines to normalized JSON
   - Push batches through stdout, file drop, HTTP POST, or websocket transport
2. Ingestion layer
   - Accept event batches
   - Attach host metadata and ingestion timestamps
   - Reject malformed payloads without losing the raw line reference
3. Storage layer
   - Keep append-only raw events for replay
   - Keep rollup tables or cached counters for fast natural-language answers
4. Analysis layer
   - Compute traffic, performance, security, spider, and error metrics
   - Detect threshold breaches and burst patterns
   - Generate summaries for reports and chat answers
5. Notification and action layer
   - Format webhook messages
   - Gate auto-ban and auto-heal behind policy checks
   - Write audit events for every action

## Recommended rollout

1. Deliver read-only collection first.
   - System snapshots
   - Access event parsing
   - Error event parsing
2. Deliver rollups next.
   - PV, UV, IP counts
   - Status breakdown
   - QPS and response time
   - Top URIs and sources
   - Error categories and fingerprints
3. Deliver notifications next.
   - CPU, memory, disk
   - 5xx burst
   - suspicious IP and 404 burst
   - latency degradation
4. Deliver automation last.
   - auto-ban with TTL and allowlists
   - auto-heal with cooldowns and health checks

## Logging requirements

- Prefer an access log that exposes:
  - remote IP
  - timestamp
  - request line
  - status code
  - response bytes
  - referer
  - user-agent
  - response time
  - request length or another upload-size proxy if upload metrics matter
- If the current log format does not include response time or request length, treat those metrics as unavailable until the log format is extended.
- Keep raw log excerpts on normalized events so an analyst can still inspect parser edge cases.

## Failure domains

- Parser failure: count and surface it; never hide it.
- Transport failure: queue or retry without d

references/data-contracts.md

# Data contracts

## Core event types

Use four normalized event families as the base contract:

1. `system_snapshot`
   - Host health sampled from `psutil`
   - Use for CPU, memory, disk, load, and network counters
2. `access_event`
   - One parsed request from Nginx or Apache access logs
   - Use for traffic, status, performance, source, and spider analysis
3. `error_event`
   - One parsed error line from Nginx, Apache, PHP-FPM, or adjacent services
   - Use for alerting, de-duplication, AI explanation, and report ranking
4. `action_event`
   - One alert, dry-run, ban, unban, restart, or failed remediation attempt
   - Use for auditability and operator trust

## Shared fields

Every event should include:

```json
{
  "event_type": "access_event",
  "ts": "2026-03-25T10:00:00+08:00",
  "host_id": "web-01",
  "site": "example.com",
  "source": "nginx-access",
  "raw": "original log line or compact excerpt"
}
```

## Suggested payloads

### system_snapshot

```json
{
  "event_type": "system_snapshot",
  "cpu_pct": 71.4,
  "memory_pct": 63.1,
  "disk_used_pct": 54.8,
  "disk_free_bytes": 19434733568,
  "load_1m": 0.77,
  "net_rx_bytes": 1234567890,
  "net_tx_bytes": 987654321
}
```

### access_event

```json
{
  "event_type": "access_event",
  "client_ip": "203.0.113.8",
  "method": "GET",
  "uri": "/api/orders",
  "status": 200,
  "bytes_out": 4281,
  "bytes_in": 512,
  "response_ms": 182.4,
  "referer": "https://www.google.com/search?q=orders",
  "source_channel": "search",
  "source_name": "google",
  "user_agent": "Mozilla/5.0 ...",
  "spider_family": null
}
```

### error_event

```json
{
  "event_type": "error_event",
  "severity": "error",
  "component": "nginx",
  "category": "primary_script_unknown",
  "fingerprint": "primary_script_unknown:fastcgi_sent_in_stderr",
  "client_ip": "203.0.113.8",
  "uri": "/index.php",
  "message": "Primary script unknown"
}
```

### action_event

```json
{
  "event_type": "action_event",
  "action": "auto_ban",
  "target": "203.0.113.8",
  "reason": "cc_attack",
  "dry_run": true,
  "result": "scheduled",
  "ttl_seconds": 86400
}
```

## Metric definitions

- `PV`: total request count in the selected window
- `UV`: unique visitor key in the selected window; prefer app user ID or cookie; otherwise fall back to `client_ip + user_agent`
- `IP count`: unique client IPs in the selected window
- `Active users (10m)`: unique visitor keys in the latest rolling 10-minute window
- `QPS`: `request_count / window_seconds`
- `Average response ms`: mean of requests that actually expose a response-time field
- `Slow request`: request whose `response_ms` is above the configured threshold
- `Bandwidth out`: sum of response bytes
- `Bandwidth in`: sum of request bytes when the log format exposes it; otherwise return `null` and say so

## Status and source groupings

- Keep exact status codes and family buckets such as `2xx`, `3xx`, `4xx`, `5xx`.
- Track important exact codes separately:
  - `403`
  - `404`
  - `500`
  - `502

Sponsored

Ads related to Server-Mate and adjacent AI workflows.