Skip to content

Network Device Monitoring System A real-time, web-based network monitoring solution designed to keep track of the health and performance of devices on your network. This tool continuously pings configured devices, providing real-time status, latency, and packet loss metrics. The intuitive web dashboard offers easy access to device status history.

Notifications You must be signed in to change notification settings

IbneKayesh/app-link-monitor

Repository files navigation

Link Monitor

Link Monitor is a production-grade web application for real-time monitoring of network links and devices using ping-based checks. It provides a responsive dashboard with live updates, alerts, and historical data export capabilities.

Features

  • Real-time Monitoring: Continuously pings configured devices and displays status, latency, and packet loss in real-time.
  • Web Dashboard: Responsive web interface with device cards showing current status, uptime percentage, average latency, and mini trend charts.
  • Alerts System: Automatic alerts for high latency, packet loss, and connection issues with color-coded notifications.
  • Device Management: Dynamically add or remove devices to monitor via the web interface. Device list is auto-persisted.
  • Historical Data: Maintains a configurable history of ping results with trend calculations for uptime and average latency.
  • Data Export: Export device history to JSON or CSV formats for analysis.
  • REST API: Provides API endpoints for retrieving device lists and historical data.
  • Logging: Saves error logs to disk in JSON Lines format per device.
  • Configurable: Fully configurable via environment variables (port, ping interval, alert thresholds, etc.).
  • Parallel Pinging: Uses parallel ping operations for faster checks on multiple devices.
  • PWA Support: Installable as a Progressive Web App for offline access.
  • Real-time Updates: Uses Socket.IO for instant updates across connected clients.
  • Search Functionality: Search and filter devices in the dashboard.
  • Client Tracking: Displays the number of connected clients.

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd app-link-monitor
  2. Install dependencies:

    npm install
  3. (Optional) Create a .env file in the root directory with configuration variables:

    PORT=3086
    PING_INTERVAL=1000
    HISTORY_LIMIT=50
    ALERT_LATENCY=200
    ALERT_LOSS=50
    LOG_LEVEL=info
    DEVICES_FILE=devices.json
    

Running the Application

Development Mode

npm run dev

Production Mode

npm start

The application will start on the configured port (default: 5000 or as set in .env).

Using PM2 for Production Deployment

  1. Install PM2 globally:

    npm install -g pm2
  2. Start the app with PM2:

    pm2 start server.js --name "link-monitor"
  3. Save the process list:

    pm2 save
  4. Enable auto-start on system boot:

    pm2 startup

Useful PM2 Commands

  • Check running apps: pm2 list
  • Show logs in real-time: pm2 logs link-monitor
  • Restart app: pm2 restart link-monitor
  • Stop app: pm2 stop link-monitor
  • Delete app: pm2 delete link-monitor

Usage

  1. Open your browser and navigate to http://localhost:<PORT> (replace with your configured port).
  2. The dashboard will display default devices (Cloudflare DNS and Google DNS).
  3. Add new devices by entering a name and IP address in the "New Link" card.
  4. Monitor real-time status, view trend charts, and receive alerts.
  5. Export historical data using the export buttons on each device card.
  6. Use the search bar to filter devices.

API Endpoints

  • GET /api/devices: Retrieve the list of monitored devices.
  • GET /api/history/:name: Get historical ping data for a specific device.
  • GET /api/export/json/:name: Export device history as JSON.
  • GET /api/export/csv/:name: Export device history as CSV.

Configuration

The application can be configured using environment variables:

  • PORT: Server port (default: 5000)
  • PING_INTERVAL: Ping check interval in milliseconds (default: 5000)
  • HISTORY_LIMIT: Number of historical entries to keep (default: 100)
  • ALERT_LATENCY: Latency threshold for alerts in ms (default: 200)
  • ALERT_LOSS: Packet loss threshold for alerts in % (default: 50)
  • LOG_LEVEL: Logging level (default: info)
  • DEVICES_FILE: Path to devices JSON file (default: devices.json)

Technologies Used

  • Node.js
  • Express.js
  • Socket.IO
  • Ping library
  • Chart.js
  • Bootstrap
  • Pino (logging)

License

ISC

About

Network Device Monitoring System A real-time, web-based network monitoring solution designed to keep track of the health and performance of devices on your network. This tool continuously pings configured devices, providing real-time status, latency, and packet loss metrics. The intuitive web dashboard offers easy access to device status history.

Topics

Resources

Stars

Watchers

Forks