Must-gather Parser, Analyzer & Comparator Tool
M-PACT is a Python-based tool designed to analyze and compare OpenShift must-gather archives. It extracts, parses, and presents critical cluster information in a structured and readable format, making it easier to troubleshoot OpenShift clusters and compare configurations across different environments.
-
π Comprehensive Analysis: Extracts and analyzes key cluster information including:
- Cluster version and update status
- Network configuration (SDN/OVN)
- Node information and resource allocation
- Machine config pools
- Infrastructure configuration
- OLM operators and ClusterServiceVersions
- Persistent volumes and volume attachments
- Metrics data
- Monitoring stack information
-
π Structured Output: Presents data in formatted tables for easy reading
-
π Comparison Mode: Compare two must-gather archives side-by-side to identify differences
-
β‘ Performance Optimized: Optimized file filtering to process large archives efficiently
-
π¦ Multiple Format Support: Works with
.tar.gz,.tgz,.ziparchives, or uncompressed directories -
π― Flexible Usage: Interactive mode or command-line mode for automation
- Python 3.8 or higher
- Required packages (see
requirements.txt):- pandas >= 2.0.0
- tabulate >= 0.9.0
- PyYAML >= 6.0.0
-
Clone the repository:
git clone https://github.com/joseorpa/M-PACT.git cd M-PACT -
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
On Linux/macOS:
source venv/bin/activateOn Windows:
venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Verify installation:
python3 m-pact.py --help
If you prefer not to use a virtual environment:
pip install -r requirements.txtSimply run the script without arguments to enter interactive mode:
python3 m-pact.pyThe tool will prompt you for:
- Path to the must-gather archive or directory
- Configuration options
Analyze a compressed archive:
python3 m-pact.py -f /path/to/must-gather.tar.gzAnalyze a ZIP archive:
python3 m-pact.py -f /path/to/must-gather.zipAnalyze an uncompressed directory:
python3 m-pact.py -f /path/to/must-gather-directory/Compare two compressed archives:
python3 m-pact.py -c must-gather-before.tar.gz must-gather-after.tar.gzCompare two directories:
python3 m-pact.py -c must-gather-dir1/ must-gather-dir2/Mix archive and directory:
python3 m-pact.py -c must-gather.tar.gz must-gather-dir/| Option | Description |
|---|---|
-f, --file <path> |
Path to must-gather archive or directory to analyze |
-c, --compare <source1> <source2> |
Compare two must-gather sources |
--no-optimizations |
Disable performance optimizations (process all files) |
-h, --help |
Show help message and exit |
M-PACT extracts and presents the following information from must-gather archives:
- OpenShift version
- Kubernetes version
- Update channel and available updates
- Cluster operators status
- Cluster conditions
- Network type (OpenShift SDN or OVN-Kubernetes)
- Cluster network CIDR
- Service network CIDR
- Host prefix
- Network MTU
- Plugin-specific configuration
- Node count and status
- CPU and memory allocations
- Instance types
- Operating system details
- Kernel versions
- Reserved resources percentage
- Master and worker pool status
- Configuration versions
- Machine counts
- Update status
- Platform type (AWS, Azure, GCP, bare metal, etc.)
- Platform-specific configuration
- API server URLs
- Installed operators
- ClusterServiceVersions (CSVs)
- Operator versions and phases
- OLM configuration
- Operator groups
- Persistent Volumes (PVs)
- Volume Attachments
- Storage classes
- Volume status and capacity
- Prometheus configuration
- Alertmanager status
- etcd health information
- Key metrics data
When analyzing a must-gather archive, you'll see output like:
OpenShift Archive Analyzer
==================================================
Starting analysis of /path/to/must-gather.tar.gz
π Archive type detection: Detected must-gather archive (found 5 must-gather indicators)
β‘ Performance optimizations enabled for must-gather archive
Found 15234 files in tar.gz archive
π Pre-filtering: 487 candidates from 15,234 files (3.2% efficiency)
==================================================
CLUSTER VERSION
==================================================
OpenShift Version: 4.14.8
Kubernetes Version: v1.27.8+4fab27b
...
==================================================
NODES SUMMARY
==================================================
βββββββββββββββ¬βββββββββββββ¬ββββββββββββββββ¬ββββββββββββββββ¬ββββββββββ
β Node Name β CPU Alloc β Memory Alloc β Instance Type β Status β
βββββββββββββββΌβββββββββββββΌββββββββββββββββΌββββββββββββββββΌββββββββββ€
β master-0 β 8 cores β 32Gi β m5.2xlarge β Ready β
β worker-0 β 16 cores β 64Gi β m5.4xlarge β Ready β
βββββββββββββββ΄βββββββββββββ΄ββββββββββββββββ΄ββββββββββββββββ΄ββββββββββ
...
- Use optimizations (default): The tool filters files to focus on relevant data
- Disable optimizations only when needed: Use
--no-optimizationsif you need to examine all files - For large archives: The optimization can reduce processing time from minutes to seconds
When comparing two must-gather archives, M-PACT will:
- Analyze both archives independently
- Identify differences in:
- Cluster versions
- Node configurations
- Operator installations
- Network settings
- And more...
This is particularly useful for:
- Before/after upgrade comparisons
- Troubleshooting configuration drift
- Validating cluster changes
- Comparing production vs. staging environments
If you see import errors:
pip install -r requirements.txtMake sure the script is executable:
chmod +x m-pact.pyEnsure your must-gather archive contains standard OpenShift must-gather directory structures. The tool looks for:
cluster-scoped-resources/namespaces/monitoring/- Other must-gather specific directories
Contributions are welcome! Please feel free to submit issues or pull requests.
See the LICENSE file for details.
Note: This tool is designed specifically for OpenShift must-gather archives. For best results, use must-gather archives generated with:
oc adm must-gather