pyDash - A Python App For Monitoring Your Linux Server

January 22, 2015 | By
| 9 Replies More

The python programming language is very useful to system administrators as it offers rapid development and one can easily write scripts in a very short time to automate daily tasks. There are many python tools for linux system admins out there, one of them is pyDash which is a small web-based monitoring dashboard for linux in python and django.

I really like using pyDash as it gives me information about my linux system such as cpu usage, memory usage, internet traffic, ip addresses, disk usage, processes currently running, users and general info like the name and version of Operating System being used. In the general info tab you can also learn about the CPUs and uptime.

In short words the pyDash app helps the linux user to monitor servers. According to the official author on his github page the app supports the following OSes:

  • Centos
  • Fedora
  • Ubuntu
  • Debian
  • Raspbian
  • Pidora
  • Arch Linux

A very cool feature pyDash has is the ability to retrieve data remotely in JSON format which can be easily retrieved as long as the user agent has been authenticated by the web application.

How to install pyDash using django development server

What is django

Django is a free opensource web application development framework built in Python programming language by some developers during their work at a local newspaper. It focuses on rapid development, pragmatic design and follows the DRY(Do not repeat yourself philosophy).

I am not going to explain how django works in this tutorial but only teach you how to install it for running pyDash on your local linux machine.

Note: Make sure if you have installed git on your system. You can read some tutorial on google on how to install it for your linux distro.

Now open your terminal and run the following command to clone the pyDash repository from github on your local machine.

git clone of pydash

Now that you have finished cloning the repo we need to install the following tools:

  • pip
  • virtualenv

What is pip

pip is a commandline tool which is used to easily install and manage python packages in your machine.

Ubuntu and Debian users can install pip using the following command.

sudo apt-get install pip

RHEL, CentOS and Fedora users can install pip on their machine using the following command.

sudo yum -y install python-pip

What is virtualenv

virtualenv is the perfect tool when it comes to solving dependecy problems in your python projects. This tool creates virtual environments on your machine allowing the user to keep the dependencies required by different projects in separate places.

For example project x uses django 1.6.x but your boss is asking you to work on project y where django 1.7.x needs to be used. What is your solution to this problem? Which version of django are you going to keep?

virtualenv is the solution. Now that you have pip installed on your machine you can easily install it by typing the following command on your terminal.

pip install virtualenv

I get the following output when running the above command on my machine because I have already installed virtualenv on my machine.

Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Finally you have finished with installing new tools on your system.

Change directory to pydash using the cd command.

cd ../../pydash

My pydash is located on my Desktop folder so I type the following command to cd there.

cd home/oltjano/Desktop/pydash

The next step consists in creating a virtual environment for our project with the help of the virtualenv.

Use the following command to do this. You can name the virtual environment you are creating anything you want but I personally like to name it pydashvenv.

virtuelnv pydashvenv

Then we need to activate our virtual environment using the following command.

source pydashvenv/bin/activate

If after running the above command the output on your console looks like the following it means the virtual environment is activated and it is ready for you to work on it.

(pydashvenv)oltjano@baby:~/Desktop/pydash$

Now install the requirements of your project by using the following command. It look for a file called requirements.txt in your project. This is the file where the developer defines the packages which are required to run the project.

Install requirements for the project

pip install -r requirements.txt

If you do cat requirements.txt you will see the following output.

django==1.6.8

So it is very easy to understand that pip installed django 1.6.8 on the virtual environment you created with virtualenv. Yes you can install other packages but we don't need them for this project.

If you want to verify that django 1.6.8 is installed on your machine then fire up a python interpreter and run the following commands.

import django
print django.get_version()

Everything should be ok if the following is displayed on your console.

1.6.8

Configure and run this django project

On your pydash directory do cd pydash and open settings.py file and look for a string called SECRET_KEY like shown in the following screenshot.

Make sure you change the secret key and please keep it secret as it should be.

Run the following django command.

python manage.py syncdb

Make sure to select yes when it asks you if you want to create a superuser or no. Then run the app with the following command.

python manage.py runserver

Got and visit

http://www.127.0.0.1/login/

Type the username and password that you created with the superuser.

Then the following will appear.

pydash running

Filed Under : LINUX HOWTO, MONITORING

Tagged With :

Free Linux Ebook to Download

Comments (9)

Trackback URL | Comments RSS Feed

  1. Samarth says:

    This looks like a cool app to use. The UI looks refreshing and organized. However, the installation process looks tedious. I don't want to jump to conclusions before trying it out but I guess a simpler installation procedure could have been better. Currently I'm using another cloud based linux server monitoring tool written in python called SeaLion. What attracts me about this tool is it's simplicity to use and efficiency in monitoring performance. There are a lot of other features as well and the UI is pleasing to the eyes. If I have to switch to some other app, it has to have more features than SeaLion in addition to the ones I mentioned.
    It is a reliable tool, however I want to check out pyDash as well.

  2. Oltjano Terpollari says:

    Yes the installation process is long but the reason I did it this way is because I want to introduce some simple python concepts to linoxide readers for example: How to use the pip python package management system, how to use the virtualenv tool to create virtual environments for running python projects and also how to run a django a project.

    You are right, there is a shorter way to install pydash. But it is good to have some low level knowledge of the application you are using in your server for monitoring. The more knowledge you have about the code of the app the higher is the probability to understand errors during monitoring or installation.

    pydash is written in python programming language and django which is a web application development framework. It makes use of bootstrap for the froentend. I really like this tool.

    I would love to hear from you about SeaLion and maybe we can cover it in our website.

    • Samarth says:

      @Oltjano,

      I see your point. Knowledge about the code is indeed important.

      Would love to talk about SeaLion and hear more about pyDash. We could take this discussion on email.

  3. Alberto says:

    Hi Oltjano,
    Seems a good app to monitor linux server with amazing UI.
    Is possible monitor a remote server also?
    Thanks.
    Ciao
    Alberto

  4. Oltjano Terpollari says:

    Hey Alberto,

    I have not used pydash to monitor a server remotely but check this section https://github.com/k3oni/pydash/wiki/Remote-data-retreival

  5. karn says:

    Can we add multiple systems to the pydash server and graph them in UI so, we can track multiple system in one window.

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.