Giter Site home page Giter Site logo

sysstat / sysstat Goto Github PK

View Code? Open in Web Editor NEW
2.9K 120.0 440.0 10.73 MB

Performance monitoring tools for Linux

Home Page: https://sysstat.github.io/

License: GNU General Public License v2.0

Shell 1.39% C 88.57% Python 0.50% Perl 0.43% Tcl 1.71% Makefile 1.06% Roff 5.50% M4 0.85%
c monitoring sar iostat mpstat tapestat pidstat performance-monitoring system-monitoring sadf

sysstat's Introduction

sysstat - System performance tools for the Linux operating system

Coverity Scan Build Status Donate

(C) 1999-2024 Sebastien GODARD (sysstat (at) orange (dot) fr)

Introduction

The sysstat package contains various utilities, common to many commercial Unixes, to monitor system performance and usage activity:

  • iostat reports CPU statistics and input/output statistics for block devices and partitions.
  • mpstat reports individual or combined processor related statistics.
  • pidstat reports statistics for Linux tasks (processes) : I/O, CPU, memory, etc.
  • tapestat reports statistics for tape drives connected to the system.
  • cifsiostat reports CIFS statistics.

Sysstat also contains tools you can schedule via cron or systemd to collect and historize performance and activity data:

  • sar collects, reports and saves system activity information (see below a list of metrics collected by sar).
  • sadc is the system activity data collector, used as a backend for sar.
  • sa1 collects and stores binary data in the system activity daily data file. It is a front end to sadc designed to be run from cron or systemd.
  • sa2 writes a summarized daily activity report. It is a front end to sar designed to be run from cron or systemd.
  • sadf displays data collected by sar in multiple formats (CSV, XML, JSON, etc.) and can be used for data exchange with other programs. This command can also be used to draw graphs for the various activities collected by sar using SVG (Scalable Vector Graphics) format.

Default sampling interval is 10 minutes but this can be changed of course (it can be as small as 1 second).

System statistics collected by sar:

  • Input / Output and transfer rate statistics (global, per device, per partition and per network filesystem)
  • CPU statistics (global and per CPU), including support for virtualization architectures
  • Memory, hugepages and swap space utilization statistics
  • Virtual memory, paging and fault statistics
  • Process creation activity
  • Interrupt statistics (global, per CPU and per interrupt, including potential APIC interrupt sources, hardware and software interrupts)
  • Extensive network statistics: network interface activity (number of packets and kB received and transmitted per second, etc.) including failures from network devices; network traffic statistics for IP, TCP, ICMP and UDP protocols based on SNMPv2 standards; support for IPv6-related protocols
  • Fibre Channel traffic statistics
  • Software-based network processing (softnet) statistics
  • NFS server and client activity
  • Sockets statistics
  • Run queue and system load statistics
  • Kernel internal tables utilization statistics
  • Swapping statistics
  • TTY devices activity
  • Power management statistics (instantaneous and average CPU clock frequency, fans speed, devices temperature, voltage inputs)
  • USB devices plugged into the system
  • Filesystems utilization (inodes and blocks)
  • Pressure-Stall Information statistics

Sysstat key features:

  • Display average statistics values at the end of the reports.
  • On-the-fly detection of new devices (disks, network interfaces, etc.) that are created or registered dynamically.
  • Support for UP and SMP machines, including machines with hyperthreaded or multi-core processors.
  • Support for hotplug CPUs (it detects automagically processors that are disabled or enabled on the fly) and tickless CPUs.
  • Works on many different architectures, whether 32- or 64-bit.
  • Needs very little CPU time to run (written in C).
  • System statistics collected by sar/sadc can be saved in a file for future inspection. You can configure the length of data history to keep. There is no limit for this history length but the available space on your storage device.
  • System statistics collected by sar/sadc can be exported in various different formats (CSV, XML, JSON, SVG, etc.). DTD and XML Schema documents are included in sysstat package. JSON output format is also available for mpstat and iostat commands.
  • iostat can display statistics for devices managed by drivers in userspace like spdk.
  • Smart color output for easier statistics reading.

Smart color output

  • Internationalization support (sysstat has been translated into numerous different languages). Sysstat is now part of the Translation Project.
  • Sysstat commands can automatically select the unit used to display sizes for easier reading (see option --human):

Sample iostat output

  • Graphs can be generated (SVG format - Scalable Vector Graphics) and displayed in your favorite web browser. See some sample screenshots below:

Fancy sysstat graph

Fancy sysstat graph

Fancy sysstat graph

Sysstat is Open Source / Free Software, and is freely available under the GNU General Public License, version 2. The latest version of sysstat can always be found on my web site at:

https://sysstat.github.io/

See the CHANGES file to know the new features/improvements/bug fixes added in this release of sysstat.

Sysstat development can be tracked on GitHub.

Installation

Install from RHEL/Fedora/CentOS

Enter:

$ sudo yum install sysstat

CentOS and Fedora systems call the collector process using a cron job in /etc/cron.d and it's enabled by default. On recent versions, systemd is used instead of cron. You may need to enable and start the sysstat service:

$ sudo systemctl enable --now sysstat

(or enter:

$ sudo systemctl enable sysstat
$ sudo systemctl start sysstat

if option --now is not supported by your systemd version.)

Install from Ubuntu

Enter:

$ sudo apt-get install sysstat

Then enable data collecting:

$ sudo dpkg-reconfigure sysstat
Select "Yes"

Install from sources

Clone sysstat public repository with:

$ git clone git://github.com/sysstat/sysstat

Then configure sysstat for your system:

$ cd sysstat
$ ./configure

You can set several variables and parameters on the command line. For example you can enter the following option to activate data collecting (either using cron or systemd):

$ ./configure --enable-install-cron

Enter ./configure --help to display all possible options. Note: There is another way to configure sysstat instead of entering ./configure: This is the Interactive Configuration script (iconfig) which will ask you for the value of the main sysstat variables and parameters. Enter ./iconfig then answer the questions or enter Return to accept the (sane) default values. For yes/no questions, answer 'y' or 'n' (without the quotes): It is case sensitive! You can also enter '?' to get a help message that will explain the meaning of each variable or parameter.

Compile and install:

$ make
$ sudo make install

Feedback welcome!

Please use the BUG_REPORT template file to report a bug: It contains important data that should be provided for this. Please also remember to read the FAQ that comes with sysstat or is available from the Wiki page on GitHub.

Opening an issue or a pull request on GitHub is the preferred way to report a bug or submit a patch. Patches and suggestions for improvements are always welcome!

Support sysstat!

If you are reading this README file then you are probably about to use the sysstat tools to help you monitor your system and maybe troubleshoot some performance issues. Good choice. Sysstat is made for you. Moreover sysstat is free software and always will be.

Yet have you ever considered making a donation to sysstat, regardless of how much your contribution is? This in turn would encourage me to keep up the work as good as it can be...

Click on the "Donate PayPal" button above at the beginning of this file. You can also make a donation as a sponsor from the GitHub page or from my personal web page.

Enjoy!

--

Sebastien GODARD - sysstat (at) orange (dot) fr

sysstat's People

Contributors

cpaelzer avatar darktemplarbasealt avatar dnarc avatar jimis avatar joungkyun avatar kosaki avatar lzaoral avatar mator avatar mk-fg avatar mnogu avatar msekletar avatar nanaze avatar nanxiao avatar natepw avatar natoscott avatar notstudyingtoday avatar odubaj avatar parthsl avatar petrpavlu avatar pkopylov avatar portante avatar rtoax avatar scop avatar shaleenbathla avatar stevekay avatar sysstat avatar troosh avatar tuplanolla avatar xcorail avatar yrro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sysstat's Issues

sadf in sysstat-10.2.1 produces broken json output

Problem seem to be with missing comma before new "file-utc-time" parameter:

...
"number-of-cpus": 1,
"file-date": "2014-02-18"
"file-utc-time": "18:00:00",
"statistics": [
...

Should be easily visible near the top of e.g. sadf -jt -- -A /var/log/sa/sa18 output (line 11 for me). Adding comma in that place fixes json and makes it parseable.

sysstat-10.2.0 and earlier versions doesn't seem to have the issue.

pidstat does not handle processes with spaces in their name

I noticed that the cpu utilization for the process named Plex New Transc was wrong.

cat /proc/5768/stat
5768 (Plex New Transc) S 1264 1252 1252 0 -1 1077960704 17317 0 18 0 9260 137 0 0 15 -5 8 0 1430749 186589184 16704 18446744073709551615 1 1 0 0 0 0 0 0 8404998 18446744073709551615 0 0 17 1 0 0 22 0 0 0 0 0 0 0 0 0 0

The bug is caused by the use of fscanf in pidstat.read_proc_pid_stat. fscanf stops early due to the space in the process name.

Using ( and ) to delimit the process name would solve this problem. Looks like htop does something similar to this.

I'll try my hand at a patch if you don't beat me to it :)

11.1.6: multiple headers in sar output CPU section

11.1.6 In report files /var/log/sa/sarDD multiple headers in CPU section:

CPU %usr %nice %sys %iowait %steal %irq %soft %guest %gnice %idle
bla-bla-bla
CPU %usr %nice %sys %iowait %steal %irq %soft %guest %gnice %idle
...
CPU %usr %nice %sys %iowait %steal %irq %soft %guest %gnice %idle

For example in version 7.0.2 only one header in CPU section.

sar does not combine -P ALL -n DEV

Source is from the latest git:

debian:~/sysstat$ PATH=.:$PATH # for sadc
debian:~/sysstat$ ./sar -P ALL -n DEV 1
Linux 3.2.0-4-amd64 (debian)      08/24/14        _x86_64_        (16 CPU)

06:55:05        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
06:55:06           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
06:55:06         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

06:55:06        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
06:55:07           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
06:55:07         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

As you can see there is no cpu stat.

Rendering of SVG broken on IE11+Edge 13.1

Unsure whether it's Microsoft's rendering engine or the SVG syntax used by sysstat (perhaps Microsoft code is pedantic and requires strict conformance?).

Figured worth highlighting this while the SVG aspects are still being developed.

Chrome 48 (good)
http://i.imgur.com/GdE41Ci.png

Opera 35 (good)
http://i.imgur.com/7cM84Yi.png

Firefox 44 (good)
http://i.imgur.com/GDzcu4A.png

IE11 (bad, values not plotted and only displays first graph)
http://i.imgur.com/T1xBxKI.png

Edge (bad, values plotted but second graph leaks over first one)
http://i.imgur.com/wY7LIoQ.png

sar should detect compressed files and decompress

It's nice to see you added compression to older sar files. The feature is underdocumented and only partly supported. I'd like to help. I've written a wrapper to sar. See my repo here: https://github.com/otheus/sar-helper
Essentially, if sar is told (with -f) to use a file that is compressed, it tries to decompress it.

To me, this code should be within sar itself. I've forked the project. I await your comments on how to proceed.

pidstat outputs a strange (>100%) value for %CPU

pidstat sometimes outputs a strange value (> 100%) for %CPU, %user, and %sys.

pidstat allocates a fixed size array for process information (in pid_sys_init() function). If many processes with a smaller PID are created while pidstat is running, the processes with bigger PID are not checked, meaning /proc//stat are not checked. This can make a situation that the previous process information doesn't exist. When there is no previous process data, it's regarded as 0. When the value of the user time in /proc//stat is 2415, pidstat outputs the following value for %user:

(2415-0)/200*100 = 1207.50 (%)

This value is over 100%, which is wrong.

One way to fix this issue is by increasing value of NR_PID_PREALLOC constant. I've found out by testing, that value of 170 fixes the issue in my environment, so I would propose value of 300 as a safe number. Other solutions are also possible, such as using dynamic array..

What do you think?

rd_stats.c:835: possible bad call to fscanf ?

[rd_stats.c:835]: (warning) scanf without field width limits can crash with huge input data.

Source code is

n = fscanf(fp, "%s", duplex);

Suggest new code

n = fscanf(fp, "%32s", duplex);

sysstat shows invalid CPU stats on KVM

On KVM virtual machines running Debian Wheezy I'm getting invalid CPU stats.
Either steal goes up to 100% or all metrics show 0%.

The problem disappears after a reboot, but reappears after a few hours, see below.

sysstat version: 11.0.1-1
kernel version: Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux
$ cat /etc/debian_version
8.3

11:02:02 AM       LINUX RESTART (1 CPU)

11:05:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
11:15:01 AM     all      1.94      0.00      0.55      0.06      0.02     97.44
11:25:01 AM     all      1.82      0.00      0.56      0.05      0.01     97.56
11:35:01 AM     all      2.85      0.00      0.71      0.05      0.02     96.37
11:45:01 AM     all      1.94      0.00      0.51      0.04      0.01     97.50
11:55:01 AM     all      1.72      0.00      0.48      0.04      0.00     97.76
12:05:01 PM     all      2.53      0.00      0.60      0.06      0.00     96.82
12:15:01 PM     all      1.74      0.00      0.45      0.04      0.00     97.78
12:25:01 PM     all      1.69      0.00      0.45      0.05      0.00     97.80
12:35:01 PM     all      2.63      0.00      0.57      0.05      0.01     96.74
12:45:01 PM     all      1.78      0.00      0.49      0.04      0.01     97.67
12:55:01 PM     all      1.72      0.00      0.49      0.04      0.01     97.74
01:05:01 PM     all      2.60      0.00      0.57      0.05      0.01     96.77
01:15:01 PM     all      0.00      0.00      0.00      0.00    100.00      0.00
01:25:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:35:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:45:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:55:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
02:05:01 PM     all      0.00      0.00      0.00      0.00    100.00      0.00
02:15:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
Average:        all      0.00      0.00      0.00      0.00    100.00      0.00

Any idea what would cause this?

Thanks in advance!

build error: 'SCHED_IDLE' undeclared (first use in this function)

[root@BO sysstat-11.0.0]# ./configure --prefix=/usr/local/sysstat-11.0.0 > /dev/null

[root@BO sysstat-11.0.0]# time make > /dev/null
pidstat.c: In function 'write_pid_task_all_stats':
pidstat.c:1393: error: 'SCHED_IDLE' undeclared (first use in this function)
pidstat.c:1393: error: (Each undeclared identifier is reported only once
pidstat.c:1393: error: for each function it appears in.)
pidstat.c: In function 'write_pid_rt_stats':
pidstat.c:2025: error: 'SCHED_IDLE' undeclared (first use in this function)
make: *** [pidstat.o] Error 1

