Monitor your web-based servers with Linux Dash and Cockpit
Home Monitor

Linux Dash and Cockpit are small-scale solutions for monitoring a cloud-hosted virtual server from home.
More and more computer users are operating a cloud-based server, which they manage from a home or local network. A well-configured cloud-hosted server that is equipped with the right Linux distribution hardly requires any work; however, an occasional glance at the system's status is compulsory.
The big players in the monitoring industry, such as Nagios, Icinga, or Munin, support monitoring for complex IT infrastructures – and are correspondingly complex to set up. But a heavy-hitting monitoring solution is overkill for a small home server – or for the many Raspberry Pi servers that now populate many home networks. If you are looking for monitoring on a small and intimate scale, the PHP-based tool known as Linux Dash [1] might be a better choice.
Linux Dash
Linux Dash uses PHP and only needs a single web server – Apache in the simplest case, although Nginx [2] also works. You will also need Node.js [3] – a web application platform built on Chrome's JavaScript runtime.
This article describes how to set up Linux Dash on an Ubuntu server with Apache 2.4. The procedures for other systems are similar.
First, make sure the required components are running on the server. You can update the package source using the first command from Listing 1 and then install Apache with PHP5 and Git (line 2). Unlike what various manuals on the network would have you believe, Linux Dash does not require a MySQL database. Load the source code into the web server document root (/var/www/html
, or for Apache 2.2, /var/www
) as shown in line 4.
Listing 1
Installing Linux Dash
$ sudo apt-get update $ sudo apt-get install apache2 php5 php5-json git $ cd /var/www/html $ sudo git clone https://github.com/afaqurk/linux-dash.git
If the browser and the web server are running on the same machine, you can access Linux Dash after installing the web script via the URL http://localhost/linux-dash
. If the server is on your home network or on the Internet, replace the localhost
with the IP address or the host name of the computer. If the page still does not load, even when the correct address is specified, it could be that PHP is still missing the correct settings (see the box titled "Shell Exec").
Shell Exec
If Apache only acknowledges the call from Linux Dash with an error message, check the PHP settings in the /etc/php5/apache2/php.ini
file. Open the file with root privileges in any editor and make sure the disable_functions
line does not run the exec
and shell_exec
functions. The page should work after restarting the web server using sudo service apache2 restart
.
Securing Linux Dash
A first glance usually suffices for a functional test. If you can reach the server from the Internet, you should promptly limit access to Linux Dash for security reasons (see the "Security" box): You need to maintain the web server with this function because the application itself does not offer user management.
Security
Some versions of the PHP function shell_exec()
, which executes a command in the shell and returns the output as a string, pose security issues for Linux Dash. If an intruder manages to access the server, s/he will be able to use the shell_exec()
function for more hacks because the function will give execute rights for any code that is smuggled in. To avoid this problem, always use the latest version of PHP.
Edit default.conf
or 000-default.conf
in /etc/apache2/sites-available/
with root privileges, depending on the distribution and the Apache version, and use an editor to add the content from Listing 2 in front of the final </VirtualHost>
at the end of the file. Adapt the path to your Linux Dash installation in the directory line.
Listing 2
Tweaking the Config File
<Directory /var/www/html/linux-dash> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory>
Then, drop the .htaccess
file with the contents of Listing 3 into the Linux Dash directory on the web server (/var/www/html/linux-dash
). Last of all, create the password file .htpasswd
(Listing 4, line 1) in the same directory and restart Apache (line 2). The application should then query the login data the next time you call up Linux Dash in the browser.
Listing 3
.htaccess
AuthType Basic AuthName "Linux Dash" AuthUserFile .htpasswd Require valid-user
Listing 4
.htpasswd
$ sudo htpasswd -c .htpasswd <I>User<I> $ sudo service apache2 restart
Linux Dash monitors your server's vital signs. The menu at the top of the page divides the output into categories System Status, Basic Info, Network, Accounts, and Apps. You will see the CPU and RAM capacity (Figure 1) and the hard disk partitioning at a glance under System Status. Basic Info shows information about the operating system, technical data for the CPU, the memory usage, and planned Cron jobs (Figure 2).
The Network link provides information about network devices, existing connections, ping times, bandwidth, and Internet speed. Linux Dash lists the user registered on the system with their last logon time and the system accounts under Accounts. Finally, Apps shows some common applications, their installation status, and the location of the matching binary in the directory tree.
Other tabs only display contents after additional programs or services have been installed. You will also find links for the NoSQL database Redis or the Memcache daemon. You can individually update the way individual tabs are displayed. You will find a search box for filtering the displayed information at the top of some tabs.
Linux Dash is officially tested and supported for Arch, Debian (from version 6), Ubuntu (from 11.04), Linux Mint (from version 16), and CentOS (from version 5). You can, however, also use Dash with other Linux distributions.
Cockpit
The Red-Hat-sponsored Cockpit Management Console [4] allows more than just pure monitoring and is similar in scope to the popular Webmin [5]. Red Hat officially introduced the Cockpit web front end with the Fedora 21 Server edition.
Cockpit is included by default with Fedora Server; you will need to install it manually for Fedora Workstation; a simple sudo yum install cockpit
or sudo dnf install cockpit
from Fedora 22 onwards will install Cockpit. The package manager also installs the Docker container manager at the same time. After the installation, you need to introduce Cockpit to Systemd using the commands in Listing 5.
Listing 5
Enabling Cockpit
$ sudo systemctl enable cockpit.socket $ sudo systemctl start cockpit
In Fedora 21 Workstation, it was still necessary to open the firewall for Cockpit and disable the SELinux security extension.
Access the main view of Cockpit (Figure 3) locally using the URL http://localhost:9090
or on a remote computer via http://IP:9090
. Enter root for the user; the password is the previously specified root password.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
Kubuntu Focus Announces XE Gen 2 Linux Laptop
Another Kubuntu-based laptop has arrived to be your next ultra-portable powerhouse with a Linux heart.
-
MNT Seeks Financial Backing for New Seven-Inch Linux Laptop
MNT Pocket Reform is a tiny laptop that is modular, upgradable, recyclable, reusable, and ships with Debian Linux.
-
Ubuntu Flatpak Remix Adds Flatpak Support Preinstalled
If you're looking for a version of Ubuntu that includes Flatpak support out of the box, there's one clear option.
-
Gnome 44 Release Candidate Now Available
The Gnome 44 release candidate has officially arrived and adds a few changes into the mix.
-
Flathub Vying to Become the Standard Linux App Store
If the Flathub team has any say in the matter, their product will become the default tool for installing Linux apps in 2023.
-
Debian 12 to Ship with KDE Plasma 5.27
The Debian development team has shifted to the latest version of KDE for their testing branch.
-
Planet Computers Launches ARM-based Linux Desktop PCs
The firm that originally released a line of mobile keyboards has taken a different direction and has developed a new line of out-of-the-box mini Linux desktop computers.
-
Ubuntu No Longer Shipping with Flatpak
In a move that probably won’t come as a shock to many, Ubuntu and all of its official spins will no longer ship with Flatpak installed.
-
openSUSE Leap 15.5 Beta Now Available
The final version of the Leap 15 series of openSUSE is available for beta testing and offers only new software versions.
-
Linux Kernel 6.2 Released with New Hardware Support
Find out what's new in the most recent release from Linus Torvalds and the Linux kernel team.