https://github.com/nividan/pingwatch
PingWatch is a lightweight, Windows/Linux friendly Python network monitoring platform with a live web dashboard, multi-protocol monitoring (ICMP, HTTP/S, TCP, TLS, SNMP, DNS), event tracking, SNMP traps, email alerts, RBAC, HTTPS support, topology mapping, and config backup.
https://github.com/nividan/pingwatch
monitoring network-monitoring networking-tools python self-hosted topology
Last synced: 2 months ago
JSON representation
PingWatch is a lightweight, Windows/Linux friendly Python network monitoring platform with a live web dashboard, multi-protocol monitoring (ICMP, HTTP/S, TCP, TLS, SNMP, DNS), event tracking, SNMP traps, email alerts, RBAC, HTTPS support, topology mapping, and config backup.
- Host: GitHub
- URL: https://github.com/nividan/pingwatch
- Owner: Nividan
- License: mit
- Created: 2026-03-09T19:50:53.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-10T09:26:37.000Z (2 months ago)
- Last Synced: 2026-04-10T09:37:23.705Z (2 months ago)
- Topics: monitoring, network-monitoring, networking-tools, python, self-hosted, topology
- Language: Python
- Homepage:
- Size: 9 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# PingWatch โ Real-Time Network Monitoring Platform




[](https://claude.ai)
PingWatch is a Python-based network monitoring platform for tracking the availability and health of network devices and services. It runs a lightweight built-in HTTPS server, stores data in SQLite, and streams live updates to a vanilla JS dashboard โ no external web framework or build step required.
> ๐ค This project was designed and built with [Claude AI](https://claude.ai) (Anthropic) as an AI-driven development experiment โ from architecture to implementation.
---
## Table of Contents
- [Features](#features)
- [Supported Sensor Types](#supported-sensor-types)
- [Technologies](#technologies)
- [Installation](#installation)
- [Usage](#usage)
- [HTTPS / TLS](#https--tls)
- [Syslog Forwarding](#syslog-forwarding)
- [LDAP / Active Directory Authentication](#ldap--active-directory-authentication)
- [IP Address Management (IPAM)](#ip-address-management-ipam)
- [Device Configuration Backup](#device-configuration-backup)
- [Screenshots](#screenshots)
- [Architecture](#architecture)
---
## Features
- ๐ก Real-time device monitoring via Server-Sent Events (SSE)
- ๐ Multiple sensor types: ICMP, HTTP/S, TCP, TLS, SNMP, DNS, Banner, VMware
- โฑ Configurable monitoring intervals, debounce thresholds, and per-sensor defaults
- ๐ Historical event logging with flap and SNMP trap tracking
- ๐จ Hierarchical alert profiles โ PRTG-style escalation stages with per-stage delays and repeat intervals; cascade resolution (sensor โ device โ group โ global) so one global profile covers everything while individual scopes can override; reusable action templates (email, webhook, syslog, browser push); maintenance window suppression
- ๐ท Alert tagging on sensor events โ severity badge, profile name, and state shown inline; ACK / Resolve without leaving the Events tab; Events tab split into **Active** (unresolved, badge count) and **History** (resolved) inner tabs โ SNMP traps without an alert rule go to History automatically
- ๐ฅ User groups โ assign members, use groups as alert email recipient lists; emails resolved at dispatch time
- ๐ค User profiles โ full name and email per user; self-service "Edit Profile" in the user menu
- ๐ Web-based dashboard with live latency sparklines, customizable widgets, and multi-dashboard tabs โ create named dashboards (e.g. "NOC", "Server Room") per user; tab bar with right-click rename/delete; new users get a pre-populated default layout
- ๐บ Interactive Network Topology Manager (NTM) with draw.io-style editing
- ๐ Role-based access control: viewer / operator / admin
- ๐ Native HTTPS / TLS 1.2+ with self-signed or imported certificates
- ๐ค Database export and import (individual DBs or full ZIP bundle)
- ๐ฅ Native desktop status window with optional system-tray icon
- ๐พ Automated device configuration backup via SSH/Telnet โ encrypted credentials, revision history, diff viewer, and vendor-aware rollback with full interface context (`interface X / no โฆ / end / wr`)
- ๐ Sensor host linking โ sensors inherit the device IP by default; setting a host manually marks it as overridden; clearing the host re-links it to the device
- ๐ Per-device port scanner with configurable default ports (Settings โ Sensors)
- ๐ง Interactive first-run setup wizard โ GUI (tkinter, dark-themed) on Windows, CLI fallback on headless/SSH; handles packages, DB backend, ports, TLS, admin user
- ๐ง Native Linux/macOS support โ headless mode, systemd service, auto package-manager detection
- ๐จ Syslog forwarding โ RFC 5424 UDP/TCP to any syslog server
- ๐ Server restart and shutdown from the web UI (Settings โ General)
- ๐ข LDAP / Active Directory authentication with encrypted bind credentials, group import, and auto-provisioning
- ๐ IP Address Management (IPAM) โ subnet tracking with live ping-sweep integration; sortable columns (click headers) and filter dropdowns for Status (Used/Free) and Licenses
- ๐ข Auto-scaling probe executor โ worker count scales automatically with sensor count (1 per 4 sensors, 64โ512 range); manual override available in Settings โ General
- ๐ท Device list status filter pills โ All / Down / Warn / Up / Pause with live counts; composes with text search
- ๐ Device list pagination โ 50 devices per page (user-selectable: 25/50/100); preference saved in `localStorage`
- ๐ฑ Sensor tile drag-to-reorder โ drag sensor tiles inside a device window to rearrange; layout persists per device across sessions; device card top-3 preview respects custom order
- ๐ฅ VMware vSphere monitoring โ discover VMs from vCenter/ESXi, 16 metrics across CPU, memory, disk, datastore, network, and system; grouped VM display with collapsible rows, per-metric smart thresholds, bulk add, and group-level mute toggle
- โ
Bulk resolve โ resolve all active alerts and flaps in one click from the Events tab
- ๐ Time-aware sensor KPI tiles โ Avg / Min / Max latency tiles in the sensor history panel reflect the selected time window (12 h โ 3 d โ 7 d โ 30 d โ 90 d), matching the stats bar values
- ๐ญ Subnet Discovery โ scan a CIDR range for unmonitored hosts; two modes (Full: ping + DNS + port scan + device-type guess; Ping only: fast scan for large networks); multi-select results table with MAC/vendor, open ports, multi-NIC duplicate detection, per-device sensor review, and one-click bulk add; **per-device group assignment** โ set a default group for the entire batch or override individual rows; maximum scan size /16 (65 534 hosts) with tiered runtime warnings and cancellation support
- ๐ Device License Tracking โ attach software/hardware licenses to any device with expiry dates, configurable warn/critical thresholds (days before expiry), and free-text notes; automatic status check every 6 hours fires Warning/Critical events into the Events tab (deduplication via `last_status` โ only fires on state change); recovery event auto-resolves the active alert when a license is renewed; license status badges (Valid / Expiring / Expired) in the Edit Device modal and IPAM table; License Overview dashboard widget shows KPI counts and a sorted table of upcoming expirations; real-time SSE updates on status change
### Supported Sensor Types
| Sensor | Description |
|--------|-------------|
| **Ping (ICMP)** | Round-trip latency and packet-loss monitoring |
| **HTTP / HTTPS** | Status code, keyword, and response-time checks |
| **TCP Port** | Port reachability and connection-time checks |
| **TLS** | Certificate validity and TLS handshake checks |
| **SNMP** | OID polling (v1/v2c); Counter32/Counter64 traffic OIDs display live rate (B/s โ GB/s); interface discovery with metric auto-select; wrong-OID detection |
| **DNS** | Record lookup and resolution-time checks |
| **Banner** | Raw TCP banner capture with optional regex match |
| **VMware** | vSphere VM monitoring โ CPU, memory, disk, datastore latency, network, uptime, power state; auto-discovery from vCenter/ESXi |
---
## Technologies
- **Backend:** Python 3.x stdlib โ no third-party web framework
- **Web Server:** `http.server` (threading) + `ssl.SSLContext` for HTTPS
- **Database:** Dual-backend โ SQLite WAL (default, zero-setup) or PostgreSQL (production/high-scale); dual-DB layout: `main` schema (config, devices, users, IPAM, alerts) + `logs` schema (sensor samples, flap log, SNMP traps)
- **Frontend:** Vanilla HTML, CSS, JavaScript โ no build step
- **Real-time:** Server-Sent Events (SSE)
- **TLS:** `cryptography` (RSA-2048, X.509, Fernet encryption)
- **SSH backup:** `paramiko`
- **PostgreSQL:** `psycopg2` *(optional โ only needed when PostgreSQL backend is enabled)*
- **System tray:** `pystray` + `Pillow` *(optional)*
- **VMware:** `pyvmomi` *(optional โ only needed when VMware sensors are enabled)*
- **LDAP/AD:** `ldap3` *(optional โ only needed when LDAP auth is enabled)*
---
## Installation
```bash
git clone https://github.com/Nividan/Pingwatch.git
cd Pingwatch
```
**Windows:**
```bat
windows\start.bat
```
**Linux / macOS:**
```bash
sudo bash linux/start.sh
```
On Windows, `start.bat` launches via a Python-based launcher (`windows/launcher.pyw`) that handles admin elevation, first-run detection, and port cleanup โ no console window. The first-run wizard (GUI on Windows, CLI on Linux) checks packages, configures ports, generates a TLS certificate, and initialises the database. Subsequent launches skip the wizard. To re-run it:
```bash
windows\start.bat --setup # Windows
sudo bash linux/start.sh --setup # Linux / macOS
sudo bash linux/start.sh --check # Re-check required packages only
```
**Background service (Linux):**
```bash
sudo bash linux/start.sh --install-service # install + start systemd service
sudo systemctl start|stop|restart|status pingwatch
journalctl -u pingwatch -f # live logs
sudo bash linux/start.sh --uninstall-service
```
---
## Usage
| Mode | Windows | Linux / macOS |
|------|---------|---------------|
| Foreground | `windows\start.bat` | `sudo bash linux/start.sh` |
| Background | `pythonw windows\pingwatch.pyw` | `sudo bash linux/start.sh --install-service` |
| Re-run wizard | `windows\start.bat --setup` | `bash linux/start.sh --setup` |
After startup, PingWatch is available at **https://localhost:8443** (default). The first-run password is printed to the console โ change it immediately in **Settings โ Users**.
**Linux notes:**
- Ports < 1024 require root or `CAP_NET_BIND_SERVICE` (the systemd service handles this automatically).
- Headless mode skips tkinter/pystray/Pillow entirely โ select "no desktop GUI" in the wizard.
- SNMP port 162 requires root. Alternatively: `iptables -t nat -A PREROUTING -p udp --dport 162 -j REDIRECT --to-port 1162`.
---
## HTTPS / TLS
TLS 1.2+ is enabled by default. Certificate discovery order: database โ `certs/cert.pem` + `key.pem` โ auto-generated self-signed.
Manage in **Settings โ Networking โ HTTPS / TLS**: generate self-signed (with custom SANs), upload an existing PEM pair, enable/disable TLS, or enable HTTPโHTTPS redirect. PingWatch logs a warning 30 days before expiry.
Default ports: HTTP `7070`, HTTPS `8443`, SNMP trap `1162` (all configurable).
---
## Syslog Forwarding
Forward events to any RFC 5424 syslog server via UDP or TCP. Configure in **Settings โ Syslog**: host, port, protocol, and minimum severity (`critical` / `warning` / `down` / `recovered` / `info`). Non-blocking daemon queue โ monitor threads are never stalled. Changes take effect immediately without restart.
---
## LDAP / Active Directory Authentication
Domain users log in with AD credentials; local users are unaffected. Configure in **Settings โ Users โ LDAP Settings**: server, port, security mode (None/LDAPS/StartTLS), base DN, bind DN, bind password (Fernet-encrypted at rest), and user search filter. Accepted login formats: `jsmith`, `CORP\jsmith`, `jsmith@corp.local`.
Use **Test Connection** to verify the service-account bind and **Test User Auth** to run the full authentication flow before saving.
### LDAP Group Integration
Import AD/LDAP groups into PingWatch and tie them to PingWatch roles and notification groups:
- **Import groups** โ use **Settings โ Groups โ Import from LDAP** to browse and import AD groups. Each imported group gets an LDAP badge and a configurable default role (viewer / operator / admin).
- **Auto-provision** โ enable "Auto-provision" in LDAP Settings and any LDAP user who belongs to an imported group is created automatically on first login with the matching role, display name, and email. No manual user creation required.
- **Login-time sync** โ on every LDAP login, PingWatch refreshes the user's group assignment, role, and display name from LDAP. If the user is removed from all imported groups in AD, login is rejected and the account is suspended (local admin accounts are always unaffected).
- **Background sync** โ a configurable background thread (default every 60 minutes) reconciles all LDAP users against current AD group membership without waiting for a login.
- **Nested groups** โ optional AD recursive membership check using `LDAP_MATCHING_RULE_IN_CHAIN` (AD only).
- **Multi-group priority** โ users in multiple imported groups receive the highest role (admin > operator > viewer).
- **Test User Groups** โ admin diagnostic dialog: enter a username and see exactly which LDAP groups they belong to.
---
## IP Address Management (IPAM)
Track IP allocations across subnets. Navigate to the **IPAM** tab, add a subnet in CIDR notation (up to `/9`), and PingWatch expands every host IP. Click any row to assign a name/label. Monitored devices are automatically linked to their IPAM entries when created.
---
## Device Configuration Backup
Connects to network devices over SSH or Telnet, retrieves the running configuration, and stores it encrypted in the database with a full revision history.
### Supported Devices
| Vendor / OS | Method | Notes |
|-------------|--------|-------|
| **Cisco IOS / IOS-XE** | SSH or Telnet | Paging: `terminal length 0` ยท Enable password supported |
| **Cisco NX-OS** | SSH | Paging: `terminal length 0` |
| **Juniper JUNOS** | SSH | Paging: `set cli screen-length 0` ยท keyboard-interactive auth supported |
| **Fortinet FortiGate** | SSH | Paging: `config system console` + `set output standard` ยท context-aware rollback |
| **Any SSH/Telnet device** | SSH or Telnet | Supply the correct commands for your platform |
### Backup Settings
| Field | Description |
|-------|-------------|
| **Method** | `ssh` or `telnet` |
| **Username / Password** | Password stored AES-Fernet encrypted โ never in plaintext |
| **Enable password** | Optional second-stage enable (Cisco-style) |
| **Paging command** | Sent once after login to disable paging |
| **Commands** | One per line โ collected in sequence |
| **Schedule** | Cron expression for automatic runs (e.g. `0 2 * * *`) |
### Config Viewer
Click any device row in the Backups tab to open the Config Viewer:
- Browse revisions with **โ Older / Newer โ** navigation
- View timestamp, status, config size, and SHA-256 hash
- **Diff view** โ side-by-side comparison between any two revisions using a patience diff algorithm (handles large configs efficiently)
- **Hide credential noise** โ suppresses `set password ENC` / `set psksecret ENC` lines that FortiGate re-encrypts on every export, so only real changes appear in the diff
- **Vendor-aware rollback** โ generates restore commands in the correct syntax for the detected vendor (FortiGate: `config/edit/set/next/end` blocks; others: `no `)
### Security
- Passwords Fernet-encrypted at rest; never written to disk or logs beyond the duration of a backup run
- SSH host keys verified via TOFU (stored in `ssh_known_hosts.txt`; rejected if changed)
- All backup actions recorded in the audit log
---
## Screenshots
### ๐ก Network Dashboard

### ๐ฅ Device Information

### ๐ Event Logs

### ๐บ Network Topology Manager

### ๐พ Device Configuration Backup

### ๐ IP Address Manager

---
## Architecture
> For a full developer reference โ module descriptions, API endpoints, DB schema, and how to extend PingWatch โ see [DEVELOPER.md](DEVELOPER.md).
```
Browser / Desktop GUI
โ
โผ
server.py โโ routes/ โ HTTP dispatcher + route modules
โ
โโโ core/ โ Config, state, auth, TLS, logging
โโโ monitoring/ โ Probes, alerting, syslog, topology
โโโ vmware/ โ vSphere VM discovery + metric probing
โโโ backup/ โ SSH/Telnet backup engine + scheduler
โโโ snmp/ โ Trap receiver, enricher, OID catalog
โโโ db/ โ Dual-backend persistence (SQLite / PostgreSQL)
```
- **`server.py`** โ HTTP(S) dispatcher, starts all background threads
- **`gui_setup.py`** โ tkinter GUI setup wizard (dark-themed, 6-step flow)
- **`setup_wizard.py`** โ cross-platform CLI setup wizard (fallback for headless/SSH)
- **`core/setup_logic.py`** โ shared setup logic (packages, ports, DB init) used by both wizards
- **`monitoring/probes.py`** โ all sensor probe types on per-sensor threads (VMware probes via `vmware/client.py`)
- **`backup/engine.py`** โ SSH/Telnet connections, TOFU host key verification, enable-mode escalation
- **`core/auth.py`** โ PBKDF2-SHA256 local auth + LDAP branch via `core/ldap_auth.py`
- **`snmp/`** โ UDP trap listener, OID enrichment, vendor fingerprinting
- **`db/`** โ dual-backend persistence: Main DB (config/settings) + Logs DB (samples/events)