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.
- 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.
-
Clone the repository:
git clone <repository-url> cd app-link-monitor
-
Install dependencies:
npm install
-
(Optional) Create a
.envfile 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
npm run devnpm startThe application will start on the configured port (default: 5000 or as set in .env).
-
Install PM2 globally:
npm install -g pm2
-
Start the app with PM2:
pm2 start server.js --name "link-monitor" -
Save the process list:
pm2 save
-
Enable auto-start on system boot:
pm2 startup
- 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
- Open your browser and navigate to
http://localhost:<PORT>(replace with your configured port). - The dashboard will display default devices (Cloudflare DNS and Google DNS).
- Add new devices by entering a name and IP address in the "New Link" card.
- Monitor real-time status, view trend charts, and receive alerts.
- Export historical data using the export buttons on each device card.
- Use the search bar to filter devices.
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.
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)
- Node.js
- Express.js
- Socket.IO
- Ping library
- Chart.js
- Bootstrap
- Pino (logging)
ISC