A modern Terminal User Interface (TUI) for continuously monitoring Red Hat support case status across multiple accounts using the Red Hat Customer Portal API. Available in both Python and pure Bash implementations.
This TUI application retrieves and displays real-time support case data for multiple Red Hat accounts, filtering by case status ("Waiting on Customer" or "Waiting on Red Hat"). It provides an interactive, color-coded dashboard that auto-refreshes at configurable intervals, using OAuth 2.0 authentication via Red Hat's Single Sign-On service.
- Multi-account monitoring: Track cases across multiple Red Hat customer accounts
- Status filtering: Focus on active cases waiting for customer or Red Hat response
- Auto-refresh: Continuously poll case data at configurable intervals (default: 15 minutes)
- OAuth 2.0 authentication: Secure token-based authentication using offline tokens with auto-refresh
- Account labeling: Display friendly names for account numbers
- Live dashboard: Real-time updates without screen flicker
- Color-coded status: Visual indicators for case priority and status
- 🔴 Red: Waiting on Red Hat (needs attention)
- 🟡 Yellow: Waiting on Customer
- Severity highlighting: Urgent/High/Normal/Low with color coding
- Summary statistics: Quick overview of total cases and status breakdown
- Keyboard shortcuts: Press 'Q' to quit, Ctrl+C for emergency exit
- Resize handling: Adapts to terminal size changes without losing data
python3(version 3.8 or higher)pip3- Python package managercurl- for API requests (used internally by requests library)
rich>=13.0.0- Terminal UI frameworkrequests>=2.31.0- HTTP library for API callsPyYAML>=6.0- YAML configuration file parsing
Install Python dependencies:
# Standard installation
pip3 install rich requests PyYAML
# Or using requirements.txt
pip3 install -r requirements.txt
# For managed devices (see Managed Devices section)
python3 -m venv .venv
source .venv/bin/activate
pip install rich requests PyYAML- Active Red Hat Customer Portal account
- Appropriate permissions for the accounts you want to monitor
- API access enabled for your user account
- Visit the Red Hat API Tokens page
- Log in with your Red Hat Customer Portal credentials
- Click Generate Token
- Copy the generated offline token
- Store it securely in an environment variable or file
# Store in environment variable (recommended)
export REDHAT_OFFLINE_TOKEN="YOUR_OFFLINE_TOKEN_HERE"
# Or save in a secure file
echo "YOUR_OFFLINE_TOKEN_HERE" > ~/.rhcp-token
chmod 600 ~/.rhcp-token # Restrict file permissionsSecurity Warning: Treat your offline token like a password. Never commit it to version control or share it publicly. The token provides API access to your Red Hat account data.
Create a YAML configuration file with your account numbers and friendly names:
accounts.yaml:
accounts:
- id: "1234567"
name: "Production Account"
- id: "7654321"
name: "Development Account"
- id: "9876543"
name: "Test Account"Use the provided example as a template:
cp accounts.example.yaml accounts.yaml
# Edit with your account detailsThe default refresh interval is 15 minutes. To change it, edit the script:
Python version:
app = CaseMonitorTUI(accounts_file, offline_token, refresh_minutes=15)Note: Be mindful of API rate limits. Red Hat recommends reasonable polling intervals to avoid throttling.
# Run the installation script
./install.shThis will:
- Check Python version
- Install dependencies
- Make scripts executable
- Create example configuration
-
Download the files
-
Install Python dependencies
Important: Use pip, NOT pipx. pipx installs in isolated environments and won't work for this script.
pip3 install rich requests PyYAML- Make the script executable
chmod +x rhcp-get-cases.pyManaged devices often restrict system-wide package installation. Use a virtual environment:
# 1. Create virtual environment
python3 -m venv .venv
# 2. Activate it
source .venv/bin/activate
# 3. Install packages
pip install rich requests PyYAML
# 4. Run the script
python rhcp-get-cases.py accounts.yaml "$REDHAT_OFFLINE_TOKEN"
# 5. Deactivate when done
deactivate# Using environment variable (recommended)
export REDHAT_OFFLINE_TOKEN="your-token-here"
./rhcp-get-cases.py accounts.yaml "$REDHAT_OFFLINE_TOKEN"
# Using token file
./rhcp-get-cases.py accounts.yaml "$(cat ~/.rhcp-token)"Add to your ~/.bashrc or ~/.zshrc:
export REDHAT_OFFLINE_TOKEN="your-token-here"
alias rhcases='python3 ~/path/to/rhcp-get-cases.py ~/path/to/accounts.yaml "$REDHAT_OFFLINE_TOKEN"'Then simply run:
rhcasesWhile the TUI is running:
- Q or q - Quit the application gracefully
- Ctrl+C - Emergency exit
- Token Exchange: The script exchanges your offline token for a short-lived access token (valid for ~5 minutes)
- API Request: The access token is used to authenticate API requests
- Token Caching: Access token is cached and reused until it expires
- Auto-renewal: New tokens are obtained automatically when needed
Offline Token → SSO Endpoint → Access Token (cached) → API Call → Case Data
↓
Auto-refresh on expiry
- Token endpoint:
https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token - Cases filter endpoint:
https://api.access.redhat.com/support/v1/cases/filter
The application filters cases using the following payload:
{
"accountNumber": "ACCOUNT_NUMBER",
"statuses": ["Waiting on Customer", "Waiting on Red Hat"]
}╔═══════════════════════════════════════════════════════════╗
║ RED HAT CASES MONITOR ║
╚═══════════════════════════════════════════════════════════╝
Last Update: 2026-02-01 14:30:45 | Next refresh in: 234s
╔══ SUMMARY ══╗
║ Total: 12 | On RH: 5 | On Customer: 7 ║
╚═════════════╝
┌─ Production Account (1234567) - 5 case(s) ───────────────┐
│ CASE │ SUMMARY │ SEVERITY │ STATUS │
├────────────┼────────────────────────────┼──────────┼─────────────────────┤
│ 0123456 │ Critical system down │ Urgent │ Waiting on Red Hat │
│ 0123457 │ Performance degradation │ High │ Waiting on Customer │
│ 0123458 │ Minor configuration issue │ Low │ Waiting on Customer │
└──────────────────────────────────────────────────────────────────────────┘
╔═══════════════════════════════════════════════════════════╗
║ Shortcuts: [Q] Quit | [Ctrl+C] Exit ║
╚═══════════════════════════════════════════════════════════╝
-
Status Colors:
- 🔴 Red - Waiting on Red Hat (needs immediate attention)
- 🟡 Yellow - Waiting on Customer
-
Severity Colors:
- Urgent: Bold Red
- High: Red
- Normal: Yellow
- Low: Green
- Documentation: Customer Portal Integration Guide
- API Catalog: Red Hat API Catalog - Case Management
- Getting Started: Getting Started with Red Hat APIs
Filter cases by status:
curl -X POST \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"accountNumber": "123456", "statuses": ["Waiting on Customer"]}' \
https://api.access.redhat.com/support/v1/cases/filterGet specific case:
curl -H "Authorization: Bearer $ACCESS_TOKEN" \
https://api.access.redhat.com/support/v1/cases/{case_number}Common Red Hat support case statuses:
Waiting on Customer- Red Hat needs information from youWaiting on Red Hat- Case is being worked on by Red HatClosed- Case has been resolvedClosed with Notification- Case closed with automated notification
- Never hardcode tokens in scripts or version control
- Use environment variables for storing tokens (recommended)
- Restrict file permissions:
chmod 600for token files - Rotate tokens periodically via the Red Hat portal
- Monitor token usage for suspicious activity
# Good: Using environment variable
export REDHAT_OFFLINE_TOKEN="token"
./rhcp-get-cases.py accounts.yaml "$REDHAT_OFFLINE_TOKEN"
# Good: Using secure file
chmod 600 ~/.rhcp-token
./rhcp-get-cases.py accounts.yaml "$(cat ~/.rhcp-token)"
# Bad: Hardcoded in script or command history
./rhcp-get-cases.py accounts.yaml "eyJh..." # DON'T DO THIS- Restrict permissions on
accounts.yamlif it contains sensitive data - Use
.gitignoreto exclude token files and sensitive configs - Consider encrypting configuration files with sensitive data
- Scripts use HTTPS for all API communications
- Tokens are passed in HTTP headers, not URLs
- Terminal settings are properly restored on exit
- Error messages don't expose token data
- All API communications use TLS/HTTPS
- No sensitive data logged to disk by default
- Consider running on secure, trusted networks
"Failed to obtain access token"
- Verify your offline token is valid and not expired
- Check token format (should start with
eyJh...) - Regenerate token at the Red Hat portal if needed
- Ensure no extra whitespace or newlines in token
# Test your token
curl -s -X POST \
"https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token" \
-d "grant_type=refresh_token" \
-d "refresh_token=$REDHAT_OFFLINE_TOKEN" \
-d "client_id=rhsm-api" | jq ."ModuleNotFoundError: No module named 'rich'"
Cause: You installed packages with pipx instead of pip, or you're on a managed device.
Solutions:
# Solution 1: Use regular pip (not pipx)
pip3 install rich requests PyYAML
# Solution 2: Use virtual environment (managed devices)
python3 -m venv .venv
source .venv/bin/activate
pip install rich requests PyYAMLSee TROUBLESHOOTING.md for detailed solutions.
403 Forbidden
- Verify account permissions
- Check that your user has API access enabled
- Ensure account numbers in
accounts.yamlare correct - Confirm you have access to the specified accounts
429 Too Many Requests
- Increase refresh interval (reduce polling frequency)
- Default is 15 minutes; consider increasing to 30 minutes
- Check Red Hat's rate limiting policies
Empty tables but cases count > 0
- This was a bug in v1.0, fixed in v1.1
- Update to the latest version
- If still occurring, run diagnostic:
python3 diagnostic.py accounts.yaml TOKEN
Cases disappear when resizing terminal
- This was a bug in v1.0, fixed in v1.1
- Update to the latest version
- Ensure you're using fixed-width columns version
Terminal looks garbled or broken
- Ensure terminal supports UTF-8 encoding
- Use a modern terminal emulator (iTerm2, Alacritty, Windows Terminal)
- Increase terminal window size (minimum 80x24 recommended)
- Try running:
resetto reset terminal state
Colors not working
- Check if terminal supports colors:
tput colors - Should return 8 or 256
- Update terminal emulator if needed
"Permission denied"
chmod +x rhcp-get-cases.pyWe welcome contributions! Here's how you can help:
- Check existing issues before creating new ones
- Include version number, OS, and error messages
- Provide steps to reproduce problems
- Run diagnostic tools and include output
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Make your changes
- Test thoroughly with your Red Hat account
- Commit with clear messages
- Submit a pull request
- Test with multiple accounts if possible
- Verify error handling works correctly
- Check terminal resize behavior
- Test keyboard shortcuts
- Ensure backward compatibility
- Test on different terminal emulators
- Python: Follow PEP 8 guidelines
- Bash: Use ShellCheck for linting
- Add comments for complex logic
- Update documentation for new features
Modify check_keyboard_input() in Python version:
def check_keyboard_input(self):
# ... existing code ...
if char.lower() == 'r':
self.fetch_all_cases() # Manual refresh
elif char.lower() == 'h':
self.show_help() # Show help screenModify the API payload:
payload = {
"accountNumber": account_number,
"statuses": ["Waiting on Customer", "Waiting on Red Hat"],
"severity": "High" # Add severity filter
}Example email notification on status change:
if new_waiting_on_rh > old_waiting_on_rh:
import smtplib
# Send email alertEdit the color mapping in create_account_table():
severity_style = {
"Urgent": "bold magenta", # Change colors
"High": "red",
"Normal": "yellow",
"Low": "cyan"
}.get(case.severity, "white")This project is licensed under the MIT License - see the LICENSE file for details.
- Getting Started with Red Hat APIs
- Customer Portal Integration Guide
- Subscription Management API Documentation
- API Tokens Management
- Rich - Python TUI Framework
- jq - JSON Processor
- ShellCheck - Shell Script Analysis
- Python Requests Documentation
This tool is not officially supported by Red Hat, but you can:
- Open GitHub issues for bugs or feature requests
- Contact Red Hat support for API-related issues
- Visit Red Hat Customer Portal: https://access.redhat.com
- Added keyboard shortcut support (press 'Q' to quit)
- Added footer bar with shortcuts display
- Improved user experience with graceful shutdown
- Fixed terminal resize bug causing cases to disappear
- Fixed missing cases in detail tables
- Added explicit column widths for consistent display
- Improved table rendering performance
- Added case count to table titles
- Initial release
- Multi-account support
- Auto-refresh functionality
- Color-coded status display
- Python and Bash implementations
- OAuth 2.0 token management
- Red Hat for providing comprehensive API documentation and developer resources
- The Textualize team for the excellent Rich library
- The open-source community for shell scripting best practices and tools
Note: This is an unofficial tool created for convenience and is not officially supported by Red Hat. For official support tools and comprehensive case management, visit the Red Hat Customer Portal.
For detailed documentation: