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
  • Like 4

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

  On 01/10/2013 at 02:17, Mindovermaster said:

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
  On 01/10/2013 at 02:20, ncc50446 said:

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
  On 01/10/2013 at 03:01, xorangekiller said:

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?

  On 02/10/2013 at 23:56, Majesticmerc said:

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.

  On 03/10/2013 at 00:10, keuka said:
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.

  On 03/10/2013 at 00:22, xorangekiller said:

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.

  On 03/10/2013 at 00:13, xorangekiller said:

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.

 

 

  On 03/10/2013 at 20:16, Haggis said:

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
  On 03/10/2013 at 22:29, Majesticmerc said:

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

    • I have the Pixel 9 Pro XL...Unless this thing is "leaps and bounds" faster than the 9, I'll pass. And by leaps and bounds, I don't mean on benchmarks. "Real world" faster. Most people don't even come close to topping out the performance of their phones. Tensor G5 is Google's most powerful chip to date, boasting a staggering 36 percent performance leap over G4.
    • MIT's stunning 'bubble wrap' device squeezes water out from thin air even in deserts by Sayan Sen Image by Matteo Roman via Pexels Massachusetts Institute of Technology (MIT) engineers have built a new kind of device that can pull clean drinking water straight out of the air—no electricity needed. It’s designed for areas where water is scarce and traditional sources like rivers or lakes aren’t reliable. Right now, more than 2.2 billion people globally don’t have access to safe drinking water. In the United States alone, 46 million face water insecurity, with either no running water or water that’s not safe to drink. This new device, called an Atmospheric Water Harvesting Window (AWHW), uses a unique hydrogel panel that looks like black bubble wrap. These dome-shaped bubbles soak up water vapor from the air, especially at night when humidity is higher. During the day, sunlight makes the vapor inside evaporate. That vapor then condenses on a glass surface and drips down through a tube, turning into drinkable water. The AWHW doesn’t rely on power sources like batteries or solar panels. It’s completely passive, meaning it works on its own. The team tested a meter-sized panel in Death Valley, California, one of the driest places in North America, and got between 57.0 and 161.5 milliliters of water per day even with humidity as low as 21 percent. That’s more than what other similar passive devices have managed. “We have built a meter-scale device that we hope to deploy in resource-limited regions, where even a solar cell is not very accessible,” said Xuanhe Zhao, a professor at MIT. “It’s a test of feasibility in scaling up this water harvesting technology. Now people can build it even larger, or make it into parallel panels, to supply drinking water to people and achieve real impact.” Another cool part of the design is how they kept the water safe to drink. Usually, these kinds of hydrogels use salts like lithium chloride to absorb more vapor but that can lead to salt leaking into the water, which isn’t ideal. To solve this, MIT’s team mixed in glycerol, a compound that helps keep salt locked inside the gel. In testing, the lithium ion concentration in the harvested water stayed below 0.06 ppm (parts per million), which is way below the safe limit. The hydrogel domes also give the material more surface area, letting it collect more vapor. The outer glass panel is coated with a special polymer film that helps cool the glass, making it easier for vapor to condense. “This is just a proof-of-concept design, and there are a lot of things we can optimize,” said lead author Chang Liu, now a professor at the National University of Singapore. “For instance, we could have a multipanel design. And we’re working on a next generation of the material to further improve its intrinsic properties.” Published in Nature Water, the study says the AWHW could last at least a year and shows promise for making safe, sustainable water in places with harsh climates. The researchers believe an array of vertical panels could one day supply water to individual households, especially in remote or off-grid locations. Source: MIT News, Nature This article was generated with some help from AI and reviewed by an editor. Under Section 107 of the Copyright Act 1976, this material is used for the purpose of news reporting. Fair use is a use permitted by copyright statute that might otherwise be infringing.
    • Clear Linux is open source, indeed, so its source code is available for anyone. They're just shutting down its support from them, they're not forbidding anyone else from taking over.
    • Linux Mint is also my favorite distro, but I fear what will happen with it if Clem were to disappear tomorrow, to be honest.
    • Yeah, I totally get your point, which is possible it could happen. I just hope there is a few people around him who are similar to where if they took over things would run pretty much the same. if not, then yeah, it could start to decline rapidly etc. but I figure something that's been around for a longer period of time with a decent backing, and probably more users than most Linux distro's (which I would 'imagine' Mint is one of the more used Linux desktop distro's by volume of people who use it), is less likely to just disappear. but like you said, nothing is guaranteed. but I do think you are probably right in that Clem is probably the core of what keeps Mint, Mint. I like how it tends to stay pretty much the same with some slight tweaks here and there (but is largely the same) instead of that crap some people go for with change for the sake of change trying to create a overly fancy interface and other unnecessary stuff etc. I also feel Mint keeps a nice balance of things out-of-the-box where it's not too bloated, nor too striped down. p.s. but I see Mint as a better Ubuntu basically. but I get your point like if it was more of a really serious choice of needing a 'safe bet' to use long term, then yeah something like official Ubuntu would be one of the better choices for sure given what you said with it being backed by an actual company which makes it a safer bet than Mint which is smaller and 'could' potentially be more fragile.
  • Recent Achievements

    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
    • One Month Later
      Ian_ earned a badge
      One Month Later
    • Dedicated
      MacDaddyAz earned a badge
      Dedicated
    • Explorer
      cekicen went up a rank
      Explorer
  • Popular Contributors

    1. 1
      +primortal
      506
    2. 2
      ATLien_0
      209
    3. 3
      Michael Scrip
      202
    4. 4
      Xenon
      146
    5. 5
      +FloatingFatMan
      121
  • Tell a friend

    Love Neowin? Tell a friend!