Monitor Your Raspberry Pi Server Status from Web Dashboard with Linux-Dash

linux-dash is a low-overhead monitoring web dashboard for a GNU/Linux machine. It provides a web interface for useful linux server information and statistics. The script displays live statistics of your server, including RAM, CPU, Disk Space, Network Information, Installed Software’s, Running Processes and much more.
With linux-dash on Raspberry Pi you can monitor your Raspberry Pi's Server Performance in your web browsers

Preview

Pre-requisites

  • Apache, Nginx or Lighttpd Installed
  • PHP and PHP-JSON Installed
  • Unzip for unzipping the packages

Install linux-dash

To install linux-dash run following command:
cd /var/www
sudo wget https://github.com/afaqurk/linux-dash/archive/master.zip
sudo unzip master.zip
sudo rm master.zip
Then you can access the dashboard at 192.168.x.x/linux-dash-master (for Apache)

For Nginx

To set up Linux-dash on Nginx it need additional set-up, you can follow these steps:
cd /etc/nginx
cd conf.d
sudo apt-get install php5-fpm
sudo touch domain_name.conf
sudo nano domain_name.conf
Then add this script for domain_name.conf [su_spoiler title="domain_name.conf"]
server {
    server_name     $domain_name;
    root            /var/www;
    index           index.html index.php;
    access_log      /var/log/nginx/access.log;
    error_log       /var/log/nginx/error.log;
 
    # Cache static files for as long as possible
    location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
            try_files $uri =404;
            expires max;
            access_log off;
            add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }
 
    # if hosting in a sub folder, setup a new location
    # replace `/linus-dash` with the folder name eg. `/folder_name`
    #location /linux-dash {
    #    index index.html index.php;
    #}
 
    # Pass PHP requests on to PHP-FPM using sockets
    location ~ \.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            fastcgi_pass unix:/run/php5-fpm.sock;
            # fastcgi_pass   localhost:9000; # using TCP/IP stack
            if (!-f $document_root$fastcgi_script_name) {
                    return 404;
            }
            try_files $uri $uri/ /index.php?$args;
            include fastcgi_params;
    }
}
To complete the steps you need to restart nginx
sudo service nginx restart

For Lighttpd

To set up linux-dash on Lighttpd it need additional set-up, you can follow this steps: Install php5-cgi to enable PHP on Lighttpd
sudo apt-get install php5-cgi
And here’s the command to enable PHP in Lighttpd:
sudo lighty-enable-mod fastcgi
sudo lighty-enable-mod fastcgi-php
To complete the steps you need to reload and restart Lighttpd
sudo service lighttpd force-reload
sudo service lighttpd restart

References

  1. Linux-dash on Github by afarqurk 
  2. Solve Lighttpd PHP 403 Forbidden | EL.Web.ID
  3. Image - Source: Pearltrees

Comments

  1. Hi, how can your code be used to monitor processes running on various PIs? I have PIs set up that use a daemon script for running videos on loop, I'd like to monitor the status of this process and alert me if there is an issue?

    Please can you point me in the right direction.

    Thanks in advance!

    ReplyDelete

Post a Comment