How to Set Up a Cool Dashboard on Your Raspberry Pi

How to Set Up a Cool Dashboard on Your Raspberry Pi

Pi Dashboard is an open-source IoT device monitoring tool released by the Raspberry Pi Laboratory, currently mainly targeting the Raspberry Pi platform while also being compatible with other Raspberry Pi-like hardware products. You only need to set up a PHP server environment on your Raspberry Pi to easily deploy a Pi Dashboard and monitor the status of your Raspberry Pi through a cool WebUI!

Currently included monitoring projects are:

  • Real-time data of CPU basic information, status, and usage rate

  • Real-time data of memory, cache, and SWAP partition usage

  • SD card (disk) usage

  • Real-time load data

  • Implementation process data

  • Real-time data of network interfaces

  • Basic information such as Raspberry Pi IP, uptime, operating system, HOST, etc.

Project homepage: http://maker.quwj.com/project/10GitHub address: https://github.com/spoonysonny/pi-dashboard

Video Preview

Installation Method

There are 2 steps to install: first install Nginx (or Apache) and PHP. Then deploy this project’s program in the Nginx directory via SFTP or GitHub.

1. Install Nginx and PHP

Run the following command in the Pi terminal.

sudo apt-get update
sudo apt-get install nginx php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-cgi
sudo service nginx start
sudo service php5-fpm restart

If the installation is successful, you can access Nginx’s default page via http://RaspberryPiIP. The root directory of Nginx is /var/www/html. Perform the following operations to allow Nginx to handle PHP.

sudo nano /etc/nginx/sites-available/default

Replace the following content

location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

with

location / {
                index  index.html index.htm index.php default.html default.htm default.php;
        }

        location ~ .*\.php(\/.*)*$ {
                #fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                set $real_script_name $fastcgi_script_name;
                if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {
                        set $real_script_name $1;
                        set $path_info $2;
                }
                fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
                fastcgi_param SCRIPT_NAME $real_script_name;
                fastcgi_param PATH_INFO $path_info;
        }

Press Ctrl + O to save and Ctrl + X to exit.

sudo service nginx restart

Finally, restart Nginx, and the above steps have been tested on Raspberry Pi Zero + Linux version 4.9.41+.

If you are interested in deploying LNMP on Raspberry Pi, you can refer to the laboratory’s more detailed introduction “Setting Up LNMP Environment on Raspberry Pi”.

2. Deploy Pi Dashboard

Here are two methods to deploy Pi Dashboard on Nginx. 2.1. SFTP Upload Download the source code of this project from GitHub. Use FTP software like FileZilla to upload the extracted directory to the Raspberry Pi’s /var/www/html directory. You can then access the deployed Pi Dashboard via http://RaspberryPiIP/pi-dashboard.

If the page does not display, you can try adding run permissions to the source code on the Raspberry Pi terminal. For example, if your upload path is /var/www/html/pi-dashboard, run.

cd /var/www/html
sudo chown -R www-data pi-dashboard

2.2. GitHub Deployment If you are familiar with basic GitHub operations, downloading this project to the Pi via GitHub will be quite convenient.

cd /var/www/html
sudo git clone https://github.com/spoonysonny/pi-dashboard.git

You can access the deployed Pi Dashboard via http://RaspberryPiIP/pi-dashboard.

Again, if the page does not display, you can try adding run permissions to the source code on the Raspberry Pi terminal. For example, if your upload path is /var/www/html/pi-dashboard, run.

cd /var/www/html
sudo chown -R www-data pi-dashboard

Common Issues

Q: What terminals can view the Pi Dashboard’s WebUI? A: Any terminal with a browser can view it, whether on an internal or external network computer, Pad, or smartphone. Pi Dashboard has a responsive layout for different devices, compatible with mobile browsing.

Q: What should I do if I cannot access it via the external IP? A: Many ISPs in China do not provide independent external IPs. You can use tools like Peanut Shell to achieve external access. For users with an existing independent external IP, you can try changing the Nginx service port from 80 to another port number, then access it by adding the port number after the IP address. This is because ISPs in China generally block port 80.

Q: I have a domain name. How can I bind the domain name to the Raspberry Pi? A: You can refer to the DNSPod dynamic IP resolution update program and the Raspberry Pi LNMP environment setup. After pointing the domain name to the Raspberry Pi IP, you need to modify the servername in the Nginx website configuration to your domain name.

Q: Can I get technical support if I encounter problems? A: You can join the Raspberry Pi Laboratory QQ group 549418432 to communicate with other users for assistance.

Terms of Use

This project is open-source, and NXEZ.com reserves the rights as the initiator. It is allowed to use the project under the GPL v3.0 license. Please ensure that the project’s source, statement, hyperlink, and other content are complete.

Improvement Plan

Friends who are interested are welcome to participate in the improvement of this project through GitHub. Below are several directions for future improvement of the project.

  • Plan to improve Device model recognition, need to collect hardware features of various Devices.

  • Adaptation discount for general Linux systems.

  • Add different style UIs.

You can check the Pi Dashboard project homepage by reading the original text.

How to Set Up a Cool Dashboard on Your Raspberry Pi

Leave a Comment

Your email address will not be published. Required fields are marked *