') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - blackshadow-software/server_tracker · GitHub
Skip to content

Repository files navigation

🖥️ Server Tracker

A powerful Rust-based API and web dashboard for tracking and monitoring development servers running on your system. Automatically detects REST APIs, gRPC services, databases, WebSocket servers, and more!

✨ Features

  • 🔍 Auto-detection of development servers (REST APIs, gRPC, databases, WebSocket, WebRTC)
  • 📊 Real-time monitoring with uptime tracking and resource usage
  • 🌐 Web Dashboard with beautiful, responsive UI
  • 🚀 RESTful API for integration with tools and dashboards
  • 🔧 Advanced filtering by service type, process name, or command path
  • 📈 Live statistics and change monitoring
  • ⚡ Process management - terminate processes directly from the web UI

🚀 Quick Start

1. Start the Server Tracker

# Clone and build the project
git clone <your-repo-url>cd server_tracker
cargo build --release
# Start the tracker with web dashboard
cargo run -- serve --port 3030

2. Open the Web Dashboard

Once the server is running, open your browser and navigate to:

🌐 http://localhost:3030

You'll see a beautiful dashboard showing:

  • 📊 Live statistics (total servers, memory usage, CPU usage)
  • 🖥️ Running servers with eye-catching PID badges
  • 🔄 Real-time updates every 5 seconds
  • 🎯 Smart filtering options
  • Process termination buttons

3. API Access

The RESTful API is available at the same address:

# Check health
curl http://localhost:3030/health
# List all detected servers
curl http://localhost:3030/servers
# Get statistics
curl http://localhost:3030/stats
# Monitor changes
curl http://localhost:3030/monitor

🎯 How It Works

Server Tracker automatically scans your system for common development server patterns:

  • REST APIs: Processes listening on common web ports (3000, 8000, 8080, etc.)
  • gRPC Services: Processes with gRPC-related command patterns
  • Databases: MySQL, PostgreSQL, MongoDB, Redis, etc.
  • WebSocket Servers: WebSocket implementations
  • WebRTC: Real-time communication servers

📖 Usage Examples

Web Dashboard Features

  1. 📊 Live Statistics: View total server count, memory usage, and CPU usage at a glance
  2. 🎯 Smart Filtering: Filter servers by service type, process name, or command path
  3. 🔍 Process Details: See uptime, resource usage, ports, and full command lines
  4. ⚡ Process Management: Terminate processes directly from the UI with confirmation
  5. 📈 Change Monitoring: Track when servers start and stop in real-time

CLI Commands

# Start the web server (recommended)
cargo run -- serve --port 3030
# List servers in terminal (no web UI)
cargo run -- list
# Monitor changes in terminal
cargo run -- monitor
# Filter by service type
cargo run -- list --service-type RestApi

🔧 API Endpoints

MethodEndpointDescriptionExample
GET/healthHealth checkcurl http://localhost:3030/health
GET/serversList all serverscurl http://localhost:3030/servers
GET/servers?service_type=RestApiFilter by typecurl http://localhost:3030/servers?service_type=RestApi
GET/statsServer statisticscurl http://localhost:3030/stats
GET/stats?by_type=trueStats by service typecurl http://localhost:3030/stats?by_type=true
GET/monitorTrack changescurl http://localhost:3030/monitor
DELETE/servers/{pid}Terminate processcurl -X DELETE http://localhost:3030/servers/12345

📋 Example API Response

{
"success": true,
"data": [
{
"pid": 12345,
"name": "node",
"service_type": "RestApi",
"status": "Running",
"uptime_seconds": 3600,
"cpu_usage": 2.5,
"memory_usage": 45678912,
"port": 3000,
"cmd": "node server.js"
}
]
}

🛠️ Development

# Build in development mode
cargo build
# Run tests
cargo test# Check code quality
cargo clippy
# Format code
cargo fmt
# Run with debug output
RUST_LOG=debug cargo run -- serve --port 3030

🔬 Testing

Use the included Postman collection for API testing:

# Import the collection
open postman/Server_Tracker_Environment.postman_environment.json

🎨 Web Dashboard Screenshots

The web dashboard features:

  • 🎨 Modern, responsive design that works on desktop and mobile
  • 🔴 Eye-catching PID badges with gradient colors and animations
  • 📊 Real-time charts and statistics
  • 🎯 Smart port categorization with color coding
  • ⚡ One-click process termination with safety confirmations

🚦 Port Detection Categories

The system automatically categorizes ports with visual indicators:

  • 🔴 Common Ports (80, 443, 8080, 8443) - Red gradient
  • 🔵 Development Ports (3000-3999, 8000-8999) - Blue gradient
  • 🟣 Database Ports (3306, 5432, 27017, etc.) - Purple gradient
  • 🟪 System Ports (>50000) - Pink gradient
  • ⚫ Other/Unknown - Gray

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and clippy
  5. Submit a pull request

📄 License

This project is open source and available under the MIT License.


🚀 Start tracking your development servers today!

Run cargo run -- serve --port 3030 and visit http://localhost:3030 to see the magic! ✨

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages