darpan 0.2.5

Linux developer service monitoring utility with auto-detection, real-time health checks, and interactive TUI for databases, APIs, Docker containers, and more
Documentation

Darpan ๐Ÿชž

เคฆเคฐเฅเคชเคฃ (Darpan) = Mirror in Hindi/Sanskrit
Your development environment, reflected in real-time

Crates.io License: MIT Rust

Zero-config service monitoring for Linux developers. Auto-discovers and monitors databases, APIs, Docker containers, and caches with real-time health checks, live log streaming, network activity tracking, and extensible service packs.

cargo install darpan
darpan watch  # That's it!

โœจ What You Get

Before Darpan ๐Ÿ˜“

$ systemctl status postgresql redis nginx
$ docker ps | grep mongo
$ lsof -i :3000,5432,6379
$ curl localhost:8000/health
$ journalctl -u postgresql -f
$ tail -f /var/log/nginx/error.log

6 commands. 6 terminal tabs. Constant context switching.

With Darpan โœจ

$ darpan watch
โ”Œโ”€ Darpan - myproject | Live Monitor โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ STATUS    โ”‚ NAME        โ”‚ TYPE      โ”‚ PORT  โ”‚ CONN  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โœ“ Healthy โ”‚ PostgreSQL  โ”‚ Database  โ”‚  5432 โ”‚ 3     โ”‚
โ”‚ โœ“ Healthy โ”‚ Redis       โ”‚ Cache     โ”‚  6379 โ”‚ 0     โ”‚
โ”‚ โœ“ Healthy โ”‚ Frontend    โ”‚ HTTP      โ”‚  3000 โ”‚ 1     โ”‚  โ† Works without /health!
โ”‚ โœ— Down    โ”‚ API Server  โ”‚ HTTP      โ”‚  8000 โ”‚ -     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
3/4 healthy | Enter: details | L: logs | r: refresh

One command. One dashboard. Everything.


๐Ÿš€ Key Features

๐Ÿ” Zero-Config Auto-Discovery

  • Instant detection: PostgreSQL, Redis, MySQL, MongoDB, Docker, HTTP servers
  • Multi-source scanning: Ports, processes, Docker API, systemd units
  • Smart recognition: Service signatures and common patterns
  • Extensible: Service packs for custom stacks (Node.js, Django, etc.)
  • Just works: No setup required

๐Ÿ’š Intelligent Health Monitoring

  • Multi-tier checks: HTTP endpoints โ†’ Port connectivity โ†’ Process verification
  • Database pings: PostgreSQL, Redis, MySQL, MongoDB
  • Traffic-based: Frontend/Backend services use network activity (no HTTP spam)
  • Script support: Custom health checks via commands
  • Fallback logic: Services without /health work (React, Vue, Angular dev servers)

๐Ÿ“ก Live Network Activity Tracking โšก NEW

โ•โ•โ• Network Activity โ•โ•โ•
Port Status: LISTENING โœ“
Active Connections: 5 (traffic detected)
Process Connections: 3 established, 1 listening
  • See actual traffic to your services
  • Detect hung connections or leaks
  • Verify listening status even without health endpoints
  • Process-level insights for deep debugging

๐Ÿ” Real-Time Log Streaming

โ”Œโ”€ SERVICE LOGS: Redis โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [12:30:45 INFO ] Starting Redis 7.0.15        โ”‚
โ”‚ [12:30:46 INFO ] Ready to accept connections  โ”‚
โ”‚ [12:30:50 WARN ] Memory usage: 2.1MB          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Press /: search | 1-4: filter level | E: export

Auto-detects log sources:

  • ๐Ÿณ Docker: stdout/stderr from containers
  • โš™๏ธ Systemd: journalctl integration
  • ๐Ÿ“ Files: /var/log/, ./logs/, ~/.pm2/logs/
  • โšก Process: Direct stdout/stderr capture
  • ๐Ÿ”ง Scripts: Custom commands (e.g., journalctl -u {systemd_unit} -f)

