<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arnav Bansal</title>
    <description>The latest articles on DEV Community by Arnav Bansal (@arnav_bansal_2907).</description>
    <link>https://dev.to/arnav_bansal_2907</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3885611%2F59e27ffe-3404-4474-9734-3adb0494d56a.png</url>
      <title>DEV Community: Arnav Bansal</title>
      <link>https://dev.to/arnav_bansal_2907</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arnav_bansal_2907"/>
    <language>en</language>
    <item>
      <title>How I Built a Live Server Monitoring Dashboard From Scratch in One Night</title>
      <dc:creator>Arnav Bansal</dc:creator>
      <pubDate>Sat, 18 Apr 2026 06:39:19 +0000</pubDate>
      <link>https://dev.to/arnav_bansal_2907/how-i-built-a-live-server-monitoring-dashboard-from-scratch-in-one-night-52ng</link>
      <guid>https://dev.to/arnav_bansal_2907/how-i-built-a-live-server-monitoring-dashboard-from-scratch-in-one-night-52ng</guid>
      <description>&lt;p&gt;It was 9 PM. The competition had just gone live.&lt;/p&gt;

&lt;p&gt;The challenge: &lt;em&gt;"Prometheus + Grafana + alerts. Make the server visible. Discord/Telegram bot bonus points."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I had a container on a 125GB RAM, 24-core, 7.5TB beast of a server. No Docker. Node v12. One port exposed.&lt;/p&gt;

&lt;p&gt;This is the story of how I built CRISPR Monitor — a full live infrastructure dashboard — in one night, entirely from scratch.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;The organizers gave every team an isolated Ubuntu container on their server. The task was simple in theory: make the server visible. Show what's happening under the hood. Alert when things go wrong.&lt;/p&gt;

&lt;p&gt;The classic answer? Prometheus + Grafana + Alertmanager. Spin it up with docker-compose, done.&lt;/p&gt;

&lt;p&gt;Except.&lt;/p&gt;

&lt;p&gt;There was no Docker. And Grafana runs on port 3000. Prometheus on port 9090. We only had &lt;strong&gt;one port exposed — port 8000&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So docker-compose was dead on arrival. Running Grafana natively on a minimized Ubuntu without apt access? That's an hour of dependency hell with no guarantee it works.&lt;/p&gt;

&lt;p&gt;I had a choice: spend 2 hours fighting Grafana, or build something better.&lt;/p&gt;

&lt;p&gt;I built something better.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;p&gt;The entire thing runs as a single Node.js process on port 8000:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systeminformation
      ↓
  Node.js (Express + WebSocket)
      ↓
  ┌───────────────────────────┐
  │  Live Dashboard (Chart.js) │
  │  /metrics (Prometheus fmt) │
  │  Discord + Telegram alerts │
  └───────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No external dependencies beyond npm packages. No Docker. No reverse proxy. Just one file.&lt;/p&gt;




&lt;h2&gt;
  
  
  What It Does
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Live WebSocket Metrics
&lt;/h3&gt;

&lt;p&gt;Every 3 seconds, the server pushes fresh data to every connected browser via WebSocket. No polling. No page refresh. The dashboard updates in real time — CPU, Memory, Disk, Network, CPU Temperature, Uptime.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chart.js History Graphs
&lt;/h3&gt;

&lt;p&gt;CPU and Memory history plots show the last 20 data points. You can watch the server breathe.&lt;/p&gt;

&lt;h3&gt;
  
  
  Top 5 Processes by CPU
&lt;/h3&gt;

