119 posts in this topic

Posted (edited)

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: http://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
4 people like this

Share this post


Link to post
Share on other sites

Posted

Great works, guys. Thanks. :)

Share this post


Link to post
Share on other sites

Posted

Its awesome

 

so fast

 

i just need to learn some more perl now lol

Share this post


Link to post
Share on other sites

Posted

Awesome, I'll try to give this a try on the weekend :) 

Share this post


Link to post
Share on other sites

Posted

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:

Share this post


Link to post
Share on other sites

Posted

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 :)

Share this post


Link to post
Share on other sites

Posted

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.

1 person likes this

Share this post


Link to post
Share on other sites

Posted

Oh, thanks lol Sorry, I'm still kinda new to Linux, used it several times, but mostly just php programming..

Share this post


Link to post
Share on other sites

Posted

OK, thanks, Orange! :)

Share this post


Link to post
Share on other sites

Posted

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.

3 people like this

Share this post


Link to post
Share on other sites

Posted

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 :)

Share this post


Link to post
Share on other sites

Posted

I second that. He got me switched from Ubuntu 13.04 to Debian Wheezy 7. :)

 

Had too many issues in Ubuntu, lol.

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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).

Share this post


Link to post
Share on other sites

Posted

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?

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

Hey Guys sorry been busy with work

 

Into Aur would be amazing

 

Orange your doing an amazing job :)

Share this post


Link to post
Share on other sites

Posted

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/

4 people like this

Share this post


Link to post
Share on other sites

Posted

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.

1 person likes this

Share this post


Link to post
Share on other sites

Posted

AUR package updated.

Share this post


Link to post
Share on other sites

Posted

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

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

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

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

yep :)

 

I am going out this weekend to buy some books :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.