npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@irsyadulibad/servermon

v1.3.0

Published

Lightweight server monitoring daemon — collects system metrics and sends structured reports to Telegram. Built with Bun + TypeScript.

Readme

Lightweight server watchdog — collects real-time system metrics and sends structured reports to Telegram. Global CLI tool. Install once, run anywhere. Built with Bun + TypeScript.


✨ Features

| Category | What it tracks | | --------------------- | -------------------------------------------------------------- | | 💻 CPU | Model, core count, usage %, load average (1/5/15 min) | | 🧠 RAM | Used / total, usage %, swap usage | | 💾 Disk | Per-mount used / total, usage % — deduplicated | | 🌐 Network | RX / TX rate (bytes/sec, sampled over 1s) | | 🌡 Temperature | CPU package temp via thermal zones (/sys/class/thermal) | | 📊 Top Processes | Top 5 by CPU % — PID, name, CPU %, MEM % | | 🚨 Alerts | Auto-flag when CPU > 85%, RAM > 90%, disk > 90%, or swap > 50% | | 🌍 Multi-server | Monitor multiple servers with one bot via --name flag | | ⏱ One-shot report | Send a report on demand without starting the daemon |

Each report is color-coded with 🟢🟡🔴 health indicators and visual bar charts.


🚀 Quick Start

Install globally

bun i -g @irsyadulibad/servermon

First run — interactive setup

servermon setup

You'll be prompted for:

  1. Telegram Bot Token — get one from @BotFather
  2. Report interval — how often to send reports (default: 300s = 5 min)

Config is saved to ~/.irsyadulibad/servermon/config.json.

Send a message to your bot

DM your bot once (any message). The daemon auto-detects your chat ID.

Start monitoring

servermon start

That's it. The daemon auto-detects your chat ID, sends an initial report, then loops.


📖 Usage

Usage:  servermon <command> [options]

Commands:
  setup [--name <srv>]  First-time setup (bot token + interval) for a server
  start [--name <srv>]  Start the monitoring daemon for a server
  report [--name <srv>] Send a one-time report without starting the daemon
  list                  List all configured servers
  delete <name>         Delete a configured server
  service <sub>         Manage systemd service

Options:
  -n, --name     Server name
  -h, --help     Show help
  -v, --version  Show version number

Examples

# Basic setup
servermon setup

# Setup with a server name (for multi-server)
servermon setup --name prod

# Start monitoring a specific server
servermon start --name staging

# Start monitoring ALL configured servers at once
servermon start

# Send a one-time report (daemon not required)
servermon report --name prod

# List all configured servers
servermon list

# Delete a server config (interactive confirm)
servermon delete prod

# Force delete without confirmation
servermon delete prod --yes

🌍 Multi-server mode

servermon start (without --name) automatically runs all configured servers in a single daemon process — each server gets its own config, but they share one process and interval.

┌─────────────────────────────┐
│  servermon start            │
│  (multi-server daemon)      │
│                             │
│  ├─ default    → Telegram   │
│  ├─ prod       → Telegram   │
│  └─ staging    → Telegram   │
└─────────────────────────────┘

Reports appear with the server name in the header:

🖥 server01 [prod] — ✅ HEALTHY 🖥 server02 [staging] — ⚠️ WARNING


📷 Example Report

✅ HEALTHY
📅 7 Jun 2026, 22:11   │  ⏱ 3d 21h
🐧 linux x86_64        │  Intel Xeon E5-2680 v4 @ 2.40GHz (2c)

💻 CPU   10.5%  🟢 ▰▱▱▱▱▱▱▱▱▱
   Load: 0.59 / 1.40 / 1.51

🧠 RAM   27.3%  🟢 ▰▰▰▱▱▱▱▱▱▱
   1.0 GiB / 3.8 GiB

💾 DISK
   /      26%  🟢 ▰▰▰▱▱▱▱▱▱▱
    └ 7957 GiB / 33092 GiB

🌐 NET
   ↓ 2.6 KB/s   ↑ 808 B/s

📊 TOP PROCESSES
   57318  ps              CPU 200.0%  MEM   0.1%
   57296  bun             CPU  13.6%  MEM   1.0%
   56149  hermes          CPU   8.7%  MEM   5.3%

✨ All systems normal

When thresholds are crossed, alerts appear inline:

🚨 CRITICAL
🔴 RAM hampir penuh: 91.2%
🔴 Disk /: 91%

🔧 Scripts

| Command | Description | | ---------------- | ---------------------------------------------- | | bun start | Run the daemon in dev mode | | bun run build | Compile standalone binary → ./server-monitor | | bun run lint | Run ESLint | | bun run format | Format with Prettier | | bun run check | Format check + lint (CI-ready) |


📁 Project Structure

server-monitoring/
├── cli.ts                    # CLI wrapper (delegates to src/cli)
├── index.ts                  # Module entry (re-exports daemon functions)
├── src/
│   ├── types/                # Shared type definitions
│   │   └── index.ts
│   ├── config/               # Config CRUD (load, save, delete, listServers)
│   │   └── index.ts
│   ├── monitor/              # Metrics collector + formatting utilities
│   │   └── index.ts
│   ├── reporter/             # HTML formatter & Telegram sender
│   │   └── index.ts
│   ├── daemon/               # start(), startAll(), autoDetectChatId()
│   │   └── index.ts
│   └── cli/                  # CLI command routing (CrustJS) + interactive setup + banner
│       ├── banner.ts
│       ├── index.ts
│       └── service.ts        # systemd service subcommands
├── eslint.config.js
├── .prettierrc
├── package.json
└── tsconfig.json

⚙️ Config

Stored at ~/.irsyadulibad/servermon/config.json:

{
  "token": "883280...",
  "interval": 300,
  "chatId": "1216431846"
}

For named servers, configs are stored separately:

~/.irsyadulibad/servermon/
├── config.json          # default server
├── config-prod.json     # servermon setup --name prod
└── config-staging.json  # servermon setup --name staging

| Field | Description | | ---------- | --------------------------------------------------------- | | token | Telegram bot token (required) | | interval | Seconds between reports (min: 30, default: 300) | | chatId | Auto-detected on first run, persisted for subsequent runs | | name | Server name label (set via --name, shown in reports) |


📦 Deploy as systemd service

# Install & start
servermon service install

# Check health
servermon service status

# View real-time logs
servermon service logs

# Stop / restart / uninstall
servermon service stop
servermon service restart
servermon service uninstall --yes

This creates a user-level systemd service at ~/.config/systemd/user/servermon.service that runs servermon start (multi-server mode) and automatically restarts on failure.

Manual (if you prefer):

sudo tee /etc/systemd/system/servermon.service << 'EOF'
[Unit]
Description=Server Monitor Daemon
After=network.target

[Service]
Type=simple
ExecStart=/home/irsyad/.bun/bin/servermon start
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now servermon

🛠 Built With


📝 License

MIT — do whatever you want.