&lt;p&gt;Using &lt;code&gt;systeminformation&lt;/code&gt;, the dashboard shows which processes are eating the most CPU right now — name, CPU%, memory%, and PID.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prometheus-Compatible &lt;code&gt;/metrics&lt;/code&gt; Endpoint
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight prometheus"&gt;&lt;code&gt;&lt;span class="c"&gt;# HELP cpu_usage_percent Current CPU usage&lt;/span&gt;
&lt;span class="c"&gt;# TYPE cpu_usage_percent gauge&lt;/span&gt;
&lt;span class="n"&gt;cpu_usage_percent&lt;/span&gt; &lt;span class="mf"&gt;15.66&lt;/span&gt;
&lt;span class="c"&gt;# HELP memory_usage_percent Current memory usage&lt;/span&gt;
&lt;span class="c"&gt;# TYPE memory_usage_percent gauge&lt;/span&gt;
&lt;span class="n"&gt;memory_usage_percent&lt;/span&gt; &lt;span class="mf"&gt;98.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any real Prometheus instance could scrape this endpoint directly. The judges loved this detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spike Detection Alerts
&lt;/h3&gt;

&lt;p&gt;This is the part I'm most proud of. Instead of alerting every time a value is above a threshold (which causes spam when memory is sitting at 98%), the system only fires when a value &lt;strong&gt;jumps by 10% or more suddenly&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;checkSpike&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;prevValues&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="nx"&gt;prevValues&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One spike = one alert. Clean. No spam.&lt;/p&gt;

&lt;h3&gt;
  
  
  Discord + Telegram Alerts
&lt;/h3&gt;

&lt;p&gt;When a spike is detected, a formatted alert fires to both Discord (as a rich embed) and Telegram (as a Markdown message). Both bots, simultaneously, in under a second.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Broke First
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Optional Chaining on Node v12
&lt;/h3&gt;

&lt;p&gt;The server was running Node v12.22.9. My development machine had Node v18. I used &lt;code&gt;?.&lt;/code&gt; (optional chaining) everywhere:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;diskPct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseFloat&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;disk&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]?.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Node v12 doesn't support optional chaining. The server threw a SyntaxError immediately on startup.&lt;/p&gt;

&lt;p&gt;Fix — replace every &lt;code&gt;?.&lt;/code&gt; with old-school AND checks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;diskPct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseFloat&lt;/span&gt;&lt;span class="p"&gt;(((&lt;/span&gt;&lt;span class="nx"&gt;disk&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;disk&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Express Version Too New
&lt;/h3&gt;

&lt;p&gt;I had installed the latest Express on my PC. It uses &lt;code&gt;node:events&lt;/code&gt; — a Node 14+ feature. Node v12 crashed with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Cannot find module 'node:events'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fix — install older compatible versions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;express@4.18.2 systeminformation@5.18.0 ws@7.5.9 axios@0.27.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. cpuLoad.currentLoad Undefined
&lt;/h3&gt;

&lt;p&gt;On the server, &lt;code&gt;si.currentLoad()&lt;/code&gt; occasionally returned an object where &lt;code&gt;currentLoad&lt;/code&gt; was undefined. Adding a fallback fixed it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cpu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseFloat&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;cpuLoad&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentLoad&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;A fully live dashboard running on the competition server, accessible at the judge's URL, showing real metrics from a real 24-core machine with 125GB of RAM.&lt;/p&gt;

&lt;p&gt;Memory was sitting at 98% the whole competition — the bar glowed red, which honestly looked incredible on the demo.&lt;/p&gt;

&lt;p&gt;The Prometheus &lt;code&gt;/metrics&lt;/code&gt; endpoint was the detail that got the most reaction from judges. It showed we understood the ecosystem, not just the UI.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Would Add Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ping/uptime checker&lt;/strong&gt; — monitor URLs and alert when they go down&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log viewer&lt;/strong&gt; — tail &lt;code&gt;/var/log/syslog&lt;/code&gt; live in the browser&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-restart&lt;/strong&gt; — detect dead processes and restart them&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-server support&lt;/strong&gt; — one dashboard for multiple containers&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;The best solution isn't always the most popular tool. Sometimes the constraint &lt;em&gt;is&lt;/em&gt; the challenge. When Docker wasn't available and only one port was exposed, building from scratch wasn't a workaround — it was the answer.&lt;/p&gt;

&lt;p&gt;And it was more impressive for it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built at CRISPR Hackathon, IIIT Nagpur. Stack: Node.js, Express, WebSocket, Chart.js, systeminformation, axios. Alerts via Discord + Telegram.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>monitoring</category>
    </item>
  </channel>
</rss>
