Linfo – Shows Linux Server Health Status in Real-Time

Linfo is a free and open source, cross-platform server statistics UI/library which displays a great deal of system information. It is extensible, easy-to-use (via composer) PHP5 library to get extensive system statistics programmatically from your PHP application. It’s a Ncurses CLI view of Web UI, which works in Linux, Windows, *BSD, Darwin/Mac OSX, Solaris, and Minix.

It displays system info including CPU type/speed; architecture, mount point usage, hard/optical/flash drives, hardware devices, network devices and stats, uptime/date booted, hostname, memory usage (RAM and swap, if possible), temperatures/voltages/fan speeds and RAID arrays.

Requirements:

  • PHP 5.3
  • pcre extension
  • Linux – /proc and /sys mounted and readable by PHP and Tested with the 2.6.x/3.x kernels

How to Install Linfo Server Stats UI/library in Linux

First, create a Linfo directory in your Apache or Nginx web root directory, then clone and move repository files into /var/www/html/linfo using the rsync command as shown below:

$ sudo mkdir -p /var/www/html/linfo 
$ git clone git://github.com/jrgp/linfo.git 
$ sudo rsync -av linfo/ /var/www/html/linfo/

Then rename sample.config.inc.php to config.inc.php. This is the Linfo config file, you can define your own values in it:

$ sudo mv sample.config.inc.php config.inc.php 

Now open the URL http://SERVER_IP/linfo in web browser to see the Web UI as shown in the screenshots below.

This screenshot shows the Linfo Web UI displaying core system info, hardware components, RAM stats, network devices, drives and file system mount points.

Linux Server Health Information

Linux Server Health Information

You can add the line below in the config file config.inc.php to yield useful error messages for troubleshooting purposes:

$settings['show_errors'] = true;

Running Linfo in Ncurses Mode

Linfo has a simple ncurses-based interface, which rely on php’s ncurses extension.

# yum install php-pecl-ncurses                    [On CentOS/RHEL]
# dnf install php-pecl-ncurses                    [On Fedora]
$ sudo apt-get install php5-dev libncurses5-dev   [On Debian/Ubuntu] 

Now compile the php extension as follows

$ wget http://pecl.php.net/get/ncurses-1.0.2.tgz
$ tar xzvf ncurses-1.0.2.tgz
$ cd ncurses-1.0.2
$ phpize # generate configure script
$ ./configure
$ make
$ sudo make install

Next, if you successfully compiled and installed the php extension, run the commands below.

$ sudo echo extension=ncurses.so > /etc/php5/cli/conf.d/ncurses.ini

Verify the ncurses.

$ php -m | grep ncurses

Now run the Linfo.

$ cd /var/www/html/linfo/
$ ./linfo-curses
Linux Server Information

Linux Server Information

The following features yet to be added in Linfo:

  1. Support for more Unix operating systems (such as Hurd, IRIX, AIX, HP UX, etc)
  2. Support for less known operating systems: Haiku/BeOS
  3. Extra superfluous features/extensions
  4. Support for htop-like features in ncurses mode

For more information, visit Linfo Github repository: https://github.com/jrgp/linfo

That’s all! From now on, you can view a Linux system’s information from within a web browser using Linfo. Try it out and share with us your thoughts in the comments. Additionally, have you come across any similar useful tools/libraries? If yes, then give us some info about them as well.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

