Linux System Stats Script - Version 2.2.1 Released


Recommended Posts

Haggis Stats
 
Some of you might remember that Haggis announced on this forum late last year that he was writing a simple Linux system stats script. At first it started out really basic, but with the encouragement of other Neowin members he continued to improve it. Several of us even offered pointers or submitted patches to help fix bugs. As it evolved over the next several months Haggis added features and stability improvements until it became what I believe is one of the best scripts of its kind.
 
Since Haggis has not had much free time to work on it recently, I set out to fix some bugs in the script last weekend. In particular I noticed that while the script works well on my distro of choice, it spit out many ugly errors on typical Arch Linux installations. In the process of tracing and fixing these bugs I decided to rewrite the script in Perl. This major revision of Stats is much more fault tolerant, has explicit support for the most popular Linux distributions and desktop environments, has new switches to control behavior, and has significantly more documentation than the old BASH script.
 
Therefore Haggis and I are proud to present Haggis Stats 2.0!
 
About

 

Stats is a simple script to print basic system statistics and immortalize those results with a screenshot on GNU/Linux systems. The most popular Linux distributions are officially supported by this script, although any reasonable, modern GNU/Linux system should have no problem running it. It was written with typical end-user desktop installations in mind, but a limited subset of the functionality afforded to those systems is provided on headless machines. This script will automatically detect the functionality available and print the associated system information accordingly, or fail gracefully if it cannot.
 
Officially Supported Operating Systems

  • Red Hat Enterprise Linux >= 6.0
  • CentOS >= 6.0
  • Fedora >= 15
  • Debian >= 6.0
  • Ubuntu >= 12.04
  • Linux Mint >= 13
  • Elementary OS >= 0.2
  • Arch Linux
  • openSUSE >= 12.3

 

Dependencies
 
      Base Dependencies

  • Perl 5.10 or later
  • Perl Switch module
  • Linux Standard Base core

      Recommended Utilities

  • GNU Coreutils
  • GNU PS
  • xrandr
  • scrot

 

Installation

In most cases Stats really does not need to be installed. You can invoke it from the top level of its source directory using the command below.

$ ./src/stats.pl

If you wish to install Stats so it is available to all users on your system, you can do so one of two ways. If you are running Debian or a Debian-based distribution such as Ubuntu or Linux Mint, you can install the Debian package in the section below. Otherwise you can run the commands listed below as root to install the script manually. Typically prefixing each command with "sudo" or "su -c" will run it as root if you have not already assumed those privileges since entering the top-level of the Stats source directory.

# install -m 755 ./src/stats.pl /usr/local/bin/haggis-stats
# install -m 755 -d /usr/local/man/man1
# install -m 644 ./man/stats.1 /usr/local/man/man1/haggis-stats.1
# gzip /usr/local/man/man1/haggis-stats.1

Packages

In addition to the manual installation method described above, I also developed a Debian package for Stats. I recommend that you use this package if you are running Debian, Ubuntu, or another Debian derivative. You can either click the appropriate link in the next section to download the package and double-click it in your file manager to install it with Synaptic, GDebi, Ubuntu Software Center, or your other graphical package manager of choice; or follow the instructions below to install it from the command line.
 
Debian/Ubuntu Installation:

$ wget http:\\www.haggistech.co.uk\stats\haggis-stats_2.2.1_all.deb 
$ sudo apt-get install scrot
$ sudo dpkg -i haggis-stats*.deb
$ sudo apt-get install -f
$ haggis-stats

Majesticmerc has also written an Arch Linux package for Stats which he uploaded to the Arch User Repository. I recommend that you use this package if you are running Arch Linux or a derivative. You can download the PKGBUILD from the haggis-stats AUR page and install it using your preferred method, or follow the instructions below.

 

Arch Linux AUR Installation:

$ wget https://aur.archlinux.org/packages/ha/haggis-stats/haggis-stats.tar.gz
$ tar xzf haggis-stats.tar.gz
$ cd haggis-stats
$ makepkg -s
$ sudo pacman -U haggis-stats*.pkg.tar.xz

Links
 