[root@BO sysstat-11.0.0]# grep --color 'SCHED_IDLE' -C 5 -r .
./pidstat.h-#define GET_POLICY(p)
./pidstat.h- (p == SCHED_NORMAL ? "NORMAL" :
./pidstat.h- (p == SCHED_FIFO ? "FIFO" :
./pidstat.h- (p == SCHED_RR ? "RR" :
./pidstat.h- (p == SCHED_BATCH ? "BATCH" :
./pidstat.h: (p == SCHED_IDLE ? "IDLE" :
./pidstat.h- "?")))))
./pidstat.h-
./pidstat.h-struct pid_stats {
./pidstat.h- unsigned long long read_bytes attribute ((aligned (16)));
./pidstat.h- unsigned long long write_bytes attribute ((packed));

[root@BO sysstat-11.0.0]# chrt -m
SCHED_OTHER min/max priority : 0/0
SCHED_FIFO min/max priority : 1/99
SCHED_RR min/max priority : 1/99
SCHED_BATCH min/max priority : 0/0

[root@BO sysstat-11.0.0]# grep --color '#define SCHED_' -r /usr/include/
/usr/include/linux/sched.h:#define SCHED_NORMAL 0
/usr/include/linux/sched.h:#define SCHED_FIFO 1
/usr/include/linux/sched.h:#define SCHED_RR 2
/usr/include/linux/sched.h:#define SCHED_BATCH 3
/usr/include/bits/sched.h:#define SCHED_OTHER 0
/usr/include/bits/sched.h:#define SCHED_FIFO 1
/usr/include/bits/sched.h:#define SCHED_RR 2

[root@BO sysstat-11.0.0]# cat /proc/version
Linux version 2.6.18-194.el5 ([email protected]) (gcc version
4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:39 EDT 2010

[root@BO sysstat-11.0.0]# uname -a
Linux BO 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

[root@BO sysstat-11.0.0]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

[RFE] Collect /proc/net/netstat

In order to better understand TCP performance over time on a system it'd be great if sar collected /proc/net/netstat as well (TCPLostRetransmit TCPRenoFailures TCPSackFailures TCPLossFailures... and all the other fields)

How to build sysstat on Mac OS

I used the following commands to build

wget http://pagesperso-orange.fr/sebastien.godard/sysstat-11.1.5.tar.bz2
tar xvfj sysstat-11.1.5.tar.bz2
cd sysstat-11.1.5
./configure --enable-install-cron
make && make install

But it runs into error:

gcc -o sadc.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  sadc.c
sadc.c:1128:8: warning: implicit declaration of function 'fdatasync' is invalid
      in C99 [-Wimplicit-function-declaration]
                        if (fdatasync(ofd) < 0) {
                            ^
1 warning generated.
gcc -o sa_wrap.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  sa_wrap.c
gcc -o sa_common.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  sa_common.c
sa_common.c:134:31: error: use of undeclared identifier 'PATH_MAX'
        static char link[32], target[PATH_MAX];
                                     ^
sa_common.c:141:21: error: use of undeclared identifier 'target'
        r = readlink(link, target, PATH_MAX);
                           ^
sa_common.c:141:29: error: use of undeclared identifier 'PATH_MAX'
        r = readlink(link, target, PATH_MAX);
                                   ^
sa_common.c:142:21: error: use of undeclared identifier 'PATH_MAX'
        if (r <= 0 || r >= PATH_MAX) {
                           ^
sa_common.c:146:2: error: use of undeclared identifier 'target'
        target[r] = '\0';
        ^
sa_common.c:149:21: error: use of undeclared identifier 'target'
        devname = basename(target);
                           ^
6 errors generated.
make: *** [sa_common.o] Error 1

Process consuming IO

 I have a feature request. Afaik iotop displays which process is consuming how much IO. Can we have an option in iostat to display process-wise IO ?
 If this request makes sense I would be more than happy to contribute..

Build failure under CentOS 6 using 11.3.1

Hi,

I tried building sysstat under CentOS 6 using the default instructions:

./configure
make
make install

However, I get a lot of make: o: Command not found when trying to compile the translation files like:

o nls/af.gmo nls/af.po
make: o: Command not found

Not sure if o is a real command that is missing or if there is something fishy in the build directly. Current simple workaround is to disable translation support when building using:

./configure --disable-nls
make
make install

I can provide you the full configure and build log files if needed.

Regards,
Matt

Incompatible change in specifying count on command-line

We have two different environments running different versions of sar. The one running 7.0.2 accepts 0 as count to meam "run until killed". In the other environment that runs 9.0.4, it doesn't like 0 as count, but rather expects no count for the same behavior. Looking at the sar.c, it looks like a bug at line 1304. Count starts with 0, and it is an acceptable default when no count is specified on command-line, but treated as an error when specified explicitly. I think the fix should be to change count < 1 to count < 0.

Does not ./configure with error: configure: error: C compiler cannot create executables

checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/flasht/sysstat-master':
configure: error: C compiler cannot create executables

gcc is installed... i do use it and I assure you that it can create executables... so what is the problem?


-----------

Core tests.

-----------

configure:2316: checking for gcc
configure:2332: found /usr/bin/gcc
configure:2343: result: gcc
configure:2572: checking for C compiler version
configure:2581: gcc --version >&5
gcc-4.4.real (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2592: $? = 0
configure:2581: gcc -v >&5
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)
configure:2592: $? = 0
configure:2581: gcc -V >&5
gcc-4.4.real: '-V' option must have argument
configure:2592: $? = 1
configure:2581: gcc -qversion >&5
gcc-4.4.real: unrecognized option '-qversion'
gcc-4.4.real: no input files
configure:2592: $? = 1
configure:2612: checking whether the C compiler works
configure:2634: gcc conftest.c >&5
/usr/bin/ld.bfd.real: cannot find -lgcc_s
collect2: ld returned 1 exit status
configure:2638: $? = 1
configure:2676: result: no
configure: failed program was:
| /* confdefs.h /
| #define PACKAGE_NAME "sysstat"
| #define PACKAGE_TARNAME "sysstat"
| #define PACKAGE_VERSION "11.1.3"
| #define PACKAGE_STRING "sysstat 11.1.3"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /
end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2681: error: in /home/flasht/sysstat-master': configure:2683: error: C compiler cannot create executables Seeconfig.log' for more details

sar skips long filesystem names

If a filesystem is more than 72 characters in length, sar skips it.

Curious how the 72 limit in rd_stats.h was arrived at, and whether it should be increased. Or use MAX_FILE_LEN which is defined as 256 in common.h ?

/* Maximum length of filesystem name */
#define MAX_FS_LEN      72

Example:

$ mount|grep lvname
/dev/mapper/foo-longlvname12345678901234567890123456789012345678901234567890 on /mnt type ext2 (rw,relatime,seclabel)
/dev/mapper/foo-shortlvname on /mnt2 type ext2 (rw,relatime,seclabel)
$ ./sar -F 1 1
Linux 3.18.7-100.fc20.x86_64 (localhost.localdomain)    03/13/2015      _x86_64_        (2 CPU)

04:56:11 AM  MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM
04:56:12 AM      6866     10850     61.24     66.45    902345    258647     22.28 /dev/sda5
04:56:12 AM       170       113     39.88     46.61     76592       320      0.42 /dev/sda2
04:56:12 AM        12         0      0.91      6.07      3061        11      0.36 /dev/mapper/foo-shortlvname

Summary:     MBfsfree  MBfsused   %fsused  %ufsused     Ifree     Iused    %Iused FILESYSTEM
Summary:         6866     10850     61.24     66.45    902345    258647     22.28 /dev/sda5
Summary:          170       113     39.88     46.61     76592       320      0.42 /dev/sda2
Summary:           12         0      0.91      6.07      3061        11      0.36 /dev/mapper/foo-shortlvname
$

name bug in ioc_name() ?

Hi, It looks like ioc_name does not work as expected.

I added a line to the following function and it outputs as following. The device name should be "rbd_" but it outputs "emcpower_".

void read_diskstats_stat(int curr) {
if ((ioc_dname = ioc_name(major, minor)) != NULL) {
if (strcmp(dev_name, ioc_dname) && strcmp(ioc_dname, K_NODEV)) {
/*
* No match: Use name generated from sysstat.ioconf data
* (if different from "nodev") works around known issues
* with EMC PowerPath.
*/
++ printf("dev_name=%s, ioc_name=%s\n", dev_name, ioc_dname);
strncpy(dev_name, ioc_dname, MAX_NAME_LEN);
}
}
}

root@client:/sys/block# /usr/local/bin/iostat -V
sysstat version 10.3.1
(C) Sebastien Godard (sysstat orange.fr)

root@client:/sys/block# /usr/local/bin/iostat
Linux 3.2.16emulab1 (client.ceph.cloud-storage.emulab.net) 03/17/2014 x86_64 (64 CPU)

dev_name=rbd4, ioc_name=emcpowerig
dev_name=rbd5, ioc_name=emcpowerhq
dev_name=rbd6, ioc_name=emcpowerha
dev_name=rbd7, ioc_name=emcpowergk
dev_name=rbd8, ioc_name=emcpowerfu
dev_name=rbd9, ioc_name=emcpowerfe
dev_name=rbd10, ioc_name=emcpowereo
dev_name=rbd11, ioc_name=emcpowerdy
dev_name=rbd12, ioc_name=emcpowerdi
dev_name=rbd13, ioc_name=emcpowercs
dev_name=rbd14, ioc_name=emcpowercc
dev_name=rbd15, ioc_name=emcpowerbm
dev_name=rbd16, ioc_name=emcpoweraw
dev_name=rbd17, ioc_name=emcpowerag
dev_name=rbd18, ioc_name=emcpowerq
dev_name=rbd19, ioc_name=emcpowera
avg-cpu: %user %nice %system %iowait %steal %idle
0.01 0.00 0.03 0.01 0.00 99.96

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sdb 0.15 0.45 1.19 3090 8184
sdc 0.03 0.11 0.00 744 0
sdd 0.03 0.11 0.00 744 0
sde 0.03 0.11 0.00 744 0
sdg 0.03 0.11 0.00 744 0
sdf 0.03 0.11 0.00 744 0
sda 1.51 25.09 3.61 171981 24724
rbd0 0.03 0.10 0.00 697 4
rbd1 0.03 0.10 0.00 697 4
rbd2 0.03 0.10 0.00 701 4
rbd3 0.03 0.11 0.00 741 24
emcpowerig 0.03 0.11 0.00 741 24
emcpowerhq 0.03 0.10 0.00 701 4
emcpowerha 0.03 0.10 0.00 701 4
emcpowergk 0.03 0.10 0.00 701 4
emcpowerfu 0.03 0.10 0.00 701 4
emcpowerfe 0.03 0.10 0.00 701 4
emcpowereo 0.03 0.10 0.00 701 4
emcpowerdy 0.03 0.10 0.00 701 4
emcpowerdi 0.03 0.10 0.00 701 4
emcpowercs 0.03 0.10 0.00 701 4
emcpowercc 0.03 0.10 0.00 701 4
emcpowerbm 0.03 0.10 0.00 701 4
emcpoweraw 0.03 0.10 0.00 701 4
emcpowerag 0.03 0.10 0.00 701 4
emcpowerq 0.03 0.10 0.00 701 4
emcpowera 0.02 0.10 0.00 678 0
rbd20 0.01 0.05 0.00 344 0
rbd21 0.01 0.05 0.00 344 0
rbd22 0.01 0.05 0.00 344 0

[major, minor] for rbd block devices

root@client:/mnt/sdb2/sysstat-10.3.1# ls -l /dev/rbd*
brw-rw---- 1 root disk 251, 0 Mar 17 16:30 /dev/rbd0
brw-rw---- 1 root disk 250, 0 Mar 17 16:30 /dev/rbd1
brw-rw---- 1 root disk 241, 0 Mar 17 16:44 /dev/rbd10
brw-rw---- 1 root disk 240, 0 Mar 17 16:44 /dev/rbd11
brw-rw---- 1 root disk 239, 0 Mar 17 16:44 /dev/rbd12
brw-rw---- 1 root disk 238, 0 Mar 17 16:44 /dev/rbd13
brw-rw---- 1 root disk 237, 0 Mar 17 16:44 /dev/rbd14
brw-rw---- 1 root disk 236, 0 Mar 17 16:44 /dev/rbd15
brw-rw---- 1 root disk 235, 0 Mar 17 16:45 /dev/rbd16
brw-rw---- 1 root disk 234, 0 Mar 17 16:45 /dev/rbd17
brw-rw---- 1 root disk 233, 0 Mar 17 16:45 /dev/rbd18
brw-rw---- 1 root disk 232, 0 Mar 17 16:45 /dev/rbd19
brw-rw---- 1 root disk 249, 0 Mar 17 16:30 /dev/rbd2
brw-rw---- 1 root disk 231, 0 Mar 17 16:45 /dev/rbd20
brw-rw---- 1 root disk 230, 0 Mar 17 16:45 /dev/rbd21
brw-rw---- 1 root disk 229, 0 Mar 17 16:46 /dev/rbd22
brw-rw---- 1 root disk 248, 0 Mar 17 16:31 /dev/rbd3
brw-rw---- 1 root disk 247, 0 Mar 17 16:43 /dev/rbd4
brw-rw---- 1 root disk 246, 0 Mar 17 16:43 /dev/rbd5
brw-rw---- 1 root disk 245, 0 Mar 17 16:44 /dev/rbd6
brw-rw---- 1 root disk 244, 0 Mar 17 16:44 /dev/rbd7
brw-rw---- 1 root disk 243, 0 Mar 17 16:44 /dev/rbd8
brw-rw---- 1 root disk 242, 0 Mar 17 16:44 /dev/rbd9

Remove init script for RHEL / Fedora / CentOS and use @reboot in sysstat cron instead

systat.in does not build a proper init script for the platforms listed above. Namely, the init script is missing the init library:

# Source function library.
. /etc/rc.d/init.d/functions

Integration tools such as puppet and chef depend on the fact that services make use of the init library, and are confused by the fact that systat does not. Puppet for example always attempts to start systat because it has no reasonable way of detecting whether systat is already running due to a lack of support in the init script.

Please update the service file to properly use the init library. DevOps depends on it.

sa_conv.c:91: bad size in memset

[sa_conv.c:91]: (error) Buffer is accessed out of bounds: file_magic.pad

   memset(file_magic->pad, 0, 64);

but

unsigned char pad[63];

sadf: New output format to add : SVG ?

Hello,
I appreciate a lot sysstat, and I recently made a try to convert sadf data into svg (sar2svg).
I think that should be a great enhancement if sadf has the option internally (-S ?), so I suggest you to take this into account :)
Bye

sysstat fails to install as non-root user

Some users and distributions like Gentoo wants to install files into $(DESTDIR) before actually install into the root directory.
However if the distribution uses systemd this is not possible:

/usr/bin/install: cannot create regular file ‘/usr/lib/systemd/system/sysstat.service’: Permission denied

The current code for installing into a system using systemd has two flaws:
$(INSTALL_DATA) sysstat.service $(SYSTEMD_UNIT_DIR);
This line needs rw-permissions to /. Please change it to
$(INSTALL_DATA) sysstat.service $(DESTDIR)$(SYSTEMD_UNIT_DIR); \

$(SYSTEMCTL) enable sysstat.service;
This tries to activate a service that might not even be correctly installed yet.
Or maybe not even meant for this system (as I might build and install this package into a DESTDIR to be able to move these files onto an embedded system or alike).
So please leave this to the distribution or the user to correctly activate this for their setup, rather then trying to activate it for all users.

[Feature Request] iostat with disk error stats

Please add the new feature to show disk error stats along with io stats as it is supported in Solaris version of iostat as shown below.

$ iostat -xnze 1
extended device statistics ---- errors ---
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b s/w h/w trn tot device
0.0 0.0 0.1 0.0 0.0 0.0 0.3 0.6 0 0 0 0 0 0 lofi1
0.0 0.0 0.2 0.1 0.0 0.0 0.0 0.0 0 0 0 0 0 0 ramdisk1
0.1 0.0 0.5 0.0 0.0 0.0 0.0 0.1 0 0 0 0 0 0 c0t0d0
1.5 33.9 146.0 1062.6 0.0 0.0 0.0 1.2 0 1 0 0 0 0 c0t1d0
[...]

$ iostat -En
c1t0d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: iDRAC Product: LCDRIVE Revision: 0323 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
c2t0d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: iDRAC Product: Virtual CD Revision: 0323 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
[...]

Thanks.

Max value for txkB/s in sar

Hello guys,

I have a pretty strange behaviour with sar, we generate HTTP traffic on a 10G nic, we graph the throughput on grafana and we see value like ~8/9 Gb/s on this nic.

But sar seems to be stuck at this value :1 200 000 txkB/s.

Do you have any ideas about this max value ?

We have the same behaviour with nmon, but with iftop we can see the real throughput.

OS : centos 7 x86_64

%ifstat for 10Gig network interface is wrong

For example this shows %Ifutil to be 172% although sum of txKB/s and rxkB/s is about 298,000 kB/s while interface should be able to handle 1,300,000 kB/s.

09:47:36 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
Average: eth1 12302.69 200575.41 966.02 296813.87 0.00 0.00 0.00 172.44

[RFE] Collect HBA statistics

Wondered about the possibility of collecting FC HBA statistics (/sys/class/fc_host/statistics). Tend to see a few real-world performance issues at the SAN fabric level so may be useful.

Have started with some early ideas at https://github.com/stevekay/sysstat, introducing a "-a" parameter and just collecting txframes and rxframes currently.

iowait spike bug with mpstat 10.0.3

Several of our and our clients' hosts are experiencing large spikes in iowait measures using mpstat.

The range of the spike varies, we have seen values between 80K and 12M. These spikes occur occasionally on specific hosts, for instance 1-2x/week. The rest of the time the values reported are within normal range.

All hosts (~10 that we checked) that are reporting this phenomenon have mpstat version 10.0.3.

Hosts that haven't shown any spikes in the past month (6 checked) are on 9.0.6.

Thanks!

Invalid CPU-related output (CPU usage in the tens of thousands percent)

Hi,

I've run this command:

pidstat -h -r -u -l -C java 1 >> pidstat.txt

The file pidstat.txt has about 214kbytes, about 1600 lines and starts with:

Linux 2.6.32-358.11.1.el6.x86_64 (hadoop-164)   10/28/2013      _x86_64_        (2 CPU)

There are some timestamps for which the sum of CPU usage for all processes is slightly over 200%. (Maybe it has something to do with 4.4 in http://sebastien.godard.pagesperso-orange.fr/faq.html#pidstat)

But there is one timestamp for which the sum of CPU usage is way over 200%. Somewhere in the middle of the file I've found this:

#      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
 1382954870      9070    0.00    0.00    0.00    0.00     1      2.00      0.00 2760612 142676   3.64  /usr/java/default/bin/java -Dproc_namenode -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -Dcom.sun.m
 1382954870      9220    0.00    0.00    0.00    0.00     1      2.00      0.00 2716832 222168   5.66  /usr/java/default/bin/java -Dproc_secondarynamenode -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -D
 1382954870      9313    1.00    1.00    0.00    2.00     1      0.00      0.00 2780532 153112   3.90  /usr/java/default/bin/java -Dproc_jobtracker -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -Dcom.sun
 1382954870     16199    0.00    0.00    0.00    0.00     1      3.00      0.00 1595236  91828   2.34  /usr/java/default//bin/java -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/home/mmmmm/hhh

#      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
 1382954871      9070    1.00    1.00    0.00    2.00     1     35.00      0.00 2760612 142740   3.64  /usr/java/default/bin/java -Dproc_namenode -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -Dcom.sun.m

#      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
 1382954872      9220    1.00    0.00    0.00    1.00     1      0.00      0.00 2716832 222168   5.66  /usr/java/default/bin/java -Dproc_secondarynamenode -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -D
 1382954872     16199 33162.00 9627.00    0.00 42789.00     1  62477.00      0.00 1595236  91828   2.34  /usr/java/default//bin/java -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/home/mmmmm/hhh
 1382954872     16267 68875.00 10469.00    0.00 79344.00     0 253793.00      0.00 1662464 115128   2.93  /usr/java/default//bin/java -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/home/mmmmm/hhh

#      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM  Command

#      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
 1382954874      9313    1.00    0.00    0.00    1.00     1      0.00      0.00 2780532 153112   3.90  /usr/java/default/bin/java -Dproc_jobtracker -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -Dcom.sun

#      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
 1382954875      9070    1.00    0.00    0.00    1.00     1      0.00      0.00 2760612 142740   3.64  /usr/java/default/bin/java -Dproc_namenode -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -Dcom.sun.m
 1382954875      9313    0.00    0.00    0.00    0.00     1      2.00      0.00 2780532 153112   3.90  /usr/java/default/bin/java -Dproc_jobtracker -Xmx2048m -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -Dcom.sun
 1382954875      9481    1.00    0.00    0.00    1.00     1      2.00      0.00 2184424  77812   1.98  /usr/java/jdk1.7.0_21/bin/java -Dquest7.cid=/opt/aaaaaaa/mmmmmmmmmm -Duser.timezone= -Dquest7.root=/opt/aaaaaaa/mmmmm -classpat
 1382954875     16267    1.00    0.00    0.00    1.00     0      3.00      0.00 1662464 115128   2.93  /usr/java/default//bin/java -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/home/mmmmm/hhh

The CPU-related values shown for processes 16199 and 16267 at timestamp 1382954872 are way out of range (CPU usage 42789.00% and 42789.00%, respectively).

Allow wider Device: column when using iostat -N

Great output for LVM users is hardly readable when LV/VG names are long :(
Detect terminal width or allow to provide column size as option?

Example:
Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 38.93 0.30 157.30 0.02 5.26 68.60 6.90 43.80 38.22 43.81 4.94 77.81
sdb 0.00 39.33 0.60 156.87 0.03 5.26 68.71 6.93 44.00 25.39 44.08 4.28 67.47
sdc 0.17 0.43 246.77 189.33 6.07 5.01 52.02 0.33 0.76 0.87 0.62 0.15 6.69
md5 0.00 0.00 0.33 0.33 0.02 0.00 60.40 0.00 0.00 0.00 0.00 0.00 0.00
md9 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
vg_raid10_bitmap-root 0.00 0.00 0.33 0.27 0.02 0.00 67.11 0.06 93.50 53.30 143.75 46.11 2.77
vg_raid10_bitmap-host7_backup 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
md3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
md8 0.00 0.00 0.10 29.30 0.00 0.26 18.56 0.00 0.00 0.00 0.00 0.00 0.00
md10 0.00 0.00 0.47 162.17 0.03 4.99 63.17 0.00 0.00 0.00 0.00 0.00 0.00
vg_raid10_dmcache-foo_pl_postgresql 0.00 0.00 246.77 161.10 6.06 4.98 55.48 36.51 89.51 0.89 225.26 2.09 85.44
vg_raid10_dmcache-foo_main_postgresql_cachepool_cdata 0.00 0.00 0.17 29.33 0.00 0.27 18.71 0.00 0.12 0.00 0.12 0.08 0.25
vg_raid10_dmcache-foo_main_postgresql_cachepool_cmeta 0.00 0.00 0.00 0.53 0.00 0.00 6.00 0.00 0.00 0.00 0.00 0.00 0.00
vg_raid10_dmcache-foo_main_postgresql_corig 0.00 0.00 0.10 29.30 0.00 0.26 18.56 7.79 264.87 41.33 265.63 12.63 37.12
vg_raid10_dmcache-foo_main_postgresql 0.00 0.00 0.23 29.10 0.00 0.26 18.74 7.79 265.61 17.71 267.60 12.65 37.12
vg_raid10_dmcache-foocass1_cachepool_cdata 0.00 0.00 0.00 0.80 0.00 0.00 7.00 0.00 0.58 0.00 0.58 0.42 0.03
vg_raid10_dmcache-foocass1_cachepool_cmeta 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
vg_raid10_dmcache-foocass1_corig 0.00 0.00 0.00 0.87 0.00 0.00 7.08 0.10 119.46 0.00 119.46 80.12 6.94
vg_raid10_dmcache-foocass1 0.00 0.00 0.00 0.77 0.00 0.00 8.00 0.10 135.65 0.00 135.65 91.00 6.98
vg_raid10_dmcache-foo_pl_postgresql_cachepool_cdata 0.00 0.00 246.77 155.37 6.06 4.73 54.96 0.33 0.83 0.88 0.74 0.16 6.52
vg_raid10_dmcache-foo_pl_postgresql_cachepool_cmeta 0.00 0.00 0.00 3.73 0.00 0.01 6.00 0.00 0.04 0.00 0.04 0.03 0.01
vg_raid10_dmcache-foo_pl_postgresql_corig 0.00 0.00 0.47 161.30 0.03 4.98 63.47 35.95 222.23 10.21 222.84 5.22 84.42

sadf -j outputs malformed json

There is a missing comma between "net-sock" and "fc-hosts".

$ sadf -V │
sysstat version 11.1.5
(C) Sebastien Godard (sysstat orange.fr)

Sample output from : $ sadf -j -T -- -A >> sampleSysstat.json

{
"sysstat": {
"sysdata-version": 3.1,
"hosts": [
    {
         // snip
        "statistics": [
            {
                "timestamp": { // snip },
                "cpu-load": [ // snip ],
                "process-and-context-switch": {"proc": 0.17, "cswch": 6804.27},
                "swap-pages": {"pswpin": 0.00, "pswpout": 0.00},
                "paging": {"pgpgin": 1.21, "pgpgout": 332.80, "fault": 1541.61, "majflt": 0.01, "pgfree": 2511.99, "pgscank": 0.00, "pgscand": 0.00, "pgsteal": 0.00, "vmeff-percent": 0.00},
                "io": {"tps": 4.92, "io-reads": {"rtps": 0.04, "bread": 2.43}, "io-writes": {"wtps": 4.88, "bwrtn": 665.60}},
                "memory": {"memfree": 8229844, "memused": 4051284, "memused-percent": 32.99, "buffers": 125564, "cached": 1537664, "commit": 8045848, "commit-percent": 36.50, "active": 2831940, "inactive": 891328, "dirty": 3596, "anonpg": 2060136, "slab": 143912, "kstack": 10096, "pgtbl": 47916, "vmused": 138332, "swpfree": 9764860, "swpused": 0, "swpused-percent": 0.00, "swpcad": 0, "swpcad-percent": 0.00, "frmpg": 173.86, "bufpg": 0.73, "campg": 1.16},
                "hugepages": {"hugfree": 0, "hugused": 0, "hugused-percent": 0.00},
                "kernel": {"dentunusd": 87474, "file-nr": 7712, "inode-nr": 63410, "pty-nr": 16},
                "queue": {"runq-sz": 0, "plist-sz": 631, "ldavg-1": 1.63, "ldavg-5": 1.77, "ldavg-15": 1.13, "blocked": 0},
                "serial": [
                    {"line": 0, "rcvin": 0.00, "xmtin": 0.00, "framerr": 0.00, "prtyerr": 0.00, "brk": 0.00, "ovrun": 0.00}
                ],
                "disk": [
                    {"disk-device": "dev8-0", "tps": 4.92, "rd_sec": 2.43, "wr_sec": 665.60, "avgrq-sz": 135.78, "avgqu-sz": 0.01, "await": 1.76, "svctm": 0.39, "util-percent": 0.19},
                    {"disk-device": "dev8-16", "tps": 0.00, "rd_sec": 0.00, "wr_sec": 0.00, "avgrq-sz": 0.00, "avgqu-sz": 0.00, "await": 0.00, "svctm": 0.00, "util-percent": 0.00},
                    {"disk-device": "dev8-32", "tps": 0.00, "rd_sec": 0.00, "wr_sec": 0.00, "avgrq-sz": 0.00, "avgqu-sz": 0.00, "await": 0.00, "svctm": 0.00, "util-percent": 0.00}
                ],
                "network": {
                    "net-dev": [
                        {"iface": "enp7s0", "rxpck": 176.31, "txpck": 91.44, "rxkB": 255.66, "txkB": 6.47, "rxcmp": 0.00, "txcmp": 0.00, "rxmcst": 0.00, "ifutil-percent": 2.09},
                        {"iface": "lo", "rxpck": 0.22, "txpck": 0.22, "rxkB": 0.02, "txkB": 0.02, "rxcmp": 0.00, "txcmp": 0.00, "rxmcst": 0.00, "ifutil-percent": 0.00}
                    ],
                    "net-edev": [
                        {"iface": "enp7s0", "rxerr": 0.00, "txerr": 0.00, "coll": 0.00, "rxdrop": 0.00, "txdrop": 0.00, "txcarr": 0.00, "rxfram": 0.00, "rxfifo": 0.00, "txfifo": 0.00},
                        {"iface": "lo", "rxerr": 0.00, "txerr": 0.00, "coll": 0.00, "rxdrop": 0.00, "txdrop": 0.00, "txcarr": 0.00, "rxfram": 0.00, "rxfifo": 0.00, "txfifo": 0.00}
                    ],
                    "net-nfs": {"call": 0.00, "retrans": 0.00, "read": 0.00, "write": 0.00, "access": 0.00, "getatt": 0.00},
                    "net-nfsd": {"scall": 0.00, "badcall": 0.00, "packet": 0.00, "udp": 0.00, "tcp": 0.00, "hit": 0.00, "miss": 0.00, "sread": 0.00, "swrite": 0.00, "saccess": 0.00, "sgetatt": 0.00},
                    "net-sock": {"totsck": 947, "tcpsck": 21, "udpsck": 7, "rawsck": 0, "ip-frag": 0, "tcp-tw": 1}      
// Should have comma here           
"fchosts": [

                ]
            }

sadc: Fix possible race condition in signal handler code

Sebastien,
I'm not sure you have received my second patch ... which I had sent last week. .Hence raising issue here again. [Please ignore this if you have already received my patch]

commit 8becf64cbe648cc584212bf97669293cf6ba391f
Author: Vasant Hegde [email protected]
Date: Mon Oct 20 19:14:41 2014 +0530

sadc: Fix possible race condition in signal handler code

Commit 1b52f939 tried to stop sending SIGINT to init process.
But there may be very small time window between parent ID
validation and sending kill signal to parent. If sar dies
during this window (though the chance is very less) we endup
sending signal to init.

This patch fixes above issue.

Signed-off-by: Vasant Hegde <[email protected]>
Signed-off-by: Sripathi Kodi <[email protected]>

diff --git a/sadc.c b/sadc.c
index 4d737d0..9a6285f 100644
--- a/sadc.c
+++ b/sadc.c
@@ -237,21 +237,19 @@ void alarm_handler(int sig)
*/
void int_handler(int sig)
{

  •   if (!optz) {
    
  •           /\* sadc hasn't been called by sar */
    
  •   pid_t ppid = getppid();
    
  •   /\* sadc hasn't been called by sar or sar process is already dead */
    
  •   if (!optz || ppid == 1) {
            exit(1);
    }
    
  •   /* Don't send signal to init process!! */
    
  •   if (getppid() == 1)
    

- return;

    /*
     * When starting sar then pressing ctrl/c, SIGINT is received
     * by sadc, not sar. So send SIGINT to sar so that average stats
     * can be displayed.
     */
  •   if (kill(getppid(), SIGINT) < 0) {
    
  •   if (kill(ppid, SIGINT) < 0) {
            exit(1);
    }
    
    }

[RFE] add sa2 option to avoid sarDD report generation

sa2 script generates text reports SA_DIR/sarDD, but I'm fine with on demand reports generation, so prepared text reports in SA_DIR are just wasting disk space.

Currently there is no possibility to disable report generation without modifying sa2 script. Can you consider implementing something like option MAKE_REPORT=false in SYSCONFIG_DIR/sysstat that disables text report generation in SA_DIR?

SVG graphs report "No data" for dynamically added CPUs

On Fedora 23 (4.4.5-300.fc23.x86_64) under VMware player 6.0.6, using the latest sysstat version (d95fdd9), SVG graphs for CPU can sometimes report "No data" after dynamically adding CPUs.

Steps to reproduce

  • create VM with single cpu

  • add 2 cpus without performing reboot

  • run ./sadc -S XALL 1 60 >/var/tmp/sar-20160318.dat to capture stats

  • run ./sar -u -P ALL -f /var/tmp/sar-20160318.dat, reports CPU usage across all cores ok

    [steve@fedora sysstat]$ ./sar -u -P ALL -f /var/tmp/sar-20160318.dat | head
    Linux 4.4.5-300.fc23.x86_64 (fedora)    03/18/2016      _x86_64_        (3 CPU)
    01:07:35 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
    01:07:36 PM     all      1.00      0.00      0.00      0.00      0.00     99.00
    01:07:36 PM       0      1.00      0.00      0.00      0.00      0.00     99.00
    01:07:36 PM       1      0.00      0.00      0.00      0.00      0.00      0.00
    01:07:36 PM       2      0.00      0.00      0.00      0.00      0.00      0.00
    01:07:37 PM     all      0.00      0.00      1.01      0.00      0.00     98.99
    01:07:37 PM       0      0.00      0.00      1.01      0.00      0.00     98.99
    01:07:37 PM       1      0.00      0.00      0.00      0.00      0.00      0.00
    [steve@fedora sysstat]$
    
  • run ./sadf -g /var/tmp/sar-20160318.dat -- -A >foo.svg, reports 'No data' for the 2 "new" cpus
    sar svg lacking data on 2 cpus

  • reboot VM, rerun the sadf against the data file , SVG still reports 'No data'

  • rerun the sadc to capture new data file, and then rerun the sadf, SVG reports all 3 cpus correctly

Files

combination of -P with other options doesn't work

Hi,

FYI, while I was trying out different combinations, I came across this particular situation (bug?) where, when I supply options as follows:

1. LC_ALL=C sadf -d  -- -r -v | less
2. LC_ALL=C sadf -d  -- -r -P 0 | less
3. -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL

The option 1 gives me memory and kernel tables/inode stats together. Thats fine.
But option 2 doesn't give me [memory + cpu#0] stats together.
While 3'rd option, the equivalent of '-A', works well with -P ALL.

Any idea, as to why?

Thanks already,
Archit

Network monitoring

Hi using sysstat-9.0.4-27.el6.i686 on centos 6.6 the network stats are wrong.

I´m doing an rsync of large files an see heavy network traffic with iftop but not with sar
(rxKB/s and txKB/s are 0.00):

sar -n DEV 2 1
Linux 2.6.32-504.16.2.el6.i686 (XXXhost) 10/28/2015 i686 (12 CPU)

01:15:25 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
01:15:27 PM lo 1192.78 1192.78 0.00 0.00 0.00 0.00 0.00
01:15:27 PM em1 14211.86 69996.91 0.00 0.00 0.00 0.00 176.80
01:15:27 PM em2 5.67 5.67 0.43 0.43 0.00 0.00 0.00
01:15:27 PM em3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:15:27 PM em4 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:15:27 PM em49 2.58 0.00 0.00 0.00 0.00 0.00 2.58
01:15:27 PM em50 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:15:27 PM em51 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:15:27 PM em52 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:15:27 PM bond0 14214.43 69996.91 0.00 0.00 0.00 0.00 179.38
01:15:27 PM bond1 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
Average: lo 1192.78 1192.78 0.00 0.00 0.00 0.00 0.00
Average: em1 14211.86 69996.91 0.00 0.00 0.00 0.00 176.80
Average: em2 5.67 5.67 0.43 0.43 0.00 0.00 0.00
Average: em3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: em4 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: em49 2.58 0.00 0.00 0.00 0.00 0.00 2.58
Average: em50 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: em51 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: em52 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: bond0 14214.43 69996.91 0.00 0.00 0.00 0.00 179.38
Average: bond1 0.00 0.00 0.00 0.00 0.00 0.00 0.00

iftop:

TX: cum: 1.32GB peak: 758Mb rates: 716Mb 679Mb 676Mb
RX: 14.1MB 7.74Mb 7.17Mb 7.15Mb 7.06Mb
TOTAL: 1.33GB 765Mb 723Mb 686Mb 683Mb

Should we be using statvfs() instead of statfs()

When reading file system stats, at:
https://github.com/sysstat/sysstat/blob/master/rd_stats.c#L2032
Should we be using statvfs() which handles large numbers better? See http://stackoverflow.com/questions/1653163/difference-between-statvfs-and-statfs-system-calls

I am seeing the following bogus output (XML), notice /dev/loop0:

  <filesystems>
      <filesystem fsname="/dev/mapper/fedora-root" MBfsfree="32892" MBfsused="17377" fsused-percent="34.57" ufsused-percent="39.69" Ifree="2929442" Iused="347358" Iused-percent="10.60"/>
      <filesystem fsname="/dev/loop1" MBfsfree="4726" MBfsused="32" fsused-percent="0.68" ufsused-percent="0.68" Ifree="2441341" Iused="3" Iused-percent="0.00"/>
      <filesystem fsname="/dev/sda1" MBfsfree="291" MBfsused="185" fsused-percent="38.93" ufsused-percent="45.02" Ifree="127565" Iused="451" Iused-percent="0.35"/>
      <filesystem fsname="/dev/mapper/fedora-home" MBfsfree="220833" MBfsused="24630" fsused-percent="10.03" ufsused-percent="15.12" Ifree="15673677" Iused="300723" Iused-percent="1.88"/>
      <filesystem fsname="/dev/loop0" MBfsfree="4726" MBfsused="32" fsused-percent="0.68" ufsused-percent="0.68" Ifree="2441377" Iused="18446744073709551583" Iused-percent="755597903192239.62"/>
      <filesystem fsname="/dev/mapper/fedora-root" MBfsfree="32892" MBfsused="17377" fsused-percent="34.57" ufsused-percent="39.69" Ifree="2929442" Iused="347358" Iused-percent="10.60"/>
  </filesystems>

It is mounted on my Fedora 20 system as:

$ df /srv/node/device1
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/loop0        950168  1288    880068   1% /srv/node/device1
$ mount
/srv/loopback-device/device1 on /srv/node/device1 type ext4 (rw,noatime,nodiratime,seclabel,nobarrier,data=ordered)
$ ls -l /srv/loopback-device/device1 
-rw-r--r--. 1 root root 1073741824 Jun 16 18:36 /srv/loopback-device/device1

Using python's os.statvfs(), I see:

posix.statvfs_result(
  f_bsize=4096,
  f_frsize=4096,
  f_blocks=1004510,
  f_bfree=1004510,
  f_bavail=1004510,
  f_files=1004510,
  f_ffree=1003996,
  f_favail=1003996,
  f_flag=2,
  f_namemax=255)

v 11.8: sadf file conversion

I upgraded my sysstat package from 10.1.5 to 11.1.8 and I did not find a way to use -c option to convert a saxx binary file created with sadc v 10.1.5 to a readable binary file by sadf 11.1.8

I tried sadf -c /var/log/sa/sa09 > /var/log/sa/sa09_11.8
Then
sadf -c /var/log/sa/sa09 > /var/log/sa/sa09_11.8 -P ALL /var/log/sa/sa09_11.8

I missed something but I did not figure out
Thanks in advance

[RFE] sadf outputing multi-day periods

Hi Sebastien,

I'm trying to change sargraph (in contrib) to generate plots of arbitrary time periods. Under the hood, of course it uses sadf to fetch the data from the sa files.

I really like how you can pass arbitrary start and end time to sadf together with interval and it will give you the proper number of datapoints, that are not only the values at the specific times, but they are averaged over the time period (right?). E.g. to get hourly averages of CPU activity:

sadf -d -s 09:00:00 -e 12:00:00 -- -u 3600 /var/log/sa/sa26

What would be awesome is if sadf could combine many different files, compressed or not, to extract and average the data between arbitrary dates. Example usage:

sadf -d --sa-path=/var/log/sa -s 20150301:0000 -e 20150331:2359 -- 3600

What do you think? Would such a feature be easy to implement?

11.1.6: make error: tapestat.c: In function 'main'

When compiling from source 11.1.6, make get error:

tapestat.c: In function 'main':
tapestat.c:673: error: invalid application of 'sizeof' to incomplete type 'struct sigaction'
tapestat.c:674: error: invalid use of undefined type 'struct sigaction'
tapestat.c:675: warning: implicit declaration of function 'sigaction'
tapestat.c:675: error: 'SIGALRM' undeclared (first use in this function)
tapestat.c:675: error: (Each undeclared identifier is reported only once
tapestat.c:675: error: for each function it appears in.)
make: *** [tapestat.o] Error 1

Using automake

Hi,

In trying to understand the structure of the various utilities in the sysstat project, I (somewhat arbitrarily) found that the lack of dependency generation (and out-of-source builds) in the build process was something I wanted to fix.
However, I am not so much a Auto(make|conf|tools) guru, and have been struggling to construct an alternative.
So far, I have a working automake file (Makefile.am), which obviously lacks many of the subtle operations performed in the original Makefile.in. It (automake, and this Makefile.am) handles the dependency generation, and also automates some of the package creation tasks.

It's fairly short, so I will just add it here:

SA_LIB_DIR = @SA_LIB_DIR@
SADC_PATH = $(SA_LIB_DIR)/sadc
SA_DIR = @SA_DIR@

AM_CFLAGS = @CFLAGS@ -Wall -Wstrict-prototypes -pipe -O2
AM_CFLAGS += @DFLAGS@ -DSA_DIR=\"$(SA_DIR)\" -DSADC_PATH=\"$(SADC_PATH)\" $(DFSENSORS)

bin_PROGRAMS = sadc sar sadf iostat mpstat pidstat nfsiostat-sysstat cifsiostat
noinst_LIBRARIES = librdstats.a librdstats_light.a librdsensors.a libsyscom.a

librdstats_a_SOURCES = rd_stats.c count.c
librdstats_a_CFLAGS = $(AM_CFLAGS) -DSOURCE_SADC
librdstats_light_a_SOURCES = rd_stats.c count.c
librdsensors_a_SOURCES = rd_sensors.c
libsyscom_a_SOURCES = common.c ioconf.c


sadc_SOURCES = sadc.c activity.c sa_wrap.c sa_common.c
sadc_CFLAGS = $(AM_CFLAGS) -DSOURCE_SADC
sadc_LDFLAGS = $(LFSENSORS)
sadc_LDADD = librdstats.a librdsensors.a libsyscom.a

sar_SOURCES = sar.c activity.c sa_common.c pr_stats.c
sar_CFLAGS = $(AM_CFLAGS) -DSOURCE_SAR
sar_LDADD = libsyscom.a

sadf_SOURCES = sadf.c activity.c format.c sadf_misc.c sa_conv.c rndr_stats.c xml_stats.c json_stats.c sa_common.c
sadf_CFLAGS = $(AM_CFLAGS) -DSOURCE_SADF
sadf_LDADD = libsyscom.a

iostat_SOURCES = iostat.c
iostat_LDADD = librdstats_light.a libsyscom.a

mpstat_SOURCES = mpstat.c
mpstat_LDADD = librdstats_light.a libsyscom.a

pidstat_SOURCES = pidstat.c
pidstat_LDADD = librdstats_light.a libsyscom.a

nfsiostat_sysstat_SOURCES = nfsiostat-sysstat.c
nfsiostat_sysstat_LDADD = librdstats_light.a libsyscom.a

cifsiostat_SOURCES = cifsiostat.c
cifsiostat_LDADD = librdstats_light.a libsyscom.a


dist_man1_MANS = man/sar.1 man/sadf.1 man/mpstat.1 man/pidstat.1 man/nfsiostat-sysstat.1 man/cifsiostat.1
#if INSTALL_ISAG
dist_man1_MANS += contrib/isag/isag.1
dist_man5_MANS = man/sysstat.5
dist_man8_MANS = man/sadc.8 man/sa1.8 man/sa2.8

Incidentally, I also renamed configure.in -> configure.ac, and added some statements (AM_INIT_AUTOMAKE) to enable automake to work.

I'm not sure how to proceed and was wondering it anyone had any advice.

Thanks
Dan

Pass pidstat a command to run

Hello Sebastien and thank you for sysstat,

While investigating performance and resource utilization of batch processing scripts in various languages I find myself implementing additional logging within the processes, calls to getrusage/procps and reading /proc/self/(stat|status|io) etc etc (in addition to frequent collection of data using sadc, collectl, tcollector and others, and running process accounting). Standard out from these jobs becomes the job log file. Adding additional process resource usage log lines, sometimes at time intervals, and at the end of a job or child process has been useful.

I found myself wondering if a wrapper tool/exe exists that I could simply prefix to executables run in the shell scripts, it would run the exe with the args and report on the process stats. I wanted to avoid the need to recompile/re-instrument or modify any of the executables/scripts (apart from prefixing this wrapper tool), I wanted to avoid using any tools that would slow the process down by a significant amount.

I searched and found pidstat, I gave up writing a bash wrapper using pidstat but managed to create one in perl which I will include below, it is not production tested and I plan to add an option to log pidstat output to a logfile. I am wondering if you know of anything similar that already exists, and if not if you thought enhancing pidstat to allow it to be used as a wrapper process on a command might be an appropriate enhancement. Maybe using ptrace - https://blog.nelhage.com/2010/08/write-yourself-an-strace-in-70-lines-of-code/ as https://github.com/nelhage/ministrace does.

Thanks for your time,
Peter (Stig) Edwards

Example run:

> ./cmdstat -- perl -le ' for(1..10**8){$i++}; sleep 2; print STDOUT qq{STDOUT}; print STDERR qq{STDERR}; exit 42'
  Linux 2.6.32-431.11.2.el6.x86_64 (myhost)       09/12/14        _x86_64_        (32 CPU)
      #      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s   cswch/s nvcswch/s  Command
20140912 16:20:26      1657   99.00    0.00    0.00   99.00     1    157.00      0.00   23680   2068   0.00      0.00      0.00      0.00      0.00      3.00  perl
      #      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s   cswch/s nvcswch/s  Command
20140912 16:20:27      1657  100.00    0.00    0.00  100.00     1      0.00      0.00   23680   2068   0.00      0.00      0.00      0.00      0.00      2.00  perl
      #      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s   cswch/s nvcswch/s  Command
20140912 16:20:28      1657  100.00    0.00    0.00  100.00     1      0.00      0.00   23680   2068   0.00      0.00      0.00      0.00      0.00      3.00  perl
      #      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s   cswch/s nvcswch/s  Command
20140912 16:20:29      1657   58.00    0.00    0.00   58.00     1      2.00      0.00   23680   2076   0.00      0.00      0.00      0.00      1.00      0.00  perl
      #      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s   cswch/s nvcswch/s  Command
20140912 16:20:30      1657    0.00    0.00    0.00    0.00     1      0.00      0.00   23680   2076   0.00      0.00      0.00      0.00      0.00      0.00  perl
STDOUT
STDERR
      #      Time       PID    %usr %system  %guest    %CPU   CPU  minflt/s  majflt/s     VSZ    RSS   %MEM   kB_rd/s   kB_wr/s kB_ccwr/s   cswch/s nvcswch/s  Command
> echo $?
42

Source of cmdstat (perl)

#!/usr/bin/perl

use strict;
use warnings;
use IPC::Open3 'open3';
use Getopt::Long;
use Pod::Usage;
use English qw( -no_match_vars ) ;
use File::Basename;
$OUTPUT_AUTOFLUSH = 1;

my ( $help, $man, $interval, $threads ) = ( 0, 0, 1, 0 );
GetOptions('help|?'     => \$help,
           'interval=i' => \$interval,
           'threads'    => \$threads,
           'man'        => \$man) or pod2usage(2);

pod2usage(1) if $help;
pod2usage(-exitval => 0, -verbose => 2) if $man;
pod2usage(1) if !@ARGV;

my $pid_command = open3('<&STDIN',    '>&STDOUT', '>&STDERR', @ARGV);
my $pid_pidstat = open3('</dev/null', '>&STDOUT', '>&STDERR',
                        "pidstat -dhruw".( $threads ? q{t} : q{} )." -p $pid_command $interval | " .
                        "perl -lne 'use POSIX();if(/^ ([0-9]+)(.*)/){print POSIX::strftime(q{%Y%m%d %H:%M:%S},(localtime \$1)).\$2}else{print qq{      \$_}}' ");

waitpid( $pid_command, 0 );
my $command_exit_status = $? >> 8;
waitpid( $pid_pidstat, 0 );
exit $command_exit_status;

__END__

=head1 cmdstat

cmdstat [options] -- program arguments ...

     Options:
       --help                -h          brief help message
       --man                 -m          full documentation
       --interval interval   -i iterval  interval in seconds between each report from pidstat, default=1
       --threads             -t          pass -t option to pidstat to display statistics for threads

=head1 OPTIONS

=over 8

=item B<--help or -h>

Print a brief help message and exits.

=item B<--man or -m>

Prints the manual page and exits.

=item B<--interval interval or -i interval>

Interval in seconds between each report from pidstat, default=1.

=item B<--threads or -t>

Pass -t option to pidstat to display statistics for threads.

=back

=head1 DESCRIPTION

B<This program> will run pidstat on the program you pass it.

=head1 EXAMPLE

cmdstat -- perl -le ' for(1..10**8){$i++}; sleep 2; print STDOUT qq{STDOUT}; print STDERR qq{STDERR}; exit 42'

=cut

Bash attempt

perl -e 'sleep 5' & PID=$! ; pidstat -p $PID 1
[1] 8660
Linux 2.6.32-431.11.2.el6.x86_64 (myhost)     09/12/14        _x86_64_        (32 CPU)

16:44:59          PID    %usr %system  %guest    %CPU   CPU  Command
16:45:00         8660    0.00    0.00    0.00    0.00    19  perl
16:45:01         8660    0.00    0.00    0.00    0.00    19  perl
16:45:02         8660    0.00    0.00    0.00    0.00    19  perl
16:45:03         8660    0.00    0.00    0.00    0.00    19  perl
16:45:04         8660    0.00    0.00    0.00    0.00    19  perl
[1]+  Done                    perl -e 'sleep 5'

Sysstat mail report script

Hello,

First, I use your great software Sysstat for a long time, thank you for writing it and making it open source.

I have written a script to automatically generate and send an email report every day/week/month with graphs generated from sysstat data.

I just put the code on GitHub today: https://github.com/desbma/sysstat_mail_report

If you could mention it in the FAQ of your website (http://sebastien.godard.pagesperso-orange.fr/faq.html, item 2.11) that would be nice. :)

Thanks

sar causes system reboot

Test case:
Run sar_test script in shell prompt and press ctrl+C twice.

cat sar_test
while true; do /usr/local/bin/sar -n DEV 1 3; sleep 3; done

Reason:
If sar (parent of sadc) is dies before sadc completes its job
then init will become sadc parent. Now if we pass SIGINT to
sadc, it will pass that to init process and result in system
reboot.

This patch check parent process before sending signal.

Patch
commit 1b52f9390a96a959ca0a3be9f27bb7dae0f1e5b3
Author: Vasant Hegde [email protected]
Date: Fri Oct 17 16:31:41 2014 +0530

sadc: Don't send signal if parent process is already died

If sar (parent of sadc) is dies before sadc completes its job
then init will become sadc parent. Now if we pass SIGINT to
sadc, it will pass that to init process and result in system
reboot.

This patch check parent process before sending signal.

Test case:
  Run sar_test script in shell prompt and press ctrl+C twice.

  cat sar_test
    while true; do /usr/local/bin/sar -n DEV 1 3; sleep 3; done

Signed-off-by: Vasant Hegde <[email protected]>

diff --git a/sadc.c b/sadc.c
index 55e76f5..4d737d0 100644
--- a/sadc.c
+++ b/sadc.c
@@ -242,6 +242,10 @@ void int_handler(int sig)
exit(1);
}

  •   /\* Don't send signal to init process!! */
    
  •   if (getppid() == 1)
    
  •           return;
    

Note that I tried to send this patch to "[email protected]" ID. Looks like it didn't go through. Hence raising issue here.

-Vasant

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.