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

pm2-slack-alerts

v1.0.1

Published

A PM2 module that sends formatted Slack notifications for process events with support for clustering, mentions, metrics, and per-app config.

Readme

pm2-slack-alerts

A PM2 module that sends formatted Slack notifications for process events like start, stope, restart and more — with support for clustering, user mentions, resource usage, and per-app webhook overrides.


🚀 Features

  • Detects online, exit, stopped, errored, disconnected ... events
  • Smart event debouncing (no duplicate messages)
  • Includes uptime, memory, and CPU stats
  • Supports Slack user mentions
  • Per-app Slack Webhook URL overrides
  • Cluster-aware PID tracking

🛠 Installation

pm2 install pm2-slack-alerts

⚙️ Configuration

Global Slack Webhook

Set the default Slack webhook URL:

pm2 set pm2-slack-alerts:PM2_SLACK_URL https://hooks.slack.com/services/XXXXX/YYYYY/ZZZZZ

User Mentions

To tag users in Slack messages:


pm2 set pm2-slack-alerts:PM2_SLACK_MENTIONS "U01234567,U07654321"

🔎 How to Find Slack User IDs

  1. Click on the user’s profile in Slack
  2. In the top right corner of the profile pop-up, click the vertical three dots (︙)
  3. Select “Copy member ID” from the dropdown
  4. Paste the ID into your config (e.g., U01234567)

This will automatically convert to <@U01234567> <@U07654321> format in messages.


Per-App Webhook (Optional)

You can override the global webhook for a specific app.
If your app is named important-project, use:

pm2 set pm2-slack-alerts:PM2_SLACK_URL_IMPORTANT_PROJECT https://hooks.slack.com/services/XXXXX/YYYYY/ZZZZZ

App names are transformed to uppercase and dashes are replaced with underscores.


Process Filtering (Optional)

Only receive notifications from specific apps:

pm2 set pm2-slack-alerts:PM2_SLACK_FILTER api-service,worker
  • Case-sensitive.
  • If unset, all PM2 apps will be monitored.
  • Useful for large PM2 environments with many apps.

Event Filtering (Optional)

Control which PM2 events send Slack notifications:

pm2 set pm2-slack-alerts:PM2_SLACK_EVENTS restart,errored,exit
  • If unset, only the following essential events are enabled by default:
    • online
    • exit
    • stopped
    • errored
    • disconnected
  • To enable additional events like log, error, or kill, explicitly define them in PM2_SLACK_EVENTS.
  • If unset, all supported PM2 events will trigger a Slack notification.
  • Common events: start, stop, restart, exit, online, errored, disconnected

📡 Supported PM2 Events

The following PM2 events are supported and can be filtered using the PM2_SLACK_EVENTS environment variable:

  • online
  • exit
  • stopped
  • errored
  • disconnected
  • log
  • error
  • kill
  • exception
  • reload
  • delete
  • restart overlimit

Each message includes:

  • Event emoji
  • Hostname
  • App name
  • Event type
  • Mode (cluster or fork)
  • PID list
  • Uptime, Memory, CPU
  • Mentions (if defined)

🧪 Slack Message Example

🚀 SERVER STATUS UPDATED 🚀

━━━━━━━━━━━━━━━━━━━━━━━━━━
 IMPORTANT_PROJECT → STARTED

🕒 Time       : 2025-04-15 14:03:22
🖥 Host       : dev-machine.local
📌 Event      : started
📊 Mode       : cluster
📈 Uptime     : 22s
💾 Memory     : 48.12 MB
⚙️ CPU        : 1%
🧩 PIDs       : 4 instances (0, 1, 2, 3)
👥 Mentions   : <@U01234567> <@U07654321>

🤝 Contributing

  • We welcome contributions! Please read our Contributing Guide for details on how to get started.

🧾 License

MIT