|
|
| (10 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| {{DISPLAYTITLE:Backing Up GUI Configuration}} | | {{DISPLAYTITLE:Backing Up GUI Configuration}} |
|
| |
|
| '''This guide provides a step-by-step method for creating regular, automated backups of your VoIPmonitor GUI's configuration. This includes users, sensors, capture rules, and all other settings configured through the web interface.'''
| | This guide covers backing up and restoring VoIPmonitor GUI configuration data (users, sensors, alerts, dashboards). It does '''not''' cover CDR/PCAP data backup. |
|
| |
|
| == Overview == | | == Quick Reference == |
| This backup procedure is designed to save '''only the GUI's configuration data''', not the call data (CDRs) or captured PCAP files. It is an essential part of a disaster recovery plan, allowing you to quickly restore a known-good GUI configuration to a new or rebuilt server without backing up terabytes of call data.
| |
|
| |
|
| The backup process works with three types of data:
| | {| class="wikitable" |
| #'''Configuration Tables:''' The core database tables that store settings, dashboards, and configurations (e.g., `users`, `sensors`, `custom_config`). These include all settings made by GUI users and administrators.
| | |- |
| #'''Data Tables:''' Supporting data like saved reports.
| | ! Task !! Method !! Command/Path |
| #'''Configuration Files:''' The PHP configuration files from the GUI directory itself (e.g., `configuration.php`).
| | |- |
| | | | One-time backup || GUI || '''Tools → Backup & restore''' → select "configuration tables" + "configuration files" |
| == Quick Backup via GUI Web Interface ==
| | |- |
| | | | Automated backup || CLI || <code>php run.php backupGuiTables -t config -f backup.sql</code> |
| For a quick backup before an upgrade, you can use the built-in GUI backup feature directly from the web interface.
| | |- |
| | | | Restore || GUI || '''Tools → Backup & restore''' → "restore" |
| {{Note|This method is ideal for one-time backups before upgrades, reinstallation, or migrations. For automated daily backups, see the command-line script method below.}}
| | |- |
| | | | Restore || CLI || <code>php run.php restoreGuiTables -t config -f backup.sql</code> |
| '''Steps:'''
| | |} |
| | |
| 1. Open the VoIPmonitor GUI web interface
| |
| 2. Navigate to '''GUI → Tools → Backup & restore'''
| |
| 3. Select ''':backup GUI: configuration tables''' to back up all database settings made by GUI users and administrators
| |
| 4. Select ''':backup GUI: configuration files''' to back up GUI configuration files
| |
| 5. Perform the backup
| |
| 6. Download the generated backup file to a safe location
| |
|
| |
|
| '''What Gets Backed Up:''' | | '''What Gets Backed Up:''' |
| | * '''Configuration Tables:''' Users, sensors, capture rules, alerts, dashboards, reports |
| | * '''Configuration Files:''' PHP config files (<code>configuration.php</code>) |
|
| |
|
| * '''Configuration Tables''' includes:
| | {{Warning|1=Restoring '''overwrites''' existing settings. Perform on fresh GUI or accept data loss.}} |
| ** All user accounts and permissions
| |
| ** Sensor definitions and configurations
| |
| ** Capture rules and filters
| |
| ** Alert definitions and thresholds
| |
| ** Dashboard configurations
| |
| ** Reports and their definitions
| |
|
| |
|
| * '''Configuration Files''' includes:
| | == GUI Backup (Quick Method) == |
| ** `configuration.php` and other GUI-specific PHP configuration files
| |
|
| |
|
| '''Restoring from GUI Backup:'''
| | Ideal for one-time backups before upgrades or migrations. |
|
| |
|
| If you need to restore after an upgrade (for example, if alerts disappear):
| | # Navigate to '''GUI → Tools → Backup & restore''' |
| 1. Navigate to '''GUI → Tools → Backup & restore'''
| | # Select "'''backup GUI: configuration tables'''" |
| 2. Select ''':restore GUI: configuration tables'''
| | # Select "'''backup GUI: configuration files'''" |
| 3. Upload and select the backup file created earlier
| | # Click backup and download the generated file |
|
| |
|
| {{Warning|Restoring will overwrite existing GUI settings. Only perform this on a freshly installed GUI or be prepared to lose current configurations.}}
| | '''To Restore:''' |
| | # Navigate to '''GUI → Tools → Backup & restore''' |
| | # Select "'''restore'''" |
| | # Upload the backup file |
|
| |
|
| == Automated Daily Backup Using CLI Script == | | == Automated CLI Backup == |
|
| |
|
| This section describes how to set up automated daily backups using a command-line script. This method is ideal for production environments where you want regular, scheduled backups without manual intervention.
| | For production environments requiring scheduled backups. |
|
| |
|
| First, create a shell script that will run the export commands.
| | === Backup Script === |
|
| |
|
| ;Create and edit the script file:
| | Create <code>/usr/local/sbin/backup_voipmonitor_gui.sh</code>: |
| <pre> | |
| nano /usr/local/sbin/backup_voipmonitor_gui.sh
| |
| </pre> | |
|
| |
|
| ;Copy and paste the following content into the file:
| | <syntaxhighlight lang="bash"> |
| <pre> | |
| #!/bin/bash | | #!/bin/bash |
| #
| |
| # VoIPmonitor GUI Configuration Backup Script | | # VoIPmonitor GUI Configuration Backup Script |
| #
| |
|
| |
|
| # --- Configuration ---
| |
| # Set the base directory where backups will be stored
| |
| BACKUP_DIR="/var/backups/voipmonitor_gui" | | BACKUP_DIR="/var/backups/voipmonitor_gui" |
|
| |
| # Set the retention period in days. Backups older than this will be deleted.
| |
| RETENTION_DAYS=30 | | RETENTION_DAYS=30 |
| | RUN_SCRIPT="/var/www/html/php/run.php" |
| | DAY=$(date "+%Y-%m-%d") |
|
| |
|
| # --- Script Logic ---
| |
|
| |
| # Create the backup directory if it doesn't exist
| |
| mkdir -p "$BACKUP_DIR" | | mkdir -p "$BACKUP_DIR" |
|
| |
|
| # Set the filename based on the current date | | # Export configuration and data tables |
| DAY=$(date "+%Y-%m-%d")
| | php "$RUN_SCRIPT" backupGuiTables -t config -f "$BACKUP_DIR/config_tables-${DAY}.sql" |
| FILE_CFG_TABLES="$BACKUP_DIR/config_tables-${DAY}.sql"
| | php "$RUN_SCRIPT" backupGuiTables -t data -f "$BACKUP_DIR/data_tables-${DAY}.sql" |
| FILE_DATA_TABLES="$BACKUP_DIR/data_tables-${DAY}.sql"
| | php "$RUN_SCRIPT" backupGuiConfigurationFiles -f "$BACKUP_DIR/config_files-${DAY}.tar.gz" |
| FILE_CFG_FILES="$BACKUP_DIR/config_files-${DAY}.tar.gz"
| |
| | |
| # Path to the GUI's run.php script
| |
| RUN_SCRIPT="/var/www/html/php/run.php"
| |
|
| |
|
| echo "--- Starting VoIPmonitor GUI Backup for ${DAY} ---"
| | # Cleanup old backups |
| | find "$BACKUP_DIR" -type f -mtime +"$RETENTION_DAYS" \( -name '*.sql' -o -name '*.tar.gz' \) -delete |
|
| |
|
| # Export the configuration and data tables as SQL dumps
| | echo "Backup complete: $BACKUP_DIR" |
| php "$RUN_SCRIPT" backupGuiTables -t config -f "$FILE_CFG_TABLES"
| | </syntaxhighlight> |
| php "$RUN_SCRIPT" backupGuiTables -t data -f "$FILE_DATA_TABLES"
| |
|
| |
|
| # Backup the GUI's PHP configuration files into a compressed tarball
| | === Setup === |
| php "$RUN_SCRIPT" backupGuiConfigurationFiles -f "$FILE_CFG_FILES"
| |
|
| |
|
| echo "Backup files created:"
| | <syntaxhighlight lang="bash"> |
| ls -lh "$FILE_CFG_TABLES" "$FILE_DATA_TABLES" "$FILE_CFG_FILES"
| | # Make executable and test |
| | |
| # Clean up old backups | |
| echo "--- Cleaning up backups older than ${RETENTION_DAYS} days ---"
| |
| find "$BACKUP_DIR" -type f -mtime +"$RETENTION_DAYS" -name '*-*-*-*.sql' -print -delete
| |
| find "$BACKUP_DIR" -type f -mtime +"$RETENTION_DAYS" -name '*-*-*-*.tar.gz' -print -delete
| |
| | |
| echo "--- Backup complete ---"
| |
| </pre>
| |
| | |
| === Step 2: Make the Script Executable and Test It ===
| |
| Set the correct permissions so the script can be run.
| |
| <pre>
| |
| chmod +x /usr/local/sbin/backup_voipmonitor_gui.sh | | chmod +x /usr/local/sbin/backup_voipmonitor_gui.sh |
| </pre>
| | /usr/local/sbin/backup_voipmonitor_gui.sh |
| You can test the script by running it manually: `/usr/local/sbin/backup_voipmonitor_gui.sh`. It should create three new files in `/var/backups/voipmonitor_gui`.
| |
| | |
| == Step 3: Schedule the Automated Backup with Cron ==
| |
| The final step is to create a cron job to run the script automatically every night.
| |
|
| |
|
| ;Edit the system's crontab file:
| | # Schedule daily at 3:30 AM |
| <pre>
| |
| crontab -e | | crontab -e |
| </pre>
| | # Add: 30 3 * * * /usr/local/sbin/backup_voipmonitor_gui.sh > /var/log/voipmonitor_backup.log 2>&1 |
| | | </syntaxhighlight> |
| ;Add the following line to the end of the file:
| |
| This example will run the backup script every day at 3:30 AM.
| |
| <pre>
| |
| 30 3 * * * /usr/local/sbin/backup_voipmonitor_gui.sh > /var/log/voipmonitor_backup.log 2>&1 | |
| </pre> | |
| * The `> /var/log/voipmonitor_backup.log 2>&1` part redirects all output (both standard and error) to a log file, which is essential for troubleshooting the cron job if it fails.
| |
| | |
| Save and close the file. The cron daemon will automatically pick up the new schedule.
| |
| | |
| == Importing Only Dashboards from Another GUI Instance ==
| |
| Use this procedure when you need to migrate dashboards from an old VoIPmonitor GUI instance to a new one.
| |
| | |
| '''Recommended Method: GUI Backup & Restore (Simple)'''
| |
| | |
| The easiest way to transfer dashboards is to use the built-in GUI backup and restore interface. This method is recommended because it correctly handles dashboard ownership tied to user and group IDs.
| |
| | |
| ;1. On the source server (Old GUI):
| |
| Navigate to '''GUI → Tools → Backup & restore'''
| |
| * Select "'''backup GUI: configuration tables'''"
| |
| * Perform the backup
| |
| * Download the generated backup file
| |
| | |
| ;2. On the destination server (New GUI):
| |
| Navigate to '''GUI → Tools → Backup & restore'''
| |
| * Select "'''restore'''"
| |
| * Upload and select the backup file created from the source server
| |
| | |
| This will import the dashboards along with other GUI configuration. If you want to transfer ONLY dashboards (without other settings like sensors, capture rules, etc.), see the advanced method below.
| |
| | |
| ---
| |
| | |
| '''Advanced Method: Manual SQL Extraction (Dashboards Only)'''
| |
| | |
| Use this advanced procedure when you need to migrate dashboards from an old VoIPmonitor GUI instance to a new one without importing other configurations like sensors or capture rules.
| |
| | |
| Dashboards are stored in the `custom_config` database table, which is part of the configuration backup.
| |
| | |
| === Important Notes ===
| |
| * This process imports dashboards, charts, and associated reports - it is not possible to isolate only the Dashboard layouts
| |
| * Folder structures will NOT be preserved - you will need to manually recreate dashboard folders after import
| |
| * Dashboard ownership may need to be adjusted (e.g., to make dashboards public or assign to the correct user)
| |
| * Panel caching may need to be reconfigured for imported dashboards
| |
| | |
| === Step 1: Create Backups on Both Instances ===
| |
| | |
| First, create backups on both the old and new GUI instances:
| |
| | |
| '''Old GUI Server:'''
| |
| <pre>
| |
| cd /var/www/html
| |
| php php/run.php backupGuiTables -t config -f /tmp/old_gui_config.sql
| |
| </pre>
| |
| | |
| '''New GUI Server:'''
| |
| <pre>
| |
| cd /var/www/html
| |
| php php/run.php backupGuiTables -t config -f /tmp/new_gui_config.sql
| |
| </pre>
| |
| | |
| The backup of the new instance is useful for rollback if the import causes issues.
| |
| | |
| === Step 2: Extract the custom_config Table from Old Instance ===
| |
| | |
| The `custom_config` table contains dashboard definitions. Extract only this table from the old instance's backup file:
| |
| | |
| <pre>
| |
| # Extract only the custom_config table INSERT statements
| |
| grep -A 100000 "Dumping data for table \`custom_config\`" /tmp/old_gui_config.sql | \
| |
| grep -B 100000 "Table structure for table" | \
| |
| grep "^INSERT INTO" > /tmp/custom_config_only.sql
| |
| </pre>
| |
| | |
| Alternatively, you can manually extract the table by editing the SQL file and copying only the `INSERT INTO custom_config` statements.
| |
| | |
| === Step 3: Modify Dashboard Ownership (If Needed) ===
| |
| | |
| The `custom_config` table may contain user-specific ownership information. If you need to adjust this, edit the `/tmp/custom_config_only.sql` file:
| |
| | |
| <pre>
| |
| nano /tmp/custom_config_only.sql
| |
| </pre>
| |
| | |
| Common modifications:
| |
| * Change user ID values to match users on the new instance
| |
| * Set ownership to make dashboards public (if your installation supports this)
| |
| * Update any instance-specific paths or IDs
| |
| | |
| {{Note|
| |
| The structure of the `custom_config` table includes fields that may reference user IDs and other instance-specific data. Review your SQL export carefully before importing to ensure data consistency.
| |
| }}
| |
| | |
| === Step 4: Import the custom_config Table to New Instance ===
| |
| | |
| Import the extracted `custom_config` table into the new GUI instance:
| |
| | |
| <pre>
| |
| cd /var/www/html
| |
| mysql -u voipmonitor_user -p voipmonitor < /tmp/custom_config_only.sql
| |
| </pre>
| |
| | |
| Or use the GUI web interface if it provides a table import function.
| |
| | |
| === Step 5: Post-Import Tasks ===
| |
| | |
| After importing the dashboards, you will need to:
| |
|
| |
|
| ;Recreate Dashboard Folder Structures:
| | === CLI Restore === |
| The import does not preserve folder hierarchies. Log in to the new GUI and manually create any dashboard folders, then move imported dashboards into the appropriate folders.
| |
|
| |
|
| ;Configure Panel Caching:
| | <syntaxhighlight lang="bash"> |
| If your dashboards use cached data for performance, you may need to reconfigure panel caching settings for the imported dashboards.
| |
| | |
| ;Verify Permissions:
| |
| Check that users who should have access to the dashboards are appropriately configured in the new GUI instance.
| |
| | |
| === Troubleshooting ===
| |
| | |
| If dashboards do not appear after import:
| |
| * Verify the `custom_config` table was imported correctly by checking the database
| |
| * Check for user ID mismatches between the old and new instances
| |
| * Clear browser cache and refresh the GUI
| |
| * Review any GUI error logs for related messages
| |
| | |
| == How to Restore from a Backup ==
| |
| There are three methods to restore your GUI configuration: the recommended GUI method, the CLI method, or the manual method.
| |
| | |
| '''Warning:''' This process will overwrite your existing GUI settings. Perform these steps on a freshly installed GUI or be prepared to lose current configurations.
| |
| | |
| === IMPORTANT: What IS and IS NOT Transferred ===
| |
| | |
| When restoring a GUI configuration backup to a new instance, the following applies:
| |
| | |
| ;What IS Transferred:
| |
| * User accounts (login credentials, user IDs)
| |
| * Permissions and user group assignments
| |
| * User settings and preferences
| |
| * Sensor definitions (sensor names, IP addresses, capture rules)
| |
| * Alert definitions and thresholds
| |
| * Filter configurations
| |
| * Dashboard configurations
| |
| | |
| ;What is NOT Transferred:
| |
| * '''Assignments of alerts to sensors''' - These must be reconfigured manually after restore
| |
| * '''Assignments of reports to sensors''' - These must be reconfigured manually after restore
| |
| * '''Sensor user assignments''' - Access permissions for sensors must be reassigned to users
| |
| * Captured call data (CDRs) and PCAP files - These are not included in the backup
| |
| | |
| ;Behavior When Merging:
| |
| If the new GUI instance already has existing data:
| |
| * User accounts from the backup will '''overwrite''' existing users with the same username or ID
| |
| * Sensor definitions will be replaced with the backed-up versions
| |
| * Configuration settings will be overwritten
| |
| * This is NOT a merge operation - it is a restore that replaces existing data
| |
| | |
| For these reasons, it is strongly recommended to perform the restore on a freshly installed GUI instance with no existing configuration.
| |
| | |
| === Method 1: Using the GUI Web Interface (Recommended) ===
| |
| | |
| The simplest method is to use the built-in GUI backup and restore interface. This method correctly handles dashboard ownership tied to user and group IDs.
| |
| | |
| ;1. On the source server (Old GUI):
| |
| Navigate to '''GUI → Tools → Backup & restore'''
| |
| * Select "'''backup GUI: configuration tables'''"
| |
| * Perform the backup
| |
| * Download the generated backup file
| |
| | |
| ;2. On the destination server (New GUI):
| |
| Navigate to '''GUI → Tools → Backup & restore'''
| |
| * Select "'''restore'''"
| |
| * Upload and select the backup file created from the source server
| |
| | |
| This is the '''recommended method''' for migrating dashboards because it automatically handles user ID mapping and ownership correctly.
| |
| | |
| === Method 2: Using the restoreGuiTables CLI Command ===
| |
| The GUI provides a command-line tool to restore configuration tables directly without manually importing SQL files.
| |
| | |
| ;1. Navigate to your GUI directory:
| |
| <pre>
| |
| cd /var/www/html | | cd /var/www/html |
| </pre>
| |
|
| |
| ;2. Restore the configuration tables:
| |
| <pre>
| |
| php php/run.php restoreGuiTables -t config -f /var/backups/voipmonitor_gui/config_tables-YYYY-MM-DD.sql | | php php/run.php restoreGuiTables -t config -f /var/backups/voipmonitor_gui/config_tables-YYYY-MM-DD.sql |
| php php/run.php restoreGuiTables -t data -f /var/backups/voipmonitor_gui/data_tables-YYYY-MM-DD.sql | | php php/run.php restoreGuiTables -t data -f /var/backups/voipmonitor_gui/data_tables-YYYY-MM-DD.sql |
| </pre>
| |
|
| |
| ;3. Restore the Configuration Files:
| |
| Extract the backed-up PHP configuration files into your GUI's web root.
| |
| <pre>
| |
| # Extract the archive, overwriting existing files
| |
| tar xzf /var/backups/voipmonitor_gui/config_files-YYYY-MM-DD.tar.gz
| |
| </pre>
| |
|
| |
|
| === Method 3: Manual MySQL Import ===
| | # Restore config files |
| Alternatively, you can use the `mysql` command-line client to import the saved SQL dumps.
| | tar xzf /var/backups/voipmonitor_gui/config_files-YYYY-MM-DD.tar.gz -C /var/www/html/ |
| | </syntaxhighlight> |
|
| |
|
| ;1. Restore the Database Tables:
| | == What IS and IS NOT Transferred == |
| <pre>
| |
| mysql -u your_user -p voipmonitor < /var/backups/voipmonitor_gui/config_tables-YYYY-MM-DD.sql
| |
| mysql -u your_user -p voipmonitor < /var/backups/voipmonitor_gui/data_tables-YYYY-MM-DD.sql
| |
| </pre>
| |
|
| |
|
| ;2. Restore the Configuration Files:
| | {| class="wikitable" |
| Extract the backed-up PHP configuration files into your GUI's web root.
| | |- |
| <pre>
| | ! Transferred !! NOT Transferred |
| # Navigate to the GUI's root directory (path may vary)
| | |- |
| cd /var/www/html/
| | | User accounts, permissions, groups || '''Alert-to-sensor assignments''' (reconfigure manually) |
| | |- |
| | | Sensor definitions || '''Report-to-sensor assignments''' (reconfigure manually) |
| | |- |
| | | Alert/report definitions || '''Sensor user access permissions''' (reassign manually) |
| | |- |
| | | Dashboards, capture rules, filters || CDR data, PCAP files |
| | |} |
|
| |
|
| # Extract the archive, overwriting existing files
| | {{Note|1=Restore '''replaces''' data, it does NOT merge. Users/sensors with same ID are overwritten.}} |
| tar xzf /var/backups/voipmonitor_gui/config_files-YYYY-MM-DD.tar.gz
| |
| </pre>
| |
|
| |
|
| After restoring both the database and files, your GUI's configuration should be fully recovered.
| | == Dashboard-Only Migration == |
|
| |
|
| === Important: MySQL/MariaDB Version Differences ===
| | To transfer only dashboards between GUI instances without other settings. |
|
| |
|
| {{Warning|'''Database Version Mismatch:''' If you are migrating between servers with MySQL or MariaDB versions that differ significantly, do not use mysqldump directly to restore CDR data.}}
| | === Simple Method (GUI) === |
|
| |
|
| When the old and new servers have different database versions, a direct mysqldump restore may fail or cause compatibility issues. There are two solutions:
| | Use standard '''Backup & restore''' - this transfers dashboards along with other config. Users are included. |
|
| |
|
| ;Solution 1: Use VoipMonitor Migration Instance (Recommended for CDR Migration)
| | === Advanced Method (SQL Extraction) === |
| Instead of using mysqldump directly for the main database:
| |
| 1. Run a VoipMonitor migration instance using `voipmonitor-migrate.conf`
| |
| 2. Configure the migration instance to read from the old database
| |
| 3. Set the migration destination to a temporary backup database on the new server
| |
| 4. After migration completes, run a second migration instance to move data from the temporary database to the final destination database
| |
| 5. This approach handles schema version differences automatically
| |
|
| |
|
| ;Solution 2: Use mysqldump --compatible Option
| | Dashboards are stored in the <code>custom_config</code> table. |
| For smaller databases, you can use mysqldump with compatibility options:
| |
| <pre> | |
| # Example for MySQL 5.7 to 8.0 migration
| |
| mysqldump -u root -p --compatible=mysql57 voipmonitor > backup.sql
| |
| </pre> | |
| However, this method may not work for all schema changes and the migration instance method above is more reliable.
| |
|
| |
|
| These warnings apply primarily to the main CDR database. GUI configuration tables (users, sensors, dashboards) typically have stable schemas that can be migrated directly without issues.
| | <syntaxhighlight lang="bash"> |
| | | # On source server: create backup |
| == Migrating to a New Server (Simple Fresh Installation Method) == | |
| | |
| This method describes the straightforward approach for migrating VoIPmonitor to a new server, which is especially useful when the old server is running an end-of-life (EOL) operating system that cannot be upgraded.
| |
| | |
| === Overview ===
| |
| | |
| When dealing with legacy systems that have kernel compatibility issues or EOL operating systems, the simplest approach is to perform a fresh installation on new hardware and restore your configuration backups. This avoids complex migration procedures and potential compatibility problems.
| |
| | |
| This process involves:
| |
| 1. Backing up GUI configuration tables
| |
| 2. Backing up configuration files
| |
| 3. Installing VoIPmonitor on the new server
| |
| 4. Restoring configuration on the new system
| |
| 5. Testing with a subset of traffic
| |
| | |
| === Step 1: Backup Configuration on Old System ===
| |
| | |
| Before deactivating the old system, create backups of all essential configuration.
| |
| | |
| ;1. Backup GUI Configuration Tables:
| |
| Run the backup command from your GUI installation directory:
| |
| <pre>
| |
| cd /var/www/html | | cd /var/www/html |
| php php/run.php backupGuiTables -t config -f backup.zip | | php php/run.php backupGuiTables -t config -f /tmp/old_config.sql |
| </pre>
| |
|
| |
|
| This command exports all GUI settings including:
| | # Extract only custom_config INSERT statements |
| * User accounts and permissions
| | grep "^INSERT INTO \`custom_config\`" /tmp/old_config.sql > /tmp/dashboards_only.sql |
| * Sensor definitions
| |
| * Capture rules
| |
| * Dashboard configurations
| |
| * Alert definitions
| |
|
| |
|
| ;2. Backup Sniffer Configuration Files:
| | # On target server: import |
| Copy the main configuration file:
| | mysql -u voipmonitor_user -p voipmonitor < /tmp/dashboards_only.sql |
| <pre> | | </syntaxhighlight> |
| cp /etc/voipmonitor.conf /tmp/voipmonitor.conf.backup
| |
| </pre> | |
|
| |
|
| ;3. Backup GUI Configuration File:
| | {{Note|Folder structures are NOT preserved. Recreate folders manually after import.}} |
| <code>configuration.php</code> contains GUI-specific settings. Copy it from your GUI directory:
| |
| <pre>
| |
| cp /var/www/html/voipmonitor/configuration.php /tmp/configuration.php.backup
| |
| # Note: Adjust the path if your GUI is installed in a different location
| |
| </pre>
| |
|
| |
|
| Transfer these backup files to the new server using SCP, FTP, or any other secure method.
| | == Server Migration == |
|
| |
|
| === Step 2: Perform Fresh Installation on New Server === | | === Fresh Installation Method (Recommended) === |
|
| |
|
| On the new server, install VoIPmonitor following the standard installation procedures, using a current supported operating system such as Debian 12 (Bookworm) or Ubuntu 22.04.
| | Best for EOL systems or when historical data is not needed. |
|
| |
|
| Follow the [[Sniffer_installation|Sniffer Installation Guide]] for the sensor component and the [[GUI_installation|GUI Installation Guide]] for the web interface.
| | # '''Backup on old server:''' |
| | #* GUI config: '''Tools → Backup & restore''' → "configuration tables" |
| | #* Sniffer config: <code>cp /etc/voipmonitor.conf /tmp/</code> |
| | #* GUI PHP config: <code>cp /var/www/html/*/configuration.php /tmp/</code> |
| | # '''Fresh install on new server''' (see [[Sniffer_installation]], [[GUI_installation]]) |
| | # '''Restore configuration:''' |
| | #* GUI: '''Tools → Backup & restore''' → "restore" |
| | #* Sniffer: <code>cp voipmonitor.conf.backup /etc/voipmonitor.conf</code> |
| | #* Update <code>interface</code>, <code>spooldir</code>, <code>server_bind</code> for new environment |
| | # '''Update remote probes''' (if distributed): Change <code>server_destination</code> to new server IP |
| | # '''Test with subset of traffic''' before full cutover |
|
| |
|
| === Step 3: Restore Configuration on New Server === | | {{Tip|1=To preserve trial license on new system, use CLI restore with <code>--exclude-table system</code>}} |
|
| |
|
| After completing the fresh installation, restore your configuration files.
| | === Data Migration Method === |
|
| |
|
| ;1. Restore the Sniffer Configuration:
| | For transferring historical CDR data with minimal downtime. See [[Redundant_database]] for: |
| <pre> | | * '''Dump/Restore:''' Simple <code>mysqldump</code> with downtime |
| cp voipmonitor.conf.backup /etc/voipmonitor.conf
| | * '''Online Migration:''' Use <code>voipmonitor-migrate.conf</code> for zero-downtime sync |
| </pre> | |
|
| |
|
| ;2. Restore the GUI Configuration File:
| | === Cross-OS / Cloud Migration === |
| <pre>
| |
| cp configuration.php.backup /var/www/html/voipmonitor/configuration.php
| |
| </pre>
| |
|
| |
|
| ;3. Restore GUI Configuration Tables:
| | {{Warning|1=Do NOT clone binaries between different OS versions. Always perform fresh installation.}} |
| <pre>
| |
| cd /var/www/html
| |
| php php/run.php restoreGuiTables -t config -f backup.zip
| |
| </pre>
| |
|
| |
|
| Alternatively, you can use the web interface:
| | * Download GUI package matching destination PHP version (see [[Re-install_the_GUI]]) |
| 1. Navigate to '''GUI → Tools → Backup & restore'''
| | * For database version mismatches, use migration instance instead of direct mysqldump |
| 2. Select '''restore GUI: configuration tables'''
| |
| 3. Upload the <code>backup.zip</code> file created in Step 1
| |
|
| |
|
| === Step 4: Start and Verify === | | == Cloud Token Migration == |
|
| |
|
| Start the service and verify it is functioning correctly:
| | Each cloud token has its own database. To migrate alerts/reports between tokens: |
| <pre>
| |
| systemctl start voipmonitor
| |
| systemctl status voipmonitor
| |
| </pre>
| |
|
| |
|
| Monitor the logs to ensure the service starts without errors:
| | # '''Contact VoIPmonitor support''' - request temporary trial cloud license |
| <pre> | | # '''Support restores''' old database to temporary license |
| journalctl -u voipmonitor -f
| | # '''Export config''' from temporary license via '''Backup & restore''' |
| </pre> | | # '''Import config''' to new license via '''Backup & restore''' |
| | # '''Restart sniffers:''' <code>systemctl restart voipmonitor</code> |
|
| |
|
| === Step 5: Test with Subset of Traffic ===
| | {{Note|Alert-to-sensor assignments must be reconfigured manually after migration.}} |
|
| |
|
| Before fully migrating or decommissioning the old system:
| | == Troubleshooting == |
|
| |
|
| 1. Configure network capture to monitor a subset of your traffic (using the [[Capture_rules|capture rules]] or by mirroring only specific VLANs/ports)
| | === Backup Fails with "errno 28" (Disk Full) === |
| 2. Verify that calls are appearing in the GUI
| |
| 3. Check for RTP capture issues that were present on the old system
| |
| 4. Play back recorded calls to confirm audio quality
| |
|
| |
|
| Once you are satisfied that the new system is functioning correctly:
| | MySQL needs temp space for backup operations. |
| 1. Expand monitoring to full traffic if needed
| |
| 2. Decommission the old VoIPmonitor installation (stop the service and disable it: <code>systemctl stop voipmonitor && systemctl disable voipmonitor</code>)
| |
|
| |
|
| === When to Use This Method vs voipmonitor-migrate.conf ===
| | '''Solution:''' Use smaller "configuration tables" backup instead of "data tables": |
| | * Configuration tables: ~1-10 MB (contains all essential settings) |
| | * Data tables: 100+ MB (supporting data, not critical) |
|
| |
|
| Use this simple fresh installation method when:
| | Check disk space: <code>df -h</code> (look at <code>/tmp</code> and <code>/var/lib/mysql</code>) |
| * The old server is EOL and cannot be upgraded
| |
| * You do not need to migrate historical data (CDRs or PCAP files)
| |
| * You want a clean start with zero compatibility issues
| |
| * You have network access to the new server for SPAN/mirroring
| |
|
| |
|
| Use the [[#Migrating_VoIPmonitor_to_New_Hardware|complex migration method with voipmonitor-migrate.conf]] when:
| | === Backup Breaks GTID Replication === |
| * You need to transfer large amounts of historical call data
| |
| * You require zero-downtime migration with parallel operation
| |
| * You need to migrate database files to a new storage system
| |
|
| |
|
| == Migrating VoIPmonitor to New Hardware (Data Migration Method) ==
| | mysqldump includes GTID state by default, breaking replication on restore. |
|
| |
|
| This is an advanced method for migrating VoIPmonitor to a new hardware server while transferring existing call data. You use a dedicated migration instance to transfer configuration and data smoothly.
| | '''Solution:''' Configure mysqldump to exclude GTID: |
| | # '''Settings → System Configuration → Database''' |
| | # Set '''Extra parameters for mysqldump binary:''' <code>--set-gtid-purged=OFF</code> |
| | # Save and create new backup |
|
| |
|
| === Overview === | | Or manually: |
| | <syntaxhighlight lang="bash"> |
| | mysqldump -u root -p --set-gtid-purged=OFF voipmonitor users sensors alerts custom_config > backup.sql |
| | </syntaxhighlight> |
|
| |
|
| The migration process involves:
| | === Alerts/Reports Missing After Upgrade === |
| 1. Backing up GUI configuration (must be done BEFORE starting migration)
| |
| 2. Restoring GUI configuration on the new server
| |
| 3. Running a migration instance using `voipmonitor-migrate.conf`
| |
| 4. Optionally running the migration instance in parallel with the original sniffer
| |
|
| |
|
| === Step 1: Prepare for Migration ===
| | Restore from backup created before upgrade: |
| | # '''Tools → Backup & restore''' → "restore" → upload pre-upgrade backup |
| | # Reconfigure alert-to-sensor assignments manually |
|
| |
|
| First, create a backup of all GUI configuration on the OLD server:
| | == See Also == |
|
| |
|
| 1. On the old GUI, navigate to '''GUI → Tools → Backup & restore'''
| | * [[Redundant_database]] - Database replication and online migration |
| 2. Select ''':backup GUI: configuration tables''' to back up all database settings (users, sensors, capture rules, dashboards, etc.)
| | * [[Re-install_the_GUI]] - GUI reinstallation for PHP version changes |
| 3. Download the generated backup file
| | * [[Disaster_Recovery]] - Complete disaster recovery procedures |
| | * [[Data_Cleaning]] - Disk space management |
|
| |
|
| === Step 2: Restore Configuration on New Hardware === | | == AI Summary for RAG == |
| | |
| On the NEW server:
| |
| | |
| 1. Install VoIPmonitor Sniffer and GUI following the standard installation guide
| |
| 2. Restore the GUI configuration backup:
| |
| * Navigate to '''GUI → Tools → Backup & restore'''
| |
| * Select ''':restore GUI: configuration tables'''
| |
| * Upload and select the backup file created from the old server
| |
| | |
| === Step 3: Create voipmonitor-migrate.conf ===
| |
| | |
| The migration configuration file is a copy of your original `voipmonitor.conf` with migration-specific options added.
| |
| | |
| ;Create the migration configuration file:
| |
| <pre>
| |
| cp /etc/voipmonitor.conf /etc/voipmonitor-migrate.conf
| |
| </pre>
| |
| | |
| {{Warning|You must complete the GUI backup and restore procedure BEFORE starting the migration instance. Do not skip steps 1-2.}}
| |
| | |
| === Step 4: Configure Parallel Operation (Optional) ===
| |
| | |
| If you need to run the migration instance while the original sniffer is still active (for zero-downtime migration):
| |
| | |
| 1. Edit `voipmonitor-migrate.conf` and modify these settings to avoid conflicts:
| |
| <pre>
| |
| # Change the manager port to avoid conflicts with the original sniffer
| |
| # Default managerport is 6001, choose a different port (e.g., 6002)
| |
| managerport = 6002
| |
| | |
| # IMPORTANT: Comment out or disable ALL bind* options
| |
| # These bind to network interfaces and will cause conflicts if both instances are active
| |
| #bind = 0.0.0.0:5060
| |
| #bindbindip = 0.0.0.0
| |
| #bindbindport = 5061
| |
| #bindtlsbindport = 5062
| |
| </pre>
| |
| | |
| 2. Ensure other paths (spooldir, pcapdir, etc.) point to appropriate locations on the new hardware
| |
| | |
| === Step 5: Run Migration Instance ===
| |
| | |
| Once configuration is restored and the migration config is prepared, start the migration instance:
| |
| | |
| <pre>
| |
| # Start the migration instance
| |
| voipmonitor --voipmonitor-config /etc/voipmonitor-migrate.conf
| |
|
| |
|
| # Or using systemd (if configured)
| | '''Summary:''' VoIPmonitor GUI configuration backup guide. Two methods: (1) GUI via '''Tools → Backup & restore''' for one-time backups, (2) CLI using <code>backupGuiTables</code>/<code>restoreGuiTables</code> commands with cron for automation. Backup includes users, sensors, alerts, dashboards, capture rules. Does NOT include: alert-to-sensor assignments, report-to-sensor assignments, CDR/PCAP data. Restore overwrites existing data. Dashboard-only migration: extract <code>custom_config</code> table. Server migration: fresh install recommended for EOL systems; use [[Redundant_database]] for data migration. Cloud token migration requires support intervention to restore old database to temporary license. Troubleshooting: errno 28 (disk full) - use smaller "configuration tables" backup; GTID replication - set <code>--set-gtid-purged=OFF</code> in mysqldump parameters. |
| systemctl start voipmonitor- migrate.service
| |
| </pre> | |
|
| |
|
| The migration instance will process and migrate data using the restored configuration while avoiding conflicts with any running original sniffer.
| | '''Keywords:''' backup, restore, configuration, GUI settings, users, sensors, alerts, dashboards, capture rules, backupGuiTables, restoreGuiTables, custom_config, cron automation, migration, disaster recovery, cloud token, GTID replication, errno 28, disk full |
|
| |
|
| {{Note|After migration is complete, you can switch over to the new hardware by starting the standard voipmonitor service with the main `voipmonitor.conf` configuration file.}}
| |
|
| |
| == AI Summary for RAG ==
| |
| '''Summary:''' This guide provides comprehensive guidance on backing up the VoIPmonitor GUI configuration using two methods: a quick web interface method for one-time backups before upgrades, and an automated CLI script method for scheduled daily backups. The web interface method accessed via '''GUI → Tools → Backup & restore''' allows users to select "configuration tables" (backing up all database settings made by GUI users including users, sensors, capture rules, alerts, dashboards, reports) and "configuration files" (backing up GUI configuration files like configuration.php). The CLI script method uses the `run.php` command-line tool to export configuration tables, data tables, and PHP configuration files, with automatic cleanup of old backups. The guide details creating the backup script, scheduling it with cron for Automated daily backups at 3:30 AM, and includes restoration methods using both the GUI web interface and CLI commands (`restoreGuiTables`, `mysql` import). Critical restoration information specifies what IS transferred (user accounts, permissions, sensor definitions, alert definitions, filters, dashboards) and what is NOT transferred (assignments of alerts to sensors, reports to sensors, sensor user access permissions, captured call data and PCAP files). The restore operation overwrites, not merges, existing data. The guide also covers a specialized procedure for importing only dashboards from one GUI instance to another by extracting and importing the `custom_config` table, noting that folder structures are not preserved and ownership may need adjustment. Troubleshooting guidance is included for scenarios where alerts disappear after upgrades (restore configuration tables via GUI). Additionally, the guide now includes a complete '''simple migration procedure''' for EOL systems: (1) backup GUI config using `php php/run.php backupGuiTables -t config -f backup.zip`, (2) backup `/etc/voipmonitor.conf` and `configuration.php`, (3) fresh install on new server with modern OS (Debian 12/Ubuntu 22.04), (4) restore all configurations on new system, (5) test with subset of traffic before full migration. This simple method is recommended for EOL OS when you do not need historical data migrated. A separate '''complex migration method with voipmonitor-migrate.conf''' is documented for scenarios requiring historical data transfer or zero-downtime migration, covering GUI backup/restore, creating `voipmonitor-migrate.conf`, and configuring parallel operation by changing `managerport` and disabling ALL `bind*` options. A new '''critical warning section on MySQL/MariaDB version differences''' explains that when migrating between servers with significantly different database versions, do not use mysqldump directly for the main CDR database. Instead, use a VoipMonitor migration instance with `voipmonitor-migrate.conf` to migrate via a temporary backup database on the new server (two-step process: old server to temporary DB, then temporary DB to final DB), which handles schema version differences automatically. GUI configuration tables typically have stable schemas and can be migrated directly without issues. As an alternative for smaller databases, mysqldump can be used with the `--compatible` option (e.g., `--compatible=mysql57` for MySQL 5.7 to 8.0 migration), though this may not work for all schema changes.
| |
| '''Keywords:''' backup, restore, configuration, gui, settings, users, sensors, capture rules, cron, crontab, automation, disaster recovery, dashboard, migration, upgrade, `run.php`, `backupGuiTables`, `restoreGuiTables`, `backupGuiConfigurationFiles`, mysql, import, export, custom_config, overwrite, merge, assignment, not transferred, web interface, tools menu, quick backup, EOL, end-of-life, fresh installation, new server, `/etc/voipmonitor.conf`, `configuration.php`, Debian 12, Bookworm, Ubuntu 22.04, subset traffic, hardware migration, `voipmonitor-migrate.conf`, migration instance, parallel operation, `managerport`, `bind* options`, conflicts, mysql version, mariadb version, database version, version mismatch, `--compatible`, temporary database, schema differences, CDR migration
| |
| '''Key Questions:''' | | '''Key Questions:''' |
| * How do I back up my VoIPmonitor GUI before an upgrade? | | * How do I back up VoIPmonitor GUI configuration? |
| * How do I back up GUI settings using the web interface? | | * How do I schedule automated daily GUI backups? |
| * How do I migrate VoIPmonitor to new hardware? | | * How do I restore GUI settings from backup? |
| * How do I migrate VoIPmonitor from an EOL operating system?
| | * What is and is not included in a GUI configuration backup? |
| * How do I perform a fresh installation migration to a new server?
| | * Does restore merge or overwrite existing data? |
| * What files do I need to backup when migrating VoIPmonitor?
| | * How do I migrate only dashboards between GUI instances? |
| * How do I restore voipmonitor.conf and configuration.php on a new server?
| | * How do I migrate VoIPmonitor to a new server? |
| * How do I backup GUI configuration using backupGuiTables?
| | * How do I transfer alerts between cloud tokens? |
| * How do I test new VoIPmonitor installation with subset of traffic?
| | * Why does backup fail with errno 28? |
| * When should I use simple fresh installation migration vs voipmonitor-migrate.conf?
| | * How do I prevent backups from breaking MySQL GTID replication? |
| * What is the voipmonitor-migrate.conf file? | |
| * How do I run VoIPmonitor migration in parallel with the original sniffer?
| |
| * How do I configure voipmonitor-migrate.conf to avoid conflicts?
| |
| * What managerport should I use for migration instance?
| |
| * Do I need to change bind* options when running migration instance?
| |
| * When should I backup GUI configuration before migration?
| |
| * Can I run original sniffer and migration instance simultaneously?
| |
| * Where is the backup and restore menu in the GUI?
| |
| * What do "configuration tables" contain in the GUI backup?
| |
| * What do "configuration files" contain in the GUI backup?
| |
| * How can I save all my users, sensors, and settings?
| |
| * Is there a script to automatically back up VoIPmonitor settings?
| |
| * How do I schedule a daily backup using cron?
| |
| * How do I restore my GUI configuration from a backup?
| |
| * What does the `backupGuiTables` command do?
| |
| * What does the `restoreGuiTables` command do?
| |
| * Does this backup include my call recordings (CDRs/PCAPs)? | |
| * If alerts disappear after an upgrade, how do I restore them?
| |
| * How do I import only dashboards from one GUI to another without importing sensors or filters? | |
| * Which table contains dashboard configurations in VoIPmonitor?
| |
| * How do I extract only the custom_config table from a GUI backup? | |
| * Are sensor assignments preserved during restore?
| |
| * Do I need to reconfigure alert to sensor assignments after migration?
| |
| * Does the restore merge or overwrite existing data?
| |
| * Can I transfer user accounts to a new VoIPmonitor instance?
| |
| * How do I migrate VoIPmonitor when MySQL versions differ between servers? | |
| * What should I do if database versions are different during migration? | |
| * Can I use mysqldump when migrating between different MySQL versions?
| |
| * How do I use voipmonitor-migrate.conf for database version migration? | |
| * What is the temporary database migration method?
| |
| * Do I need to migrate GUI config differently when MySQL versions differ?
| |
| * Can I use mysqldump --compatible for database migration?
| |