Reorganize Proxmox documentation with clear structure and VM/LXC mapping
## Changes ### Documentation Reorganization - **README.md**: Complete restructure with logical sections - Infrastructure General (proxmox-ssh-guide.md) - LXC Containers (oracle-database-lxc108.md) - Virtual Machines (vm201-*.md) - Cluster-Wide Resources (cluster-ha-monitor.sh, ups/) - Archived/Decommissioned (archived-vm107-monitor.sh) - Added quick navigation "Am nevoie să..." section - Added recommended workflows - Added complete directory structure map - **proxmox-ssh-guide.md**: Added documentation references section - Clear links to all related documentation - When to use each document - Quick start snippets for each resource ### File Renames for Clarity - `certificat-letsencrypt-iis.md` → `vm201-certificat-letsencrypt-iis.md` - `troubleshooting-vm201-backup-nfs.md` → `vm201-troubleshooting-backup-nfs.md` - `ha-monitor.sh` → `cluster-ha-monitor.sh` - `vm107-monitor.sh` → `archived-vm107-monitor.sh` ### New Documentation - **vm201-windows11.md**: Complete VM 201 documentation - Hardware configuration - Installed services (IIS, SQL*Plus, WinNUT, RDP) - Network configuration - Backup and recovery procedures - Common troubleshooting ## Benefits - Clear naming convention: VM/LXC/Cluster prefixes - Central index in README.md with navigation - Cross-references between documents - Complete VM 201 documentation suite - Clear archival of decommissioned resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
102
proxmox/archived-vm107-monitor.sh
Normal file
102
proxmox/archived-vm107-monitor.sh
Normal file
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
HOSTNAME=$(hostname)
|
||||
DATE=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
VM_ID=107
|
||||
LOG_FILE="/var/log/vm107-monitor.log"
|
||||
STATE_FILE="/var/run/vm107-last-state"
|
||||
|
||||
check_vm_status() {
|
||||
local vm_status=$(qm status $VM_ID 2>/dev/null | grep -oP 'status: \K.*')
|
||||
|
||||
if [ -z "$vm_status" ]; then
|
||||
echo "ERROR:VM_NOT_FOUND"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$vm_status" = "running" ]; then
|
||||
if ps aux | grep -E "(kvm|qemu).*-id $VM_ID" | grep -qv grep; then
|
||||
echo "RUNNING:OK"
|
||||
return 0
|
||||
else
|
||||
echo "ERROR:PROCESS_MISSING"
|
||||
return 1
|
||||
fi
|
||||
elif [ "$vm_status" = "stopped" ]; then
|
||||
echo "STOPPED:VM_STOPPED"
|
||||
return 1
|
||||
elif [ "$vm_status" = "internal-error" ]; then
|
||||
echo "ERROR:INTERNAL_ERROR"
|
||||
return 1
|
||||
else
|
||||
echo "ERROR:UNKNOWN_STATE:$vm_status"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
RESULT=$(check_vm_status)
|
||||
CHECK_EXIT=$?
|
||||
|
||||
STATUS=$(echo "$RESULT" | cut -d: -f1)
|
||||
ERROR_TYPE=$(echo "$RESULT" | cut -d: -f2)
|
||||
|
||||
# Citește starea anterioară
|
||||
LAST_STATE=""
|
||||
[ -f "$STATE_FILE" ] && LAST_STATE=$(cat "$STATE_FILE")
|
||||
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S'): VM $VM_ID status: $STATUS ($ERROR_TYPE)" >> "$LOG_FILE"
|
||||
|
||||
# Verifică dacă starea s-a schimbat
|
||||
CURRENT_STATE="$STATUS:$ERROR_TYPE"
|
||||
|
||||
if [ "$LAST_STATE" != "$CURRENT_STATE" ]; then
|
||||
# Starea s-a schimbat - trimite email
|
||||
SEND_EMAIL=true
|
||||
|
||||
if [ $CHECK_EXIT -eq 0 ]; then
|
||||
# VM acum e OK
|
||||
if [[ "$LAST_STATE" == STOPPED:* ]] || [[ "$LAST_STATE" == ERROR:* ]]; then
|
||||
# Era oprit/eroare, acum e pornit - trimite email de recovery
|
||||
SUBJECT="✅ VM $VM_ID RECOVERED - Running on $HOSTNAME"
|
||||
BODY="VM $VM_ID has RECOVERED and is now RUNNING\n"
|
||||
BODY+="Previous state: $LAST_STATE\n"
|
||||
BODY+="Current state: RUNNING\n"
|
||||
BODY+="Recovery time: $DATE\n"
|
||||
BODY+="Host: $HOSTNAME\n\n"
|
||||
BODY+="VM is now operating normally."
|
||||
else
|
||||
# Altă tranziție către RUNNING - nu trimite email
|
||||
SEND_EMAIL=false
|
||||
fi
|
||||
else
|
||||
# VM are probleme
|
||||
SUBJECT="⚠️ VM $VM_ID $STATUS on $HOSTNAME"
|
||||
BODY="VM $VM_ID Status: $STATUS\n"
|
||||
BODY+="Error Type: $ERROR_TYPE\n"
|
||||
BODY+="Check Time: $DATE\n"
|
||||
BODY+="Host: $HOSTNAME\n\n"
|
||||
|
||||
if [ "$STATUS" = "STOPPED" ]; then
|
||||
BODY+="VM is stopped. To start: qm start $VM_ID"
|
||||
elif [ "$ERROR_TYPE" = "INTERNAL_ERROR" ]; then
|
||||
BODY+="VM has internal-error (KVM crash)."
|
||||
elif [ "$ERROR_TYPE" = "PROCESS_MISSING" ]; then
|
||||
BODY+="VM marked as running but process missing."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Trimite email dacă e necesar
|
||||
if [ "$SEND_EMAIL" = true ]; then
|
||||
echo -e "$BODY" | mail -s "$SUBJECT" root
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S'): Email sent - state changed from '$LAST_STATE' to '$CURRENT_STATE'" >> "$LOG_FILE"
|
||||
else
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S'): State changed but no email needed" >> "$LOG_FILE"
|
||||
fi
|
||||
else
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S'): No email - state unchanged ($CURRENT_STATE)" >> "$LOG_FILE"
|
||||
fi
|
||||
|
||||
# Salvează starea curentă
|
||||
echo "$CURRENT_STATE" > "$STATE_FILE"
|
||||
|
||||
exit $CHECK_EXIT
|
||||
Reference in New Issue
Block a user