Frivolous statistics of the home server :)

    cowsay
    On the rights of a Friday post, we will teach a cow to speak :)

    Using cowsay , we show free space, temperature of screws and processor, uptime.

    In order to amuse myself, I decided to display the information about the home server in a joking manner. We look at everything that happened under the cut.

    The conclusion here is such simple information is a simple PHP script that, thanks to the web server, can be viewed from anywhere using a browser.
     ________________________________________________________________
    (Filesystem Size Used Avail Use% Mounted on)
    (/ dev / sda1 11G 1.9G 8.7G 18% /)
    (tmpfs 253M 0 253M 0% / lib / init / rw)
    (udev 10M 668K 9.4M 7% / dev)
    (tmpfs 253M 0 253M 0% / dev / shm)
    (/ dev / mapper / lvmvolume-arch)
    (3.7T 3.7T 5.2G 100% / arch)
    (/ dev / sda3 584G 579G 5.6G 100% /arch/.Downloading)
     -------------------------------------------------- --------------
            o ^ __ ^
             o (oo) \ _______
                (__) \) \ / \
                    || ---- w |
                    || ||
    CPU 31 C Intel (R) Pentium (R) III CPU - S 1400MHz
    / dev / sda 24 C SAMSUNG HD642JJ
    / dev / sdb 31 C Hitachi HDT721010SLA360
    / dev / sdc 20 C SAMSUNG HD154UI
    / dev / sdd 26 C ST31500541AS
    Linux server 2.6.26-2-686 # 1 SMP Wed Feb 10 08:59:21 UTC 2010 i686 GNU / Linux
    uptime: 10:43:29 up 16 days, 16:59, 1 user, load average: 0.02, 0.04, 0.00




    Source code



        // cowsay disk usage
        system("df -h | perl /usr/games/cowthink -n");
        echo "\n";

        // CPU thermal info
        $cpu_thrminfo = exec('cat /proc/acpi/thermal_zone/THRM/temperature');
        $cpu_thrminfo = explode(':', $cpu_thrminfo);
        echo "CPU\t\t", trim($cpu_thrminfo[1]);

        // CPU model name
        $cpu_mdl = exec("cat /proc/cpuinfo | grep -i 'model name'");
        $cpu_mdl = explode(':', $cpu_mdl);
        echo "\t", trim($cpu_mdl[1]), "\n";
        echo "\n";

        // HDD temperature
        $hdd_list = exec('nc localhost 7634');
        $hdd_list = trim($hdd_list, '|');
        foreach (explode('||', $hdd_list) as $hdd_temp)
        {
            $hdd_temp = explode('|', $hdd_temp);
            echo $hdd_temp[0], "\t", $hdd_temp[2], ' ', $hdd_temp[3], "\t", $hdd_temp[1], "\n";
        }

        // uname && uptime
        echo "\n", `uname -a`;
        echo 'uptime:', `uptime`;
    ?>

    * This source code was highlighted with Source Code Highlighter.


    PS A running hddtemp daemon on port 7634 is required for operation.

    Also popular now: