06 novembre 2014

Monitor with Linux-Dash

Monitor Ubuntu 14.04 and Debian Wheezy Servers with Linux-Dash

This document describes how to install and configure Linux-dash in Ubuntu 14.04 and Debian Wheezy for monitoring server performances easily. Linux-dash is a low-overhead monitoring web dashboard for a GNU/Linux machine. Simply drop-in the app and go! Linux-dash is a memory efficient, low resource, easy to install, server statistics monitoring script written in PHP. The web statistics page allows you to drag and drop the various widgets and rearrange the display as you desire. The script displays live statistics of your server, including RAM, CPU, Disk Space, Network Information, Installed Software’s, Running Processes and much more. The main advantage of Linux-dash is that it works on real-time basis.

1 Preliminary Note

This tutorial is based on Ubuntu 14.04 server, so you should set up a basic Ubuntu 14.04 server and Debian 7 server installation before you continue with this tutorial. Your system could have static or dynamic IP. In my case I am using static IP address. I use 192.168.0.100 as my IP address in this tutorial and server1.example.com as the hostname. 

2 Installation in Ubuntu and Debian server

Before linux-dash installation we require some per-configuration. We can use Linux-dash with either Apache or NGINX. In my case I will be using Apache:
apt-get install apache2 apache2-utils
linux-dash is created in PHP so we requires PHP and php-json extension installed, I will install it as follows:
apt-get install php5 curl php5-curl php5-json
We also require git package, it will be installed as follows:
apt-get install git
Now start the Apache service:
service apache2 start

2.1 Installation in Ubuntu 14.04

Now we will download the Linux-dash in Ubuntu 14.04 server in its Apache document root as follows:
cd /var/www/html
git clone https://github.com/afaqurk/linux-dash.git
Now we are ready for the dashboard, open a browser of your choice and open the URL http://192.168.0.100/linux-dash:
It will show us the general information about the Ubuntu Server.
General Info:
Click to enlarge
Further we can check other information like Disk usage, CPU usage, RAM usage, users' information and network usage as follows:
Disk:
Click to enlarge


CPU:

Click to enlarge


RAM:
Click to enlarge
Users:
Click to enlarge
Network:
Click to enlarge

2.2 Installation in Debian Wheezy

Now we will download the Linux-dash in Debian Wheezy server in its Apache document root as follows:
cd /var/www
git clone https://github.com/afaqurk/linux-dash.git
We can access Linux-dash on the URL http://192.168.0.100/linux-dash:
Click to enlarge
We can check all the parameters as in case of Ubuntu for Debian as well.

3 Secured Linux-dash access

Now we want to access the Linux-dash within a secured environment, i.e. I want that Linux-dash must be password protected. For that we will proceed like that:
htpasswd -c /etc/apache2/.htpasswd admin
root@server1:~# htpasswd -c /etc/apache2/.htpasswd admin
New password: <--howtoforge
Re-type new password: <--howtoforge
Adding password for user admin
root@server1:~#
I am using my password as howtoforge or you can use any password of your choice.

3.1 In Ubuntu 14.04

Now create a .htaccess file in the Linux-dash document-root directory and add the following content to it:
touch /var/www/html/linux-dash/.htaccess
vi /var/www/html/linux-dash/.htaccess
And give the entries as:
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
Now we will change the Apache2 configuration file of the Ubuntu 14.04 Server as :
vi /etc/apache2/apache2.conf
And give the entries at the end of the file as:
[...]
<Directory /var/www/html/linux-dash>
        Options Indexes FollowSymLinks
        AllowOverride Authconfig
        Require all granted
</Directory>
Finally restart the service of Apache and you are done.
service apache2 restart
Now while accessing the Linux-dash URL http://192.168.0.100 we will be prompted for the password.
Click to enlarge



3.2 In Debian Wheezy Server

Now create a .htaccess file in the Linux-dash document-root directory and add the following content to it:
touch /var/www/linux-dash/.htaccess
vi /var/www/linux-dash/.htaccess
And give the entries as:
AuthName "Restricted"
AuthType Basic
AuthUserFile /etc/apache2/.htpasswd
AuthGroupFile /dev/null
require valid-user
Now we will change the Apache2 configuration file of the Ubuntu 14.04 Server as :
vi /etc/apache2/apache2.conf
And give the entries at the end of the file as:
[...]
<Directory /var/www/html/linux-dash>
        Options Indexes FollowSymLinks
        AllowOverride Authconfig
        Require all granted
</Directory>
Finally restart the service of Apache and you are done.
service apache2 restart
Now while accessing the Linux-dash URL http://192.168.0.100 we will be prompted for the password.

 

Aucun commentaire :

Enregistrer un commentaire