Interactive features:

  • Search (/), filter (1-4), pause (Space), scroll (โ†‘โ†“, mouse wheel)
  • Copy selection (v/y/Ctrl+C), export (E)
  • Page navigation (PageUp/PageDown, g/G, Home/End)

๐ŸŽจ Beautiful TUI

  • Keyboard-driven (Vim-style j/k support)
  • Color-coded status indicators
  • Live auto-refresh
  • Service details with diagnostics
  • Network activity section

๐Ÿ“ฆ Installation

# From crates.io (recommended)
cargo install darpan

# From source
git clone https://github.com/codeBunny2022/darpan.git
cd darpan
cargo install --path .

# Verify
darpan --version  # v0.2.5+

Requirements: Rust 1.70+, Linux
Optional: Docker, systemd, ss/netstat


๐ŸŽฏ Quick Start

Basic Commands

darpan watch              # Interactive TUI (recommended)
darpan status             # Quick CLI status
darpan why "Redis"        # Troubleshoot specific service
darpan status --format json  # For scripts/CI
darpan init               # Create .darpan.yml template

TUI Navigation

Key Action
โ†‘/โ†“, j/k Navigate services
Enter View details + network activity
L View live service logs ๐Ÿ”ฅ
r Refresh
q, Esc Back/Quit

Log Viewer (Press L)

Key Action
Space Pause/resume
/ Search
1-4 Filter by level
0 Clear filters
E Export
โ†‘/โ†“ Scroll (paused)

๐Ÿ“š Configuration (Optional)

Darpan works without config. Add .darpan.yml for custom services:

version: 1
services:
  - name: My API
    type: http_server
    port: 8000
    health_check:
      type: http
      path: /api/health
    log_file: /var/log/myapi/app.log
  - name: PostgreSQL
    type: { database: postgres }
    port: 5432
    health_check:
      type: postgres

Locations: ./.darpan.yml (project) or ~/.config/darpan/config.yml (user)


๐ŸŒŸ Examples

Microservices: Auto-detect Docker containers, APIs, databases
Debugging: Press L โ†’ search logs โ†’ export for analysis
CI/CD: darpan status --format json | jq '.[] | select(.status != "Healthy")'


๐Ÿ”Œ Extensibility โšก NEW

Extend Darpan without code changes:

Service Packs (YAML)

Share detection rules, health checks, and log paths for common stacks:

# ~/.config/darpan/packs/my-stack.yml
name: my-stack
version: "1.0.0"
signatures:
  - name: My API
    type: http_server
    role: backend
    port: 8080
    process_pattern: "my-api"
    health_check:
      type: http
      path: /health

Packs auto-load from:

  • ~/.config/darpan/packs/*.yml (user-wide)
  • .darpan.d/packs/*.yml (project-local)

Script-Based Checks

Custom health checks and log sources via commands:

health_check:
  type: custom
  script: "curl -f http://{host}:{port}/health || exit 1"

log_paths:
  - "journalctl -u {systemd_unit} -f"

Placeholders: {name}, {host}, {port}, {pid}, {systemd_unit}

Programmatic extensions also supported. See Extensibility Guide and example packs.

๐Ÿ”ง Troubleshooting

Service not detected? โ†’ Check port (ss -tln) or add to .darpan.yml (darpan init)
Logs not showing? โ†’ Check permissions or specify log_file in config
Health check wrong? โ†’ Override health_check in .darpan.yml


๐Ÿค Contributing

Contributions welcome! Please see CONTRIBUTING.md for:

  • Code of conduct
  • Development setup
  • Pull request process
  • Testing guidelines

๐Ÿ“„ License

MIT License - see LICENSE for details.

Created by Chirag (chiraglabs)


๐Ÿ™ Acknowledgments

Built with:

Inspired by tools like htop, docker-compose, and systemctl status.


๐Ÿ’ฌ Support


โญ Star this repo if Darpan helps you!

Made with โค๏ธ by developers, for developers.