This project provides automated scripts to load and maintain Superset dashboards on Ubuntu 22.04 systems. It's specifically designed for office environments where dashboards need to be displayed continuously on screens, with automatic recovery from power cuts and browser issues.
- Automatic dashboard loading at system startup
- Continuous monitoring and auto-recovery
- Handles network connectivity issues
- Automatic browser cache cleaning
- Detailed logging system
- Power failure recovery
- Browser crash recovery
- Ubuntu 22.04
- Python 3
- Chromium Browser
- Selenium WebDriver
- Cron (usually pre-installed on Ubuntu)
- Install required packages:
sudo apt update
sudo apt install python3-pip chromium-browser
sudo apt install chromium-chromedriver
pip3 install selenium
- Clone the repository:
git clone [your-repository-url]
cd [repository-name]
- Create a credentials.txt file in the project directory with the following format:
<superset_url> #This is the url of a specific dashboard not the login page.
<username>
<password>
<dashboard_title>
- Make Setup Bash script executable and run it. It will make open_dashboard executable and run it too.:
chmod +x setup_dashboard.sh
./setup_dashboard.sh
open_dashboard/
├── open_dashboard.py # Main Python script for dashboard loading
├── open_dashboard.sh # Bash script for continuous monitoring
├── setup_dashboard.sh # Installation and setup script
├── credentials.txt # Credentials file (not tracked in git)
├── bashscript_log.txt
├── python_log.txt
└── cron_reboot.log
The project inludes a second python script "open_dashboard2.py" which can be used in place of "open_dashboard.py" if needed. To do so, copy the contents of "open_dashboard2.py" to "open_dashboard.py" or change the name "open_dashboard.py" to "open_dashboard2.py" in line 8 of the bash script "open_dashboard.sh"
- At system startup, the cron job launches
open_dashboard.sh
- The bash script monitors network connectivity and launches the Python script
- The Python script:
- Logs into Superset
- Loads the specified dashboard
- Applies necessary filters
- Sets up auto-refresh
- Monitors for issues
To stop the dashboard display temporarily:
- Find the process IDs:
pgrep -f "open_dashboard.py"
pgrep -f "open_dashboard.sh"
- Kill the processes:
pkill -f "open_dashboard.py"
pkill -f "open_dashboard.sh"
To prevent the script from starting at next reboot:
crontab -e
# Comment out or remove the line containing "open_dashboard.sh"
The script maintains three log files:
bashscript_log.txt
: Monitors the bash script executionpython_log.txt
: Tracks Python script activities and errorscron_reboot.log
: Logs cron job execution at startup
Monitor logs in real-time:
tail -f bashscript_log.txt python_log.txt cron_reboot.log
When performing maintenance:
- Stop the scripts using the commands in the "Stopping the Script" section
- Perform your maintenance tasks
- To restart:
Or reboot the system
./open_dashboard.sh &
-
Blank Screen Issues:
- Check network connectivity
- Verify credentials in credentials.txt
- Check logs for specific errors
-
Script Not Starting:
- Verify crontab entry:
crontab -l
- Check file permissions
- Review cron_reboot.log
- Verify crontab entry:
-
Dashboard Not Updating:
- Check Python logs for timeout errors
- Verify network stability
- Check Superset server status
The credentials.txt
file contains sensitive information. Ensure to:
- Add it to
.gitignore
- Set appropriate file permissions
- Limit access to the project directory
Feel free to submit issues and enhancement requests!
Apache Version 2.0