[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80446":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":17,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":16,"starSnapshotCount":16,"syncStatus":15,"lastSyncTime":26,"discoverSource":27},80446,"vps-monitoring","inuxmax\u002Fvps-monitoring","inuxmax","Lightweight server monitoring with historical data, and alerts.","https:\u002F\u002Fbuymeacoffee.com\u002Finuxvn",null,"TypeScript",60,30,1,2,0,3,5,43.47,false,"main",[],"2026-06-12 04:01:28","# VPS Monitor\n\u003Cimg width=\"2995\" height=\"1213\" alt=\"screenshot_1778664979\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F1e0f5d1b-4570-41e7-bde9-2ffec365e74c\" \u002F>\n\n\n> Open-source, self-hosted monitoring & management dashboard for your VPS fleet.\n> Built with **Next.js 14**, **MongoDB**, and a tiny **bash agent** that installs in one line.\n\n![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-green)\n![Next.js](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNext.js-14-black)\n![MongoDB](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FMongoDB-7-green)\n\n## ✨ Features\n\n- **One-line install** on any VPS (Ubuntu, Debian, CentOS, Rocky, Alma, Fedora, Arch, Alpine…)\n- **Auto-registration** — no SSH keys, no copy-pasting tokens. Just run the install command.\n- **Live metrics** every 15s: CPU, memory, swap, disk, network, load avg, uptime, processes.\n- **Beautiful dark dashboard** with real-time charts (Recharts).\n- **Single-admin model** — no public sign-ups. The first account becomes admin.\n- **Self-hosted** — your metrics live in your MongoDB, not someone else's cloud.\n- **Tiny agent** — pure bash, no compiled binaries, ~5 MB RAM footprint.\n- **Telegram alerts** — optional notify when CPU, RAM, or disk usage crosses thresholds (per-server cooldown).\n\n## 🚀 Quick start (Docker)\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002F\u003Cyou>\u002Fvps-monitoring.git\ncd vps-monitoring\ncp .env.example .env\n\n# Edit .env, at minimum set:\n#   JWT_SECRET=$(openssl rand -hex 64)\n#   NEXT_PUBLIC_APP_URL=https:\u002F\u002Fmonitor.yourdomain.com\n\ndocker compose up -d\n```\n\nOpen `http:\u002F\u002Flocalhost:3000`, create your admin account, and you're done.\n\n### MongoDB outside Docker (Atlas, another VPS, …)\n\nThe app does **not** need Mongo on the same Docker network. Set **`MONGODB_URI`** in `.env` to your real connection string (with user\u002Fpassword if required).\n\n- **Firewall \u002F Atlas IP allowlist:** allow the **public egress IP** of the machine running the `web` container (or `0.0.0.0\u002F0` only for testing).\n- **TLS:** Atlas uses `mongodb+srv:\u002F\u002F…`; self‑hosted often uses `mongodb:\u002F\u002F…` on port `27017` with TLS optional depending on your server.\n- **Docker Compose:** the file still defines a `mongo` service for local demos. If you use **only** external Mongo, start the app without pulling that service up:\n\n```bash\n# In .env set MONGODB_URI=... (Atlas or remote host)\ndocker compose up -d --no-deps web\n```\n\nIf you keep `docker compose up -d` (with the bundled `mongo` service), you can still point `web` at an external DB by setting `MONGODB_URI` in `.env`; the local `mongo` container will simply stay unused.\n\n**Debug:** open `GET \u002Fapi\u002Fhealth\u002Fdb` on your deployed site — it returns JSON `{ ok: true }` or a safe Mongo error (e.g. authentication vs timeout) without printing your password.\n\n## 🖥️ Adding a server\n\nIn the dashboard, click **Add server**. Copy the install command and run it on your VPS:\n\n```bash\ncurl -fsSL https:\u002F\u002Fmonitor.yourdomain.com\u002Fapi\u002Finstall | sudo bash\n```\n\nThe VPS will:\n\n1. Register itself with the dashboard (auto-generates `agentId` + token).\n2. Install a systemd service `vps-monitor-agent` that survives reboots.\n3. Start posting metrics immediately.\n\nNo login, no manual steps required.\n\n### Manage the agent on the VPS\n\n```bash\nsudo systemctl status vps-monitor-agent    # check status\nsudo systemctl restart vps-monitor-agent   # restart\nsudo journalctl -u vps-monitor-agent -f    # tail logs\nsudo \u002Fopt\u002Fvps-monitor-agent\u002Funinstall.sh   # remove\n```\n\n## 🛠️ Local development\n\n```bash\nnpm install\ncp .env.example .env.local\n# point MONGODB_URI to a running MongoDB\nnpm run dev\n```\n\nThen visit `http:\u002F\u002Flocalhost:3000`.\n\n## ⚙️ Environment variables\n\n| Variable                       | Required | Default                                | Description                                  |\n| ------------------------------ | -------- | -------------------------------------- | -------------------------------------------- |\n| `MONGODB_URI`                  | yes      | `mongodb:\u002F\u002Flocalhost:27017\u002Fvps-monitoring` | Any reachable MongoDB (local, other VPS, Atlas `mongodb+srv:\u002F\u002F…`). |\n| `JWT_SECRET`                   | yes (prod) | dev-only fallback                    | Secret used to sign session cookies.         |\n| `NEXT_PUBLIC_APP_URL`          | yes      | `http:\u002F\u002Flocalhost:3000`                | Public URL where the dashboard is reachable. |\n| `AGENT_OFFLINE_AFTER_SECONDS`  | no       | `60`                                   | After how many seconds an agent is \"offline\". |\n\n### Telegram overload alerts\n\nConfigure the bot token, chat id, thresholds (CPU, RAM, disk `\u002F`), and per-server cooldown in **Settings** in the web UI. Values are stored in MongoDB (not in environment variables). Each agent heartbeat is checked: if CPU, RAM, or disk (\u002F) is at or above the configured thresholds, one HTML message is sent to Telegram. The same server will not receive another alert until the cooldown period passes (even if multiple metrics are high).\n\n## 🏗️ Architecture\n\n```\n ┌────────────────────┐  HTTPS   ┌────────────────────┐  Mongo  ┌───────────────┐\n │  VPS #1 (bash)     │ ───────► │  Next.js API       │ ──────► │  MongoDB      │\n │  \u002Fopt\u002Fvps-mon-...  │          │  \u002Fapi\u002Fagents\u002F*     │         │  agents,      │\n └────────────────────┘          │  \u002Fapi\u002Fauth\u002F*       │         │  metrics      │\n ┌────────────────────┐          └─────────┬──────────┘         └───────────────┘\n │  VPS #2 (bash)     │ ───────►           │\n └────────────────────┘                    ▼\n                                  ┌────────────────────┐\n                                  │  Next.js Web UI    │  ◄── Admin (browser)\n                                  └────────────────────┘\n```\n\n- **Web**: Next.js 14 App Router (this repo).\n- **DB**: MongoDB. Two collections: `agents` (metadata + token), `metrics` (time-series).\n- **Agent**: A 200-line bash script (`\u002Fpublic\u002Finstall.sh`) that reads `\u002Fproc`, `df`, `uptime` etc.\n- **Auth**:\n  - Admin → HttpOnly cookie + HS256 JWT.\n  - Agent → unique per-VPS token, validated on every heartbeat.\n\n## 🔒 Security notes\n\n- The first user created via `\u002Fsetup` is the only admin. Public registration is **disabled**.\n- Each agent's token is a one-way credential; compromising one VPS does **not** affect others.\n- Always run the dashboard behind HTTPS (e.g. Caddy, Nginx, Traefik).\n- Set a strong `JWT_SECRET` (`openssl rand -hex 64`).\n\n## 📦 API endpoints\n\n| Method | Path                            | Auth        | Description                       |\n| ------ | ------------------------------- | ----------- | --------------------------------- |\n| GET    | `\u002Fapi\u002Finstall`                  | public      | Returns the install bash script.  |\n| POST   | `\u002Fapi\u002Fsetup`                    | once only   | Creates the admin account.        |\n| POST   | `\u002Fapi\u002Fauth\u002Flogin`               | public      | Sign in.                          |\n| POST   | `\u002Fapi\u002Fauth\u002Flogout`              | session     | Sign out.                         |\n| POST   | `\u002Fapi\u002Fauth\u002Fpassword`            | session     | Change password.                  |\n| POST   | `\u002Fapi\u002Fagents\u002Fregister`          | public      | Agent auto-registration.          |\n| POST   | `\u002Fapi\u002Fagents\u002Fheartbeat`         | agent token | Agent posts metrics.              |\n| GET    | `\u002Fapi\u002Fagents`                   | session     | List all agents.                  |\n| GET    | `\u002Fapi\u002Fagents\u002F:id`               | session     | Get one agent's details.          |\n| PATCH  | `\u002Fapi\u002Fagents\u002F:id`               | session     | Update label\u002Ftags.                |\n| DELETE | `\u002Fapi\u002Fagents\u002F:id`               | session     | Remove agent + metrics.           |\n| GET    | `\u002Fapi\u002Fagents\u002F:id\u002Fmetrics`       | session     | Time-series metrics.              |\n\n## 💬 Support\n\nNeed help? Contact Telegram: [@blackpink2812](https:\u002F\u002Ft.me\u002Fblackpink2812)\n\n## 📄 License\n\nMIT — do whatever you want, just don't blame us.\n","VPS Monitor 是一个轻量级的服务器监控解决方案，能够记录历史数据并发送警报。项目采用 TypeScript 编写，基于 Next.js 14 和 MongoDB 构建，并通过一个小型 Bash 脚本作为代理进行安装。它支持实时监控 CPU、内存、磁盘等关键指标，并提供美观的暗色主题仪表板和可选的 Telegram 警报功能。适用于需要对 VPS 服务器集群进行自托管监控与管理的场景，确保所有数据存储在用户自己的数据库中，从而提高安全性和隐私性。","2026-06-11 04:00:47","CREATED_QUERY"]