Monday, 7 October 2013

Health Check tool for GNU/Linux & Ubuntu OS

One of my friend who is working as Linux admin had ask me a question, there is any simple way to monitor and identify potential problems they impact system’s?
So i decided to write a blog post tool called “Linux Health Checker”.

What is Linux Health Checker?
The Linux Health Checker (lnxhc) is an Open source Tool sponsored by IBM & released under Eclipse Public Licence v1.0 an command line tool which compares the active system settings and status with the value provided by you. 

Installation
The Installation part is very simple on lnxhc website you can download and install rpm package or download and compile source code the only requirement is you need to install perl v5.8 or later, only some module of perl is require the lnxhc to run, most of linux systems have perl installed by default and to check the perl version on your system you can use following command.

Code: perl -v

You will get the the following Output.

Lnxhc 1.0

Old Linux way To install Download The tar file from Linux Health Checker Website and Extract using following command

Code: tar -xvf lnxhc-1.2.tar.gz

Goto extracted folder

Code: cd lnxhc-1.2/

Then type following command to compile and install

Code: sudo make all install

After installation you can check and run Linux Health Checker tool using following Command.

Code: lnxhc run

Alternative options For Ubuntu users is Health check

Health-check monitors a processes and optionally their child processes and threads for a given amount of time. At the end of the monitoring it will display the CPU time used, wakeup events generated and I/O operations of the given processes. It can be used to diagnose unhealthy bad processes. PPA repository available for Ubuntu

Code: sudo add-apt-repository ppa:colin-king/white

Code: sudo apt-get update && sudo apt-get install health-check -y

before start using Linux Health Check Its better to read man page first.

Code: man health-check

Basic Usage

health-check [options] [command]

The List of available options Options are:
-b brief (terse) output
-c find all child processes on start-up (only useful with -p option)
-d specify the analysis duration in seconds (default is 60 seconds)
-f follow fork/vfork/clone system calls
-h show this help
-p pid[,pid] specify process id(s) or process name(s) to be traced
-m max specify maximum number of system calls to trace (default is 1000000) -o file output results to a json data file
-r resolve IP addresses
-u user run command as a specified user
-v verbose output
-w monitor wakelock count
-W monitor wakelock usage (has overhead)

for example if you running everpad in background so you can run following command using everpad PID

Code: sudo health-check -p 1967

Once the program close you will get the desired output.
- CPU usage
- Kernel wake-up events
- File I/O activity (open,read,write,close)
- System call activity
- Excessive polling of timeout wait blocked system calls (such as poll, select, etc)
- Memory usage (such as heap and stack growth)
- Network connections (to spot rogue internet activity)

So how it can help us?

Let see as an system admin and user called you and said that he is working in gimp and whenever he try to import an image in Gimp, the application crashed. so you start gimp using health-check.

Code: sudo health-check -b gimp

The command will start gimp and once it crashed or closed you will get the output for diagnose the issue.
Ping your blog