Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sar reports the cpu to be more than 100% idle #224

Open
tpetersonkth opened this issue Jun 13, 2019 · 6 comments
Open

Sar reports the cpu to be more than 100% idle #224

tpetersonkth opened this issue Jun 13, 2019 · 6 comments

Comments

@tpetersonkth
Copy link

tpetersonkth commented Jun 13, 2019

See the image below:
image

Here is the raw output:

rpi@kali:~$ sar
Linux 4.14.93-Re4son-v8+ (kali) 	06/13/2019 	_aarch64_	(4 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:05:01 AM     all      0.18      0.00      0.12      0.00      0.00     99.70
12:15:01 AM     all      0.22      0.00      0.12      0.00      0.00     99.66
12:25:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.67
12:35:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.67
12:45:01 AM     all      0.17      0.00      0.11      0.00      0.00     99.71
12:55:01 AM     all      0.21      0.00      0.11      0.00      0.00     99.67
01:05:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
01:15:01 AM     all      0.19      0.00      0.12      0.00      0.00     99.69
01:25:01 AM     all      0.19      0.00      0.13      0.00      0.00     99.68
01:35:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.67
01:45:02 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
01:55:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.66
02:05:01 AM     all      0.19      0.00      0.12      0.00      0.00     99.69
02:15:01 AM     all      0.22      0.00      0.12      0.01      0.00     99.66
02:25:01 AM     all      0.18      0.00      0.12      0.00      0.00     99.71
02:35:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
02:45:01 AM     all      0.30      0.00      0.14      0.05      0.00     99.51
02:55:01 AM     all      0.21      0.00      0.12      0.01      0.00     99.66
03:05:01 AM     all      0.19      0.00      0.12      0.00      0.00     99.69
03:15:01 AM     all      0.22      0.00      0.11      0.00      0.00     99.66
03:25:01 AM     all      0.20      0.00      0.12      0.01      0.00     99.68
03:35:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
03:45:01 AM     all      0.19      0.00      0.12      0.00      0.00     99.69
03:55:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.67
04:05:01 AM     all      0.18      0.00      0.11      0.00      0.00     99.71
04:15:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.68
04:25:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
04:35:02 AM     all      0.21      0.00      0.12      0.01      0.00     99.67
04:45:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
04:55:01 AM     all      0.22      0.00      0.12      0.00      0.00     99.65
05:05:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
05:15:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.66
05:25:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.67
05:35:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.66
05:45:02 AM     all      0.18      0.00      0.11      0.00      0.00     99.71
05:55:01 AM     all      0.23      0.00      0.12      0.00      0.00     99.65
06:05:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.69
06:15:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.67
06:25:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
06:35:01 AM     all      1.15      0.02      0.29      0.18      0.00     98.36
06:45:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
06:55:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.66
07:05:01 AM     all      0.31      0.00      0.14      0.00      0.00     99.54
07:15:01 AM     all      0.19      0.00      0.11      0.00      0.00     99.69
07:25:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.69
07:35:01 AM     all      0.20      0.00      0.12      0.01      0.00     99.68
07:45:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
07:55:01 AM     all      0.21      0.00      0.12      0.01      0.00     99.67
08:05:01 AM     all      0.21      0.00      0.12      0.00      0.00     99.67
08:15:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68
08:25:01 AM     all      0.21      0.00      0.13      0.00      0.00     99.66
08:35:01 AM     all      0.20      0.00      0.11      0.00      0.00     99.68
08:45:01 AM     all      0.20      0.00      0.12      0.00      0.00     99.68

08:45:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
08:55:01 AM     all      0.18      0.00      0.12      0.00      0.00     99.70
09:05:01 AM     all      0.24      0.00      0.15      0.01      0.00     99.59
09:15:01 AM     all      0.23      0.00      0.14      0.01      0.00     99.62
09:25:01 AM     all      0.23      0.00      0.14      0.01      0.00     99.61
09:45:01 AM     all      0.00      0.00      0.00      0.58      0.00    112.34
09:55:01 AM     all      0.00      0.00      0.00      2.19      0.00     95.45
10:05:01 AM     all      0.61      0.00      0.26      0.02      0.00     99.11
10:15:01 AM     all      0.39      0.00      0.19      0.01      0.00     99.41
10:25:01 AM     all      1.91      0.00      5.64      0.05      0.00     92.39
10:35:01 AM     all      6.82      0.00     20.95      0.38      0.00     71.85
10:45:02 AM     all     11.14      0.00     30.23      0.01      0.00     58.62
10:55:01 AM     all      0.96      0.00      2.21      0.01      0.00     96.83
11:05:01 AM     all      0.20      0.00      0.12      0.01      0.00     99.68
11:15:01 AM     all      0.27      0.00      0.17      0.01      0.00     99.55
11:25:01 AM     all      0.34      0.00      0.19      0.01      0.00     99.47
11:35:01 AM     all      0.42      0.00      0.22      0.00      0.00     99.36
11:45:01 AM     all      0.41      0.00      0.21      0.01      0.00     99.37
11:55:01 AM     all      0.20      0.00      0.12      0.01      0.00     99.67
12:05:01 PM     all      0.18      0.00      0.11      0.00      0.00     99.70
12:15:01 PM     all      0.21      0.00      0.12      0.00      0.00     99.67
12:25:01 PM     all      0.18      0.00      0.12      0.00      0.00     99.69
12:35:01 PM     all      0.20      0.00      0.12      0.00      0.00     99.67
12:45:02 PM     all      0.20      0.00      0.12      0.00      0.00     99.68
12:55:01 PM     all      0.22      0.00      0.12      0.00      0.00     99.66
01:05:01 PM     all      0.33      0.00      0.28      0.00      0.00     99.38
01:15:01 PM     all      0.84      0.00      0.34      0.01      0.00     98.81
01:25:01 PM     all      3.42      0.00      4.25      0.78      0.00     91.55
01:35:16 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:45:01 PM     all      0.46      0.00      0.28      0.02      0.00     99.24
01:55:01 PM     all      0.00      0.00      0.00      0.57      0.00     98.82
02:05:16 PM     all      0.00      0.00      0.00      5.30      0.00     94.58
02:15:01 PM     all      0.31      0.00      0.18      0.01      0.00     99.50
02:25:01 PM     all      0.20      0.00      0.13      0.01      0.00     99.67
02:35:01 PM     all      0.27      0.00      0.15      0.01      0.00     99.57
02:45:01 PM     all      0.21      0.00      0.11      0.00      0.00     99.68
02:55:01 PM     all      0.21      0.00      0.12      0.00      0.00     99.66
03:05:01 PM     all      0.20      0.00      0.12      0.01      0.00     99.67
03:15:01 PM     all      0.24      0.00      0.17      0.01      0.00     99.58
03:25:01 PM     all      0.23      0.00      0.19      0.00      0.00     99.58
03:35:01 PM     all      0.29      0.00      0.23      0.02      0.00     99.46
03:45:01 PM     all      0.32      0.00      0.20      0.01      0.00     99.47
03:55:01 PM     all      0.26      0.00      0.17      0.01      0.00     99.56
04:05:01 PM     all      0.21      0.00      0.14      0.00      0.00     99.65
04:15:01 PM     all      0.26      0.00      0.16      0.00      0.00     99.58
04:25:02 PM     all      0.38      0.00      0.19      0.01      0.00     99.42
04:35:01 PM     all      0.51      0.00      0.23      0.01      0.00     99.25
04:45:01 PM     all      0.58      0.00      0.65      0.00      0.00     98.77
04:55:01 PM     all      0.00      0.00      0.00      1.01      0.00    109.07
05:05:01 PM     all      1.13      0.00      0.25      0.00      0.00     98.62
05:15:01 PM     all      1.30      0.00      0.32      0.04      0.00     98.34
05:25:01 PM     all      0.52      0.00      0.18      0.01      0.00     99.30
Average:        all      0.00      0.00      0.00      0.11      0.00    100.87
@sysstat
Copy link
Owner

sysstat commented Jun 13, 2019

Please send me (sysstat at orange.fr) your binary daily data file (saDD) so that I can check the values recorded in it.
And tell me which version of sysstat you are using.
Thx.

@tpetersonkth
Copy link
Author

Here is the version:

root@kali:/var/log/sysstat# sar -V
sysstat version 12.0.3
(C) Sebastien Godard (sysstat <at> orange.fr)

I have put all the logs(All files from the directory /var/log/sysstat/) in the attached zip file(The file displayed in the screenshots above was sa13. However, there are occurrences of more than 100% cpu idle time in sa12 and sa14 as well):
sysstatLogs.zip

@tpetersonkth
Copy link
Author

From reading in the wiki(Question 2.6) it appears that this issue can appear if the sar command was not installed correctly. I installed sar with sysstat using apt-get. Is there any way to verify that it is installed correctly?
Or how can I run the configuration script mentioned in Question 2.6 (I don't know where the file "configure" is located)?

@sysstat
Copy link
Owner

sysstat commented Jun 16, 2019

Looking at your logfiles, this is exactly what seems to happen: Your sar command was not properly installed. At some times, your kernel counters are restarting from 0, which means that your system has rebooted. Yet no "LINUX RESTART" message has been saved in your binary logfile.
If your package manager doesn't install it properly, do it yourself : Get the sysstat's source, configure it (run the "iconfig" configuration script included), compile and install.
Read the README.md file included in the source code (or directly here in the bottom half of this page on GitHub: https://github.com/sysstat/sysstat).
If you install it yourself manually, make sure to remove/delete previous sysstat versions already installed!

Sample configuration output (make sure you answer 'y' for "yes" to the question "Set crontab to start sar automatically?" (see below):

$ ./iconfig


Welcome to sysstat's Interactive Configuration script!

This script enables you to set the parameters value used by ./configure.
Please enter the value for the parameters listed below.
Press Return to tell ./configure to use the default value or to try to guess the proper one.
Defaut value for yes/no questions is no (parameter is NOT set).
You can enter a ? to display a help message at any time...

Installation directory: [--prefix] <CR>
<SNIP>
Set crontab to start sar automatically? (y/n) [--enable-install-cron] y
Crontab owner: [cron_owner] <CR>
Crontab sampling interval (in minutes): [cron_interval] 10
Should sadc collect optional activities? (y/n) [--enable-collect-all] y
<SNIP>
Do not strip object files? (y/n) [--disable-stripping] <CR>
Parameter --disable-stripping is NOT set

./configure  --enable-install-cron cron_interval=10 --enable-collect-all 

.
Check programs:
.
checking for gcc... gcc
checking whether the C compiler works... yes
<SNIP>

   Sysstat version:		12.1.6
   Installation prefix:		/usr/local
   rc directory:		/etc/rc.d
   Init directory:		/etc/rc.d/init.d
   Systemd unit dir:		/usr/lib/systemd/system
   Configuration directory:	/etc/sysconfig
   Man pages directory:		${datarootdir}/man
   Compiler:			gcc
   Compiler flags:		-g -O2

$ make
<SNIP>

$ sudo make install
<SNIP>

@tpetersonkth
Copy link
Author

Thank you very much for the guidance!

Everything works for me until the sudo make install line. I get an error saying that it fails to enable sysstat.service:

mkdir -p /usr/local/share/man/man1
mkdir -p /usr/local/share/man/man5
mkdir -p /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sa1.8*
install -m 644 -g man man/sa1.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sa2.8*
install -m 644 -g man man/sa2.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sadc.8*
install -m 644 -g man man/sadc.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man1/sar.1*
install -m 644 -g man man/sar.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/sadf.1*
install -m 644 -g man man/sadf.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man5/sysstat.5*
install -m 644 -g man man/sysstat.5 /usr/local/share/man/man5
rm -f /usr/local/share/man/man1/iostat.1*
install -m 644 -g man man/iostat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/tapestat.1*
install -m 644 -g man man/tapestat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/mpstat.1*
install -m 644 -g man man/mpstat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/pidstat.1*
install -m 644 -g man man/pidstat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/cifsiostat.1*
install -m 644 -g man man/cifsiostat.1 /usr/local/share/man/man1
mkdir -p /usr/local/lib/sa
mkdir -p /var/log/sa
mkdir -p /usr/local/bin
mkdir -p /usr/local/share/doc/sysstat-12.1.6
mkdir -p /etc/sysconfig
install -m 755 sa1 /usr/local/lib/sa
install -m 755 sa2 /usr/local/lib/sa
install -m 755 sadc /usr/local/lib/sa
install -m 755 sar /usr/local/bin
install -m 755 sadf /usr/local/bin
install -m 755 iostat /usr/local/bin
install -m 755 tapestat /usr/local/bin
install -m 755 mpstat /usr/local/bin
install -m 755 pidstat /usr/local/bin
install -m 755 cifsiostat /usr/local/bin
install -m 644 sysstat.ioconf /etc/sysconfig
install -m 644 sysstat.sysconfig /etc/sysconfig/sysstat
install -m 644 CHANGES /usr/local/share/doc/sysstat-12.1.6
install -m 644 COPYING /usr/local/share/doc/sysstat-12.1.6
install -m 644 CREDITS /usr/local/share/doc/sysstat-12.1.6
install -m 644 README.md /usr/local/share/doc/sysstat-12.1.6
install -m 644 FAQ.md /usr/local/share/doc/sysstat-12.1.6
install -m 644 *.lsm /usr/local/share/doc/sysstat-12.1.6
chown root /var/log/sa
if [ -d /etc/cron.d ]; then \
	mkdir -p /etc/cron.d; \
elif [ -d /etc/cron.hourly -a -d /etc/cron.daily ]; then \
	mkdir -p /etc/cron.hourly /etc/cron.daily; \
fi
if [ -d /etc/init.d ]; then \
	mkdir -p /etc/init.d; \
elif [ -d /etc ]; then \
	mkdir -p /etc; \
fi
if [ -z "" -o ! -d "" ]; then \
	if [ -d /etc/cron.d ]; then \
		install -m 644 cron/sysstat.crond /etc/cron.d/sysstat; \
	elif [ -d /etc/cron.hourly -a -d /etc/cron.daily ]; then \
		install -m 755 cron/sysstat.cron.hourly /etc/cron.hourly/sysstat; \
		install -m 755 cron/sysstat.cron.daily /etc/cron.daily/sysstat; \
	fi \
fi
if [ \( -z "" -o ! -d "" \) -a ! -d /etc/cron.d ]; then \
	if [ ! -d /etc/cron.hourly -o ! -d /etc/cron.daily ]; then \
		su root -c "crontab -l > /tmp/crontab-root.save"; \
		/usr/bin/cp -a /tmp/crontab-root.save ./crontab-root.`date '+%Y%m%d.%H%M%S'`.save; \
		echo "USER'S PREVIOUS CRONTAB SAVED IN CURRENT DIRECTORY (USING .save SUFFIX)."; \
		su root -c "crontab cron/crontab"; \
	fi \
fi
if [ -n "" -a -d "" ]; then \
	install -m 644 sysstat.service ; \
	install -m 644 cron/sysstat-collect.service ; \
	install -m 644 cron/sysstat-collect.timer ; \
	install -m 644 cron/sysstat-summary.service ; \
	install -m 644 cron/sysstat-summary.timer ; \
elif [ -d /etc/init.d ]; then \
	install -m 755 sysstat /etc/init.d/sysstat; \
	if [ "n" = "n" ]; then \
		if [ -x "" ]; then \
			cd /etc/init.d &&  --add sysstat; \
		else \
			[ -d /etc/rc2.d ] || mkdir -p /etc/rc2.d; \
			[ -d /etc/rc3.d ] || mkdir -p /etc/rc3.d; \
			[ -d /etc/rc5.d ] || mkdir -p /etc/rc5.d; \
			cd /etc/rc2.d && ln -s -f ../init.d/sysstat S01sysstat; \
			cd /etc/rc3.d && ln -s -f ../init.d/sysstat S01sysstat; \
			cd /etc/rc5.d && ln -s -f ../init.d/sysstat S01sysstat; \
		fi \
	fi \
elif [ -d /etc ]; then \
	install -m 755 sysstat /etc/rc.sysstat; \
	if [ "n" = "n" ]; then \
		if [ -x "" ]; then \
			cd /etc &&  --add rc.sysstat; \
		else \
			[ -d /etc/rc2.d ] || mkdir -p /etc/rc2.d; \
			[ -d /etc/rc3.d ] || mkdir -p /etc/rc3.d; \
			[ -d /etc/rc5.d ] || mkdir -p /etc/rc5.d; \
			cd /etc/rc2.d && ln -s -f ../rc.sysstat S01sysstat; \
			cd /etc/rc3.d && ln -s -f ../rc.sysstat S01sysstat; \
			cd /etc/rc5.d && ln -s -f ../rc.sysstat S01sysstat; \
		fi \
	fi \
fi
if [ -x "/usr/bin/systemctl" ]; then \
	/usr/bin/systemctl enable sysstat.service; \
fi
Synchronizing state of sysstat.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable sysstat
update-rc.d: warning: enable action will have no effect on runlevel 1
Failed to enable unit: Unit file /etc/systemd/system/sysstat.service is masked.
make: *** [Makefile:418: install_all] Error 1

Any idea what this means?

@sysstat
Copy link
Owner

sysstat commented Jun 21, 2019

The configure script didn't find your Systemd directory, so the variable that should contain the Systemd directory is not set...
Your output reads :
if [ -z "" -o ! -d "" ]; then \....
Yet it should read something like :
if [ -z "/usr/lib/systemd/system" -o ! -d "/usr/lib/systemd/system" ]; then \
So what is displayed at the end of your configuration stage ? I personally get:

   Sysstat version:		12.1.5
   Installation prefix:		/usr/local
   rc directory:		/etc/rc.d
   Init directory:		/etc/rc.d/init.d
   Systemd unit dir:		/usr/lib/systemd/system
   Configuration directory:	/etc/sysconfig
   Man pages directory:		${datarootdir}/man
   Compiler:			gcc
   Compiler flags:		-g -O2

with /usr/lib/systemd/system for the Systemd unit directory.
Check also that you have pkg-config command installed. This is how Systemd directory is found:

pkg-config --variable=systemdsystemunitdir systemd
/usr/lib/systemd/system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants