Wednesday, May 28, 2014

Install monitoring Utilities like "sar" and "iostat" in Debian Based Distros

Today, I was looking for "sar" (Report System and CPU performance) and "iostat" (Report Disk and IO Performance) on Debian Based Distro i.e. lubuntu.
But didn't find the command, infact it gives me hint that which package contain this command.


root@lubuntu1:~# iostat
The program 'iostat' is currently not installed. You can install it by typing:
apt-get install sysstat
root@lubuntu1:~#

Another, option if you want to know about that which package may contain specific command, just make use of "apt-cache". Just run below command to find out the related packages. Here, I am looking for "iostat".

root@lubuntu1:~# apt-cache search iostat
sysstat - system performance tools for Linux
dstat - versatile resource statistics tool
ganglia-modules-linux - Ganglia extra modules for Linux (IO, filesystems, multicpu)
ifstat - InterFace STATistics Monitoring
nicstat - print network traffic statistics
pcp-import-iostat2pcp - Tool for importing data from iostat into PCP archive logs
r-cran-epi - GNU R epidemiological analysis
r-cran-epibasix - GNU R Elementary Epidemiological Functions
r-cran-rms - GNU R regression modeling strategies by Frank Harrell
root@lubuntu1:~#
Now, we can see that sysstat contains all system performance tools. Let us check further what actually it contains for system monitoring.

root@lubuntu1:~# apt-cache show sysstat
Package: sysstat
Priority: optional
Section: admin
Installed-Size: 848
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Robert Luberda <robert@debian.org>
Architecture: i386
Version: 10.2.0-1
Depends: bzip2, lsb-base (>= 3.0-6), ucf (>= 2.003), debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.7), libsensors4 (>= 1:3.0.0)
Recommends: cron
Suggests: isag
Filename: pool/main/s/sysstat/sysstat_10.2.0-1_i386.deb
Size: 271332
MD5sum: a7057ea16e428c8d9b6a6fc8fd6a3a46
SHA1: b769779a1397b25a121a3a8c47892289a82f1320
SHA256: 0e6bba036c211aa7aa5d8ae89ae7f0fa9a134f60d458ce8da390a8163889b0b1
Description-en: system performance tools for Linux
 The sysstat package contains the following system performance tools:
  - sar: collects and reports system activity information;
  - iostat: reports CPU utilization and disk I/O statistics;
  - mpstat: reports global and per-processor statistics;
  - pidstat: reports statistics for Linux tasks (processes);
  - sadf: displays data collected by sar in various formats;
  - nfsiostat: reports I/O statistics for network filesystems;
  - cifsiostat: reports I/O statistics for CIFS filesystems.

 .
 The statistics reported by sar deal with I/O transfer rates,
 paging activity, process-related activities, interrupts,
 network activity, memory and swap space utilization, CPU
 utilization, kernel activities and TTY statistics, among
 others. Both UP and SMP machines are fully supported.
Description-md5: 53969a0c693353fe5d132e483e9ab770
Homepage: http://pagesperso-orange.fr/sebastien.godard/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y

So, after installing sysstat, we'll be able to run all highlighted commands like iostat, mpstat, sar etc.

So, Finally Install the package using apt-get.

root@lubuntu1:~# apt-get install sysstat
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Suggested packages:
  isag
The following NEW packages will be installed:
  sysstat
0 upgraded, 1 newly installed, 0 to remove and 128 not upgraded.
Need to get 271 kB of archives.
After this operation, 868 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main sysstat i386 10.2.0-1 [271 kB]
Fetched 271 kB in 8s (30.2 kB/s) 
Preconfiguring packages ...
Selecting previously unselected package sysstat.
(Reading database ... 139942 files and directories currently installed.)
Preparing to unpack .../sysstat_10.2.0-1_i386.deb ...
Unpacking sysstat (10.2.0-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up sysstat (10.2.0-1) ...

Creating config file /etc/default/sysstat with new version
update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode
Processing triggers for ureadahead (0.100.0-16) ...
Now, your system have some good commands that you can use for monitoring. Below are few basic example. I'll cover each in separate post with details.

root@lubuntu1:~# iostat
Linux 3.13.0-24-generic (lubuntu1.com)     05/28/2014     _i686_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          24.73    0.03   74.29    0.19    0.00    0.77

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               7.33        97.11        59.68    1809233    1111804
dm-0              0.01         0.04         0.00        768          0
dm-1              9.04        96.38        59.55    1795609    1109536
dm-2              0.15         0.56         0.12      10377       2172




For checking CPU statistics only for every two 2 seconds use "-c 2" option as below:

root@lubuntu1:~# iostat -c   2
Linux 3.13.0-24-generic (lubuntu1.com)     05/28/2014     _i686_    (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          24.73    0.03   74.29    0.19    0.00    0.77

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          21.39    0.00   78.61    0.00    0.00    0.00
root@lubuntu1:~# mpstat
Linux 3.13.0-24-generic (lubuntu1.com)     05/28/2014     _i686_    (1 CPU)

09:56:25 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:56:25 AM  all   24.75    0.03   74.15    0.19    0.00    0.13    0.00    0.00    0.00    0.76
root@lubuntu1:~# mpstat -P ALL
Linux 3.13.0-24-generic (lubuntu1.com)     05/28/2014     _i686_    (1 CPU)

09:56:31 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:56:31 AM  all   24.75    0.03   74.15    0.19    0.00    0.13    0.00    0.00    0.00    0.76
09:56:31 AM    0   24.75    0.03   74.15    0.19    0.00    0.13    0.00    0.00    0.00    0.76

 Thanks!!

No comments:

Post a Comment

Kubernetes 1.31 || Testing the Image Volume mount feature using Minikube

With Kubernetes new version 1.31 ( https://kubernetes.io/blog/2024/08/13/kubernetes-v1-31-release/ ) there are so many features releases for...