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 🙏

© 2025 – Pkg Stats / Ryan Hefner

alert-sparrow

v1.0.4

Published

Lightweight Node.js system monitor for CPU, memory, load, disk, and SSL expiry with email, Slack, and Telegram alerts.

Readme

🐦 AlertSparrow

A lightweight Node.js package to monitor CPU, memory, load average, disk storage, and SSL certificate expiry, with customizable alerts.

Currently Supported:

  • Console alerts
  • Telegram alerts

🚧 Coming Soon:

  • Email alerts
  • Slack alerts

📦 Installation

npm install alert-sparrow [email protected]


⚙️ Usage

Initialize and configure the monitor:

const AlertSparrow = require('alert-sparrow');

const monitor = new AlertSparrow({
  cpuThreshold: 0.9, // Alert if CPU usage > 90%
  loadThreshold: 4,  // Alert if 1-min load avg > 4
  memoryThreshold: 0.9, // Alert if memory usage > 90%
  diskThreshold: 0.1, // Alert if free disk < 10%
  sslExpiryDays: 7,   // Alert if SSL expires in <7 days
  pollInterval: 60000, // Check every 60s
  alertCooldown: 300000, // 5min cooldown between the *same* alert type
  diskPath: '/', // Disk path to monitor
  domains: ['example.com', 'yourdomain.com'], // Domains for SSL monitoring
  alertChannels: {
    telegram: { 
      botToken: 'your-telegram-bot-token',
      chatId: 'your-chat-id' 
    },
    email: {
      // Email alerts coming soon
    },
    slack: {
      // Slack alerts coming soon
    }
  }
});

// Start monitoring
monitor.start();

// Get real-time stats
console.log(monitor.getStats());

✉️ Receive Alerts

Alerts are sent via console and Telegram when thresholds are breached. If you configure Email or Slack, you'll see a "Coming soon" notice.

Example alert message in Telegram:

🐦🚨 AlertSparrow Notification

Type: CPU Details: CPU usage exceeded 90%: 95.23%

⏰ Time: 2025-07-09 13:00:00 UTC


📈 Retrieve Stats

Use monitor.getStats() to get current system metrics with human-readable formatting:

{
  "cpu": { "usage": "45.12%", "cores": 4 },
  "load": { "oneMin": "1.20", "fiveMin": "1.00", "fifteenMin": "0.80" },
  "memory": { "total": "16.00 GB", "free": "8.00 GB", "usage": "50.00%" },
  "disk": { "freePercent": "60.00%", "free": "100.00 GB", "total": "250.00 GB" },
  "ssl": { 
    "example.com": { 
      "expiry": "2025-12-01T12:00:00Z",
      "daysLeft": 145 
    }
  }
}

🌟 Features

  • CPU Monitoring: Tracks per-core and average CPU usage.
  • Load Average: Monitors 1, 5, and 15-minute load averages (Linux/macOS).
  • Memory Monitoring: Tracks total and free memory.
  • Disk Usage: Monitors free disk space on a specified path.
  • SSL Expiry: Checks certificate expiry with retry logic.
  • Alerts: Currently supports Telegram notifications. Email and Slack coming soon.
  • Stats API: Retrieve real-time metrics with readable formatting.
  • Lightweight: Minimal dependencies.
  • Configurable: Custom thresholds, intervals, and domains.

📝 Notes

  • Telegram: Create a bot via @BotFather to get your token and chat ID.
  • Email: Email alerts are not yet supported.
  • Slack: Slack alerts are not yet supported.
  • Windows: Load average monitoring is unavailable.
  • SSL Checks: Require internet access and valid HTTPS domains.
  • Testing: Use expired.badssl.com to trigger SSL expiry alerts.

🛠️ Testing

Example domain to test SSL expiry:

expired.badssl.com

📄 License

MIT


🐦 AlertSparrow — Simple, flexible system monitoring.