Stats 2.2.1 Debian Package: http:\\www.haggistech.co.uk\stats\haggis-stats_2.2.1_all.deb
Stats GitHub Repository: https://github.com/xorangekiller/haggis-stats

Stats 1.x Thread: https://www.neowin.net/forum/topic/1119502-linux-system-stats-script
 

ChangeLog

 

Version 2.2.1

  • New Feature: Added ability to pipe to file without coloring
  • New Feature: Setting HAGGIS_STATS_SCREENSHOT_DIR variable will default the screenshot folder
  • Cosmetic Change: made ram display as Used/Available instead of Available/Used

Version 2.1.0

  • New Feature: Elementary OS support
  • New Feature: --output-dir option
  • Bugfix: No screenshot attempt without an X session
  • Bugfix: Improved support for headless systems
  • Bugfix: Defaulted screenshot utility to scrot to fix "black" screenshots

Version 2.0.0

  • Complete rewrite in Perl
  • New Feature: Command line switches
  • New Feature: Diagnostic report generation
  • New Feature: RHEL, CentOS, Arch, and openSUSE support
  • Bugfix: lsb_release is no longer strictly required
  • Bugfix: Improved support for headless systems
  • New File: ChangeLog and NEWS
  • New File: README
  • New File: INSTALL
  • New File: AUTHORS
  • New File: Stats man page

 

Bugs
 
We encourage you to test the script on your systems and report any bugs you encounter; even if they are for Linux distributions we do not officially support we will still try to fix them. For now this thread is the preferred form contact, although you are also welcome to PM Haggis or I if you wish.
 
When you report bugs it would be very helpful if you could include either a screenshot of Stats' output or a textual copy of the buggy output, and a diagnostic report. Diagnostic reports can be generated by the script using the "report" action. An example of a Stats report is below.

$ ./src/stats.pl report
Diagnostic report written to /home/karl/stats-2.0.0/stats_report_karl_20130927.204227.log

Screenshot
 
screenshot_20130927.211634.png

Edited by Haggis

I could only get it to work by the command line...I installed the package, and it's not under the K-menu...

But using command line, and cding to the stats directory, and running '/src/stats.pl' worked for me, just doesn't seem to do anything when I install, even though it said it installed..lol

But works it works good :)

Sorry to be a pest, but how do you run it after you install it the Debian/Ubuntu way? doesn't seem to be anything in ./src/stats.pl. :huh:

 

If you installed the Debian package it is available from the terminal as haggis-stats.

# Run Stats after it has been installed via the Debian package:
haggis-stats

# View the Stats manual after it has been installed via the Debian package:
man haggis-stats

# Search for Stats if you can't remember the name of the command:
apropos stats

I could only get it to work by the command line...I installed the package, and it's not under the K-menu...

But using command line, and cding to the stats directory, and running "./src/stats.pl" worked for me, just doesn't seem to do anything when I install, even though it said it installed..lol

But works it works good :)

 

Since it is not a graphical application Stats does not have a menu entry. I will update the documentation to include the executable name once the package has been installed. I guess it was only clear to me because I wrote the packaging. Oops.

 

Edit: The opening post has been updated with the new documentation.

No problem. Don't be afraid to ask questions. That's how you learn. I know that Neowin was started to report on Windows development and remains a very Windows-centric community, but there are those of us here who will do our best to help you understand Linux. I started out as a Windows power user who didn't understand the point of Linux. I understand. There is no shame in asking for help when you don't understand something. I will not mock you or ridicule you. My only request is that are willing to drop your presuppositions and learn something new when you ask a question.

  • Like 3

No problem. Don't be afraid to ask questions. That's how you learn. I know that Neowin was started to report on Windows development and remains a very Windows-centric community, but there are those of us here who will do our best to help you understand Linux. I started out as a Windows power user who didn't understand the point of Linux. I understand. There is no shame in asking for help when you don't understand something. I will not mock you or ridicule you. My only request is that are willing to drop your presuppositions and learn something new when you ask a question.

And that is one reason that you're an m.v.c. and one reason why I switched from Fedora to Debian lol You'e done a great job in the Linux section :)

Glad to see you guys like it, Orangekiller is a god in here lol

 