16 Responses

  1. Rahul Dange says:

    Hi Aaron Kili,

    UI linfo is working great but when i tired “Running Linfo in Ncurses Mode” but not able to run even through successful compilation on Ubuntu 14.04 32bit this command give me permission error.

    “sudo echo extension=ncurses.so > /etc/php5/cli/conf.d/ncurses.ini” ——> bash: /etc/php5/cli/conf.d/ncurses.ini: Permission denied

    also ncurses.ini file is not present after compilation.

    Can you please help !!!

  2. Imtiyaz says:

    Hi Thanks Aaron Kili,

    Can we run the configure from single system and get the report of multiple Linux server in the environment. And get the email report at specific time interval.

  3. Imtiyaz says:

    Can we installed on siem server

  4. Alexey says:

    Thank you for your article.

    Unfortunately, after running http://SERVER_IP/linfo command I can see only the list of files in Linfo catalog:

    [[email protected] linfo]# pwd
    /var/www/html/linfo
    
    [[email protected] linfo]# ls -al
    total 128
    drwxr-xr-x 7 root root  4096 May 26 15:50 .
    drwxr-xr-x 3 root root    19 May 23 04:24 ..
    -rw-r--r-- 1 root root   505 May 26 15:49 AUTHORS
    drwxr-xr-x 2 root root    23 May 26 15:49 cache
    -rw-r--r-- 1 root root  4158 May 26 15:49 CHANGELOG.md
    -rw-r--r-- 1 root root   700 May 26 15:49 composer.json
    -rw-r--r-- 1 root root  6982 May 26 15:49 config.inc.php
    -rw-r--r-- 1 root root  1062 May 26 15:49 DEVELOPERS.md
    -rw-r--r-- 1 root root   479 May 26 15:49 Dockerfile
    drwxr-xr-x 8 root root   163 May 26 15:49 .git
    -rw-r--r-- 1 root root    33 May 26 15:49 .gitattributes
    -rw-r--r-- 1 root root   101 May 26 15:49 .gitignore
    -rw-r--r-- 1 root root  2681 May 26 15:49 gruntfile.js
    -rw-r--r-- 1 root root  1658 May 26 15:49 index.php
    drwxr-xr-x 4 root root   281 May 26 15:49 layout
    -rw-r--r-- 1 root root 52217 May 26 15:49 LICENSE
    -rwxr-xr-x 1 root root    67 May 26 15:49 linfo-curses
    -rw-r--r-- 1 root root   825 May 26 15:49 NCURSES.md
    -rw-r--r-- 1 root root  1390 May 26 15:49 package.json
    -rw-r--r-- 1 root root  3312 May 26 15:49 README.md
    drwxr-xr-x 3 root root    19 May 26 15:49 src
    -rw-r--r-- 1 root root   408 May 26 15:49 standalone_autoload.php
    drwxr-xr-x 5 root root   171 May 26 15:49 tests
    -rw-r--r-- 1 root root   104 May 26 15:49 .travis.yml
    

    Wha should I do else to have this site running correctly? I can’t see here an index.html file. Is it normally?

    Centos 7.3 Minimal on VmWare Workstation 12

    Thank you!

    • Aaron Kili says:

      @Alexey

      Welcome, there is an index.php file, this is the default index file. Make sure that your web server serves .php index files. For Apache, open the httpd.conf set it using the DirectoryIndex directive(list them in order of preference) as follows:

      DirectoryIndex index.php index.phtml index.html index.htm

      • Alexey says:

        There was just one option in DirectoryIndex – index.html

        I added index.php index.phtml index.html index.htm and after that restartng httpd service.
        After trying to open the site the other error occured:

        scan();

        if (isset($_SERVER[‘LINFO_NCURSES’]) && php_sapi_name() == ‘cli’) {
        $output = new \Linfo\Output\Ncurses($linfo);
        }
        else {
        switch (array_key_exists(‘out’, $_GET) ? strtolower($_GET[‘out’]) : ‘html’) {
        default:
        case ‘html’:
        $output = new \Linfo\Output\Html($linfo);
        break;

        case ‘json’:
        case ‘jsonp’: // To use JSON-P, pass the GET arg – callback=function_name
        $output = new \Linfo\Output\Json($linfo, array_key_exists(‘callback’, $_GET) ? $_GET[‘callback’] : null);
        break;

        case ‘php_array’:
        $output = new \Linfo\Output\Serialized($linfo);
        break;

        case ‘xml’:
        $output = new \Linfo\Output\Xml($linfo);
        break;
        }
        }

        $output->output();

        } catch (FatalException $e) {
        echo $e->getMessage().”\n”;
        exit(1);
        }

        What’s wrong here?

        Thank you!

        • Alexey says:

          Might be since I have installed Centos Minimal version no PHP was included during installation.

          So, I have just installed PHP 7.1.5, restart httpd service and it works now!

          Thank you for your help!

          • Aaron Kili says:

            @Alexey

            This is great, good to know that you fixed the error. This will definitely help us in future when offering solutions to other readers’ issues/errors.

            Many thanks for the feedback.

  5. Jamshid says:

    Thanks for your great tips. I want to know can these tools show the health of HDD and the temperature?

    Cheers

  6. jamshid says:

    Hi thanks for the useful tips, can it show the health and temperature of HDD?

    Jamshid

Leave a Reply to Aaron Kili Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.