Linux servers3 min read

How to monitor Node.js on a DigitalOcean Droplet

Go beyond the basic Droplet graphs: monitor the host, uptime and background jobs behind your Node.js app on DigitalOcean, with alerts that reach you.

The Problem: Limited Visibility on DigitalOcean

Hosting Node.js applications on DigitalOcean droplets is a popular choice for its simplicity and scalability. However, the default DigitalOcean monitoring dashboard offers limited visibility, showing only 5-minute averages. This makes it difficult to diagnose performance bottlenecks and react quickly to issues affecting your Node.js application. The "Basic graphs lack granularity" and leave you guessing when things go wrong.

The "Hard" Way: Manual Configuration with Prometheus and Grafana

Setting up comprehensive monitoring manually involves a complex setup with tools like Prometheus and Grafana. Here's a simplified overview of the steps:

  1. Install Node Exporter: Download and configure node_exporter on your DigitalOcean droplet to expose system metrics.
  2. Install Prometheus: Set up a Prometheus server to scrape metrics from node_exporter. This requires configuring Prometheus to discover and collect data from your droplet.
  3. Configure Prometheus: Write YAML configuration files to define the metrics you want to collect and how often to scrape them.
  4. Install Grafana: Set up a Grafana instance to visualize the metrics collected by Prometheus.
  5. Create Grafana Dashboards: Design and configure Grafana dashboards to display the metrics in a meaningful way. This involves writing PromQL queries to extract the desired data.
  6. Firewall Configuration: Ensure the necessary ports are open for Prometheus to scrape the exporter and for Grafana to be accessible.

This process requires significant technical expertise and ongoing maintenance. It's time-consuming and can be a barrier to entry for developers who just want to monitor their Node.js applications.

The Simpler Way: Sentinely on Your Droplet

Sentinely watches the droplet, the endpoint and your scheduled jobs. It is host monitoring, not an APM, so it won't profile your event loop, but it will tell you when the box or the app is in trouble.

Step 1: Install the agent. In Sentinely, open Pulse → Add server, generate an agent API key, and run the displayed command on the droplet:

Terminal
curl -fsSL https://sentinely.app/install.sh | sudo bash -s -- --key YOUR_API_KEY

The agent reports CPU, memory, disk, network, load, services, processes and open ports. It pushes data out, so you don't need to open inbound ports in your firewall.

Step 2: Add an uptime check for your Node.js app. Point a Ping monitor at your health route (for example https://api.example.com/health) to get down and recovery alerts.

Step 3: Add a heartbeat for background work. If a queue worker or node-cron task should run every 15 minutes, send a heartbeat when it finishes:

JavaScript
await fetch('https://sentinely.app/api/beat/YOUR_TOKEN', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ status: 'ok', task: 'sync-invoices' }),
});

If the heartbeat is late, Sentinely alerts you by email or webhook.

Key Metrics to Watch for Node.js on DigitalOcean

  • CPU usage: a single Node.js process pinned at 100% of one core is a common sign of a blocked event loop.
  • Memory usage: steady growth without plateaus usually points to a leak. Alert before the OOM killer restarts your app.
  • Disk usage: log files and uploads fill small droplet disks quickly.
  • Network traffic: sudden spikes can mean abuse or a retry storm.
  • Endpoint response time: your uptime check records response time for every check, so you see slowdowns as well as outages.

For event loop lag, heap and garbage-collection detail, pair Sentinely with a Node.js APM or the built-in --inspect tooling.

Conclusion

The default DigitalOcean graphs tell you little when something breaks. Sentinely adds host metrics, uptime checks and job heartbeats with one agent and a few monitors. Start a 14-day trial.