The only thing i cant get to work was the switches for no screenshot etc

 

although i did try it working on only 4 hours sleep so i might just be being dumb

Looking good guys! Just finished doing an Arch PKGBUILD script to allow people to install it properly. Others on Arch wanting it "properly installed" can use the PKGBUILD found here: https://spideroak.com/storage/NVQWUZLTORUWG3LFOJRQ/shared/161658-1-2598/PKGBUILD?f0bdbf52bcb9fe26abb01916c8865fd2

Haggis/xorangekiller - Do you guys have any objections to me putting the script on the Arch AUR? That'll make it accessible for more people, and integrate it with the AUR-capable package managers (yaourt, packer, etc).

Doesn't seem very accurate for elementary OS; and it appears buggy when taking screen shots. 

 

 

post-125102-0-85355100-1380758885.png

compared to ...

post-125102-0-35883800-1380758945.png

 

Also it would be nice if it placed screenshots in my ~/Pictures folder instead and it would be even nicer to run it without taking a screenshot just to see the output.

Can you add a logo for elementary OS?

Haggis/xorangekiller - Do you guys have any objections to me putting the script on the Arch AUR? That'll make it accessible for more people, and integrate it with the AUR-capable package managers (yaourt, packer, etc).

 

That would be fantastic! The only reason I did not do this myself is that I am not experienced with Arch packaging. Let me know when you do, and I will add it to the official documentation.

Also it would be nice if it placed screenshots in my ~/Pictures folder instead and it would be even nicer to run it without taking a screenshot just to see the output.

Can you add a logo for elementary OS?

 

I noticed the same bug in ImageMagick::Import when I was doing my initial testing, but in an effort to remain consistent with Stats 1.x I let it be. That said, I have a potential fix for the screenshot bug, I just need to do a little more testing to make sure it doesn't breaking anything else.

 

You can control the output directory for the screenshot by moving to it before executing the script. However I can add a switch to modify this behavior if you wish. I will try to add the Elementary OS logo, fix the screenshot bug, and add a switch for controlling the output directory in the next release.

I noticed the same bug in ImageMagick::Import when I was doing my initial testing, but in an effort to remain consistent with Stats 1.x I let it be. That said, I have a potential fix for the screenshot bug, I just need to do a little more testing to make sure it doesn't breaking anything else.

 

You can control the output directory for the screenshot by moving to it before executing the script. However I can add a switch to modify this behavior if you wish. I will try to add the Elementary OS logo, fix the screenshot bug, and add a switch for controlling the output directory in the next release.

Awesome man! You rock! And a switch would be nice; two switches actually, one to specify picture output and one to suppress taking a screenshot. Great work otherwise.

That would be fantastic! The only reason I did not do this myself is that I am not experienced with Arch packaging. Let me know when you do, and I will add it to the official documentation.

 

 

Hey Guys sorry been busy with work

 

Into Aur would be amazing

 

Orange your doing an amazing job :)

Done and done...

post-125341-0-41284900-1380833942.png

Direct link: https://aur.archlinux.org/packages/haggis-stats/

I just updated the opening post. Stats 2.1.0 has been released!

 

Notably, the "black" screenshot bug has been fixed, you can now control the screenshot output directory using a switch, there is official Elementary OS support (which was trivial considering that Ubuntu 12.04 - its base distribution - was already supported), and I added instructions for installing Majesticmerc's package from the AUR.

  • Like 1

Is there any way to prevent the "stats" suffix being required when options are specified. For example:

# Works :D
$ haggis-stats --no-screenshot stats
...

# Fails :(
$ haggis-stats --no-screenshot
Invalid ACTION: --no-screenshot

Is there any way to prevent the "stats" suffix being required when options are specified.

 

I could add that feature, but it would make the argument processing logic a lot more complicated, which is why I opted not to so far. However, I will look into it for the next release. There might be a nice solution I haven't considered yet.

 

If anyone else has any feature requests, feel free to ask. I very much enjoy Perl programming (which I don't get to use often enough in my day job) and would love to make the script even more useful. Haggis might be willing to implement some new features too as he expands his knowledge of Perl.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Sandboxie Plus 1.17.8 / Classic 5.72.8 by Razvan Serea Run programs in a sandbox to prevent malware from making permanent changes to your PC. Sandboxie allows you to run your browser, or any other program, so that all changes that result from the usage are kept in a sandbox environment, which can then be deleted later. Sandboxie is a sandbox-based isolation software for 32- and 64-bit Windows NT-based operating systems. It is being developed by David Xanatos since it became open source, before that it was developed by Sophos (which acquired it from Invincea, which acquired it earlier from the original author Ronen Tzur). It creates a sandbox-like isolated operating environment in which applications can be run or installed without permanently modifying the local or mapped drive. An isolated virtual environment allows controlled testing of untrusted programs and web surfing. Sandboxie is available in two flavors Plus and Classic. Both have the same core components, this means they have the same level of security and compatibility. What's different is the user interface the Plus build has a modern Qt based UI which supports all new features that have been added since the project went open source. The Classic build has the old no longer developed MFC based UI, hence it lacks support for modern features, these features can however still be used when manually configured in the Sandboxie.ini. Sandboxie Plus 1.17.8 / Classic 5.72.8 release notes: Added added DisableCustomTitleOpt=[process,][y|n] to allow [#] sandboxie title markers on custom-titlebar windows (Delphi VCL, Qt, Electron) that were previously skipped to prevent DWM repaint CPU loops #5387 Changed updated bundled ImDisk driver to 3.0.2 #5419 Fixed fix Suppress logs for expected non-user SIDs #5422 SbieSvc.exe: SBIE2218/2219 error when run program as administrator #5417 fixed explorer.exe crashes in Application Compartment when Huorong Security is installed #5423 Download: Sandboxie Plus (64-bit) | 23.5 MB (Open Source) Download: Sandboxie Classic (64-bit) | 3.0 MB Links: Sandboxie Website | GitHub | ARM64 | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Hello, Christian Maas' XVI32 is a nice (and very small) hex editor. Speaking of hex editors, many years ago a colleague and I who both worked at Tribal Voice managed to edit a copy of the company's PowWow instant messaging client to make it behave better now that all of its lookup servers and other server-side tech was gone.  The program didn't support NAT (RFC-3022 was introduced in January 2001, the same time Tribal Voice was shuttered), but it still worked okay if you manually set up port-forwarding on your router.  The server at http://powwow.jazy.net/ hosts a copy (usual warnings about downloading and running untrusted code from random internet servers apply). I occasionally use some tools like Funduc Software's Search and Replace and Application Mover when I need to make mass-edits to text-based files or move programs with a hard-coded installation directories, respectively.  When I need to figure out the exact LCD panel inside of a laptop, EnTech Taiwan's Monitor Asset Manager is my go-to tool for that purpose. JD Design's website (now hosted on github.io) has a number of interesting freeware and shareware utilities.  I used to use their TouchPro utility to set the file timestamps on software I was mastering to match its version number (e.g., version 3.00 of a program had all of its files dates set to 3:00AM, and so forth). Karenware has a number of interesting freeware utilities, too. Regards, Aryeh Goretsky  
    • I still use HexChat! Not really as ancient as the 1994 AutoCAD above my post, but I have never found anything better to replace it. Yes we still operate an IRC server https://www.neowin.net/irc/ 😛 
    • At work we still have a couple of people that use a version of AutoCAD LT purchased in 1994. This predates Windows 95 and works fine on versions of Windows up to XP. Its long since run in an locked down isolated XP VM, accessible via RDP. I did install LibreCAD for them, however they said it was just too different to get to grips with. In all fairness one of them is now 75 and the other is almost 60.
    • On my music making (non internet) PC Sony Acid Pro 7.0 Adobe Audition 2015 Korg Legacy Collection Windows 7 SP1
  • Recent Achievements

    • Week One Done
      Jeroen Wilms earned a badge
      Week One Done
    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
    • One Month Later
      AndreaB earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      509
    2. 2
      +Edouard
      198
    3. 3
      PsYcHoKiLLa
      138
    4. 4
      ATLien_0
      90
    5. 5
      Steven P.
      82
  • Tell a friend

    Love Neowin? Tell a friend!