Jump to content



Photo

Linux System Stats Script - Version 2.2.1 Released

linux; stats

112 replies to this topic

#1 +Karl L.

Karl L.

    xorangekiller

  • Tech Issues Solved: 15
  • Joined: 24-January 09
  • Location: Virginia, USA
  • OS: Debian Testing

Posted 28 September 2013 - 00:45

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/x...er/haggis-stats

Stats 1.x Thread: http://www.neowin.ne...em-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, 02 October 2014 - 10:26.



#2 Growled

Growled

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 17-December 08
  • Location: USA

Posted 28 September 2013 - 00:57

Great works, guys. Thanks. :)



#3 Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 29 September 2013 - 19:36

Its awesome

 

so fast

 

i just need to learn some more perl now lol



#4 ncc50446

ncc50446

    Engage!

  • Tech Issues Solved: 1
  • Joined: 09-January 04
  • Location: Saskatchewan, Canada
  • OS: Windows 7
  • Phone: Android CM11 4.4.4

Posted 29 September 2013 - 22:03

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



#5 Mindovermaster

Mindovermaster

    Neowinian Senior

  • Tech Issues Solved: 10
  • Joined: 25-January 07
  • Location: /USA/Wisconsin/
  • OS: Debian Jessie
  • Phone: Samsung Galaxy SIII

Posted 01 October 2013 - 02:17

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:



#6 ncc50446

ncc50446

    Engage!

  • Tech Issues Solved: 1
  • Joined: 09-January 04
  • Location: Saskatchewan, Canada
  • OS: Windows 7
  • Phone: Android CM11 4.4.4

Posted 01 October 2013 - 02:20

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



#7 OP +Karl L.

Karl L.

    xorangekiller

  • Tech Issues Solved: 15
  • Joined: 24-January 09
  • Location: Virginia, USA
  • OS: Debian Testing

Posted 01 October 2013 - 02:32

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.

#8 ncc50446

ncc50446

    Engage!

  • Tech Issues Solved: 1
  • Joined: 09-January 04
  • Location: Saskatchewan, Canada
  • OS: Windows 7
  • Phone: Android CM11 4.4.4

Posted 01 October 2013 - 02:51

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



#9 Mindovermaster

Mindovermaster

    Neowinian Senior

  • Tech Issues Solved: 10
  • Joined: 25-January 07
  • Location: /USA/Wisconsin/
  • OS: Debian Jessie
  • Phone: Samsung Galaxy SIII

Posted 01 October 2013 - 02:59

OK, thanks, Orange! :)



#10 OP +Karl L.

Karl L.

    xorangekiller

  • Tech Issues Solved: 15
  • Joined: 24-January 09
  • Location: Virginia, USA
  • OS: Debian Testing

Posted 01 October 2013 - 03:01

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.



#11 ncc50446

ncc50446

    Engage!

  • Tech Issues Solved: 1
  • Joined: 09-January 04
  • Location: Saskatchewan, Canada
  • OS: Windows 7
  • Phone: Android CM11 4.4.4

Posted 01 October 2013 - 03:04

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



#12 Mindovermaster

Mindovermaster

    Neowinian Senior

  • Tech Issues Solved: 10
  • Joined: 25-January 07
  • Location: /USA/Wisconsin/
  • OS: Debian Jessie
  • Phone: Samsung Galaxy SIII

Posted 01 October 2013 - 03:19

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

 

Had too many issues in Ubuntu, lol.



#13 Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 01 October 2013 - 09:55

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



#14 +Majesticmerc

Majesticmerc

    Resident Idealist

  • Tech Issues Solved: 8
  • Joined: 24-August 05
  • Location: United Kingdom
  • OS: Arch Linux / Win 7
  • Phone: HTC One X

Posted 02 October 2013 - 23:56

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.co...bb01916c8865fd2

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

#15 keuka

keuka

    Neowinian

  • Joined: 23-August 05
  • Location: United States of America

Posted 03 October 2013 - 00:10

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

 

 

screenshot_20131002.190721.png

compared to ...

Screenshot from 2013-10-02 03:24:37.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?