- Web UI: - Added secure Authentication system (Login, 2 Roles: Admin/Viewer) - Added System Monitoring Dashboard (Health, Services, Power Mgmt) - Added User Management Interface (Create, Delete, Enable/Disable) - Added Device Mapping view in iSCSI tab (lsscsi output) - Backend: - Implemented secure session management (auth.php) - Added power management APIs (restart/shutdown appliance) - Added device mapping API - CLI: - Created global 'vtl' management tool - Added scripts for reliable startup (vtllibrary fix) - Installer: - Updated install.sh with new dependencies (tgt, sudoers, permissions) - Included all new components in build-installer.sh - Docs: - Consolidated documentation into docs/ folder
9.5 KiB
🎮 VTL CLI Management Tool
📋 Overview
A comprehensive command-line interface tool for managing the Virtual Tape Library system. The vtl command provides easy access to all VTL operations from anywhere in the system.
🚀 Installation
The tool is installed globally and accessible from any directory:
Location: /usr/local/bin/vtl
Source: /builder/adastra-vtl/scripts/vtl
Installation:
sudo cp /builder/adastra-vtl/scripts/vtl /usr/local/bin/vtl
sudo chmod +x /usr/local/bin/vtl
📖 Usage
Basic Syntax
vtl <command> [options]
Quick Start
# Check system status
vtl status
# Start all services
vtl start
# Restart MHVTL only
vtl restart-mhvtl
# View help
vtl help
🎯 Commands
System Status
vtl status (or just vtl)
Show comprehensive system status dashboard
Output includes:
- ✅ Services status (mhvtl, apache2, tgt)
- ✅ Component status (vtltape, vtllibrary)
- ✅ SCSI devices (library, drives)
- ✅ Network services (Web UI, iSCSI)
- ✅ Overall health score
Example:
$ vtl status
╔════════════════════════════════════════════════════════════╗
║ VTL System Status Dashboard ║
╚════════════════════════════════════════════════════════════╝
📊 Services Status:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
● mhvtl running (Virtual Tape Library)
● apache2 running (Web UI Server)
● tgt running (iSCSI Target)
🔧 Components:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ vtltape 4 processes
✓ vtllibrary running
💾 SCSI Devices:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Library detected (ADASTRA HEPHAESTUS-V - /dev/sg6)
✓ Tape Drives 4 detected
└─ HP Ultrium 6-SCSI → /dev/sg2
└─ HP Ultrium 6-SCSI → /dev/sg3
└─ HP Ultrium 6-SCSI → /dev/sg4
└─ HP Ultrium 6-SCSI → /dev/sg5
🌐 Network Services:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Web UI http://localhost/mhvtl-config/
✓ iSCSI Targets 2 configured
💚 Overall Health:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
● System Status: HEALTHY (6/6 checks passed)
✓ All components operational
Service Management
vtl start
Start all VTL services (mhvtl, apache2, tgt)
$ vtl start
Starting VTL Services...
Starting mhvtl... ✓
Starting apache2... ✓
Starting tgt... ✓
✓ All services started
vtl stop
Stop all VTL services
$ vtl stop
Stopping VTL Services...
Stopping mhvtl... ✓
Stopping apache2... ✓
Stopping tgt... ✓
✓ All services stopped
vtl restart
Restart all VTL services and show status
$ vtl restart
Restarting VTL Services...
Restarting mhvtl... ✓
Restarting apache2... ✓
Restarting tgt... ✓
✓ All services restarted
[Shows status dashboard]
Individual Service Management
MHVTL Service
vtl start-mhvtl # Start MHVTL only
vtl stop-mhvtl # Stop MHVTL only
vtl restart-mhvtl # Restart MHVTL and show status
Web UI (Apache)
vtl start-web # Start Apache only
vtl stop-web # Stop Apache only
vtl restart-web # Restart Apache only
iSCSI Target (TGT)
vtl start-iscsi # Start TGT only
vtl stop-iscsi # Stop TGT only
vtl restart-iscsi # Restart TGT only
Device Information
vtl devices
List all SCSI devices
$ vtl devices
SCSI Devices:
[0:0:0:0] disk QEMU QEMU HARDDISK 2.5+ /dev/sda /dev/sg0
[2:0:0:0] cd/dvd QEMU QEMU DVD-ROM 2.5+ /dev/sr0 /dev/sg1
[3:0:0:0] mediumx ADASTRA HEPHAESTUS-V 0107 - /dev/sg6
[3:0:1:0] tape HP Ultrium 6-SCSI 0107 - /dev/sg2
[3:0:2:0] tape HP Ultrium 6-SCSI 0107 - /dev/sg3
[3:0:3:0] tape HP Ultrium 6-SCSI 0107 - /dev/sg4
[3:0:4:0] tape HP Ultrium 6-SCSI 0107 - /dev/sg5
Logs and Diagnostics
vtl logs [service]
Show logs for a specific service
# MHVTL logs
vtl logs mhvtl
# Apache logs
vtl logs apache2
# TGT logs
vtl logs tgt
# Default (mhvtl)
vtl logs
Example:
$ vtl logs mhvtl
Logs for mhvtl:
Dec 09 17:10:11 vtl-dev start-mhvtl.sh[65776]: Starting vtltape for drive 11...
Dec 09 17:10:11 vtl-dev /usr/bin/vtltape[65804]: main(): Started /usr/bin/vtltape
Dec 09 17:10:13 vtl-dev start-mhvtl.sh[65776]: Starting vtllibrary for library 10...
Dec 09 17:10:13 vtl-dev systemd[1]: Started mhvtl.service
Utility Commands
vtl web
Show Web UI URL
$ vtl web
Web UI URL:
http://localhost/mhvtl-config/
vtl version
Show version information
$ vtl version
VTL Management Tool
Version: 1.0.0
MHVTL: vtltape version 1.7.2
vtl help
Show help message
$ vtl help
VTL Management Tool v1.0.0
Usage:
vtl <command> [options]
Commands:
[Full help output]
🎨 Features
Color-Coded Output
- 🟢 Green - Running/Healthy
- 🔴 Red - Stopped/Error
- 🟡 Yellow - Warning/Degraded
- 🔵 Blue - Headers/Sections
- 🔵 Cyan - Titles
Health Scoring
System calculates health based on:
- Services running (mhvtl, apache2, tgt)
- Components active (vtltape, vtllibrary)
- Devices detected (library, drives)
Health Levels:
- 100% (6/6) - 🟢 HEALTHY - All systems operational
- 66-99% (4-5/6) - 🟡 DEGRADED - Some components need attention
- 0-65% (0-3/6) - 🔴 CRITICAL - Multiple components offline
Smart Status Display
- Shows device details (vendor, model, device path)
- Counts processes and targets
- Provides actionable information
- Auto-refreshes after service operations
📊 Common Workflows
Daily Health Check
# Quick status check
vtl status
# Or just
vtl
Troubleshooting
# Check status
vtl status
# View logs
vtl logs mhvtl
# Restart problematic service
vtl restart-mhvtl
# Check status again
vtl status
After Configuration Changes
# Restart MHVTL to apply changes
vtl restart-mhvtl
# Verify devices
vtl devices
# Check overall status
vtl status
Starting System
# Start all services
vtl start
# Wait a few seconds, then verify
vtl status
Stopping System
# Stop all services
vtl stop
# Verify stopped
vtl status
🔧 Integration
Use in Scripts
#!/bin/bash
# Check if VTL is healthy
if vtl status | grep -q "HEALTHY"; then
echo "VTL is operational"
else
echo "VTL needs attention"
vtl restart
fi
Monitoring
# Add to cron for periodic checks
*/5 * * * * /usr/local/bin/vtl status > /var/log/vtl-status.log
Systemd Integration
Already integrated via systemd services. The vtl command manages these services.
📁 File Locations
| Item | Location |
|---|---|
| CLI Tool | /usr/local/bin/vtl |
| Source | /builder/adastra-vtl/scripts/vtl |
| Config | /etc/mhvtl/device.conf |
| Web UI | /var/www/html/mhvtl-config/ |
| Logs | journalctl -u mhvtl |
🎯 Quick Reference
# Status & Info
vtl # Show status (default)
vtl status # Show status (explicit)
vtl devices # List SCSI devices
vtl web # Show Web UI URL
vtl version # Show version
vtl help # Show help
# All Services
vtl start # Start all
vtl stop # Stop all
vtl restart # Restart all
# MHVTL Only
vtl start-mhvtl # Start MHVTL
vtl stop-mhvtl # Stop MHVTL
vtl restart-mhvtl # Restart MHVTL
# Web UI Only
vtl start-web # Start Apache
vtl stop-web # Stop Apache
vtl restart-web # Restart Apache
# iSCSI Only
vtl start-iscsi # Start TGT
vtl stop-iscsi # Stop TGT
vtl restart-iscsi # Restart TGT
# Logs
vtl logs # MHVTL logs
vtl logs mhvtl # MHVTL logs
vtl logs apache2 # Apache logs
vtl logs tgt # TGT logs
✅ Summary
The vtl command provides:
- ✅ Single command for all VTL operations
- ✅ Beautiful dashboard with color-coded status
- ✅ Health monitoring with scoring system
- ✅ Service management (start/stop/restart)
- ✅ Device listing and information
- ✅ Log viewing for troubleshooting
- ✅ Global access from any directory
- ✅ Easy to use with intuitive commands
No more complex systemctl commands or multiple tools - just vtl! 🚀
Version: 1.0.0
Date: December 9, 2025
Status: ✅ Production Ready