A bash script that analyzes Juju Magpie network connectivity status and generates human-readable reports to identify network communication issues between machines.
This tool processes JSON output from juju status --format json for deployments using the Magpie charm, which tests network connectivity between Juju machines across different network spaces. It identifies which machines cannot communicate with others and provides actionable insights for network troubleshooting.
- Machine Inventory: Lists all machines with hostnames, IP addresses, and availability zones
- Network Space Analysis: Shows health status of each network space (oam, internal, ceph-access, etc.)
- Machine-Focused Summary: Identifies critical machines with widespread connectivity issues
- Connectivity Matrix: Detailed ICMP and DNS failure analysis between machines
- MTU Information: Shows required MTU settings for each network space
- Color-coded Output: Uses colors to highlight critical issues, warnings, and healthy status
jq- JSON processor for parsing Juju status outputbash4.0+ - For associative arrays and modern bash features
-
Clone this repository or download the script:
chmod +x network-doctor.sh
-
Install
jqif not already available:# Ubuntu/Debian sudo apt install jq
The script can read Juju status data from stdin or from a file:
juju status --format json | ./network-doctor.shjuju status --format json > juju-status.json
./network-doctor.sh juju-status.json==========================================
JUJU MAGPIE NETWORK REPORT
==========================================
Model: magpie
Total Machines: 5
Total Magpie Applications: 6
MACHINE INVENTORY:
==================
0: node-01 (node-01) - 10.0.1.10 - Zone: zone3
1: node-02 (node-02) - 10.0.1.11 - Zone: zone2
2: node-03 (node-03) - 10.0.1.12 - Zone: zone1
3: node-04 (node-04) - 10.0.1.13 - Zone: zone1
4: node-05 (node-05) - 10.0.1.14 - Zone: zone3
NETWORK SPACE ANALYSIS:
======================
oam-space: ✓ HEALTHY
ceph-access-space: ✗ ISSUES DETECTED
internal-space: ✗ ISSUES DETECTED
...
MACHINE-FOCUSED SUMMARY:
=======================
Machine 2 (node-03) - CRITICAL:
├── Cannot reach other machines on:
│ ├── ceph-access-space (MTU 9000)
│ ├── ceph-replica-space (MTU 9000)
│ ├── internal-space (MTU 1500)
│ ├── provider-space (MTU 9000)
│ └── public-space (MTU 9000)
└── DNS resolution failing for multiple machines
- ✓ HEALTHY: Network space has no connectivity issues
- ✗ ISSUES DETECTED: Network space has blocking connectivity problems
- ⚠ WARNING: Network space has non-blocking issues
- CRITICAL: Machine has connectivity issues on 4+ network spaces
- ISSUES: Machine has problems on fewer network spaces
- ICMP failures:
0/20 packets receivedindicates packet loss between machines - DNS resolution failures:
rev dns failedshows reverse DNS lookup problems - MTU mismatches: Required vs actual MTU settings
Common Juju network spaces tested by Magpie:
- oam-space: Operations, Administration, and Maintenance (MTU 1500)
- internal-space: Internal service communication (MTU 1500)
- ceph-access-space: Ceph client access network (MTU 9000)
- ceph-replica-space: Ceph replication network (MTU 9000)
- public-space: Public API endpoints (MTU 9000)
- provider-space: Provider network for external access (MTU 9000)
Network Doctor is designed to help with Canonical/Juju network diagnostics. Contributions are welcome for:
- Additional network issue detection patterns
- Better output formatting
- Support for additional network spaces
- Performance improvements
This tool is provided as-is for network diagnostics and troubleshooting purposes.