LP #1021903: pt-diskstats usage in non-interactive scripts

Description

**Reported in Launchpad by justinb last update 09-07-2012 16:23:50

I'm trying to run pt-diskstats as a collectd plugin because I like the information provided by this tool instead of iostat. The problem is when pt-diskstats is started up without being attached to the terminal, the parent (non data gathering) process uses %100 cpu. Strace output shows the following repeating very often.

select(8, [0], NULL, NULL, {1, 364751}) = 1 (in [0], left {1, 364744})
read(0, 0x133e400, 4096) = -1 EBADF (Bad file descriptor)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)
select(8, [0], NULL, NULL, {1, 364372}) = 1 (in [0], left {1, 364365})
read(0, 0x133e400, 4096) = -1 EBADF (Bad file descriptor)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)

Attached is a full strace output of the following command:
PTDEBUG=1 strace -ttt -s 1024 -o diskstats.strace -f nohup perl /usr/bin/pt-diskstats --iterations 2

And a Devel::NYTProf html and original output of the following:

perl -d:NYTProf /usr/bin/pt-diskstats --iterations 2

nohup perl -d:NYTProf /usr/bin/pt-diskstats --iterations 2

My System:

[root@pt ~]# uname -a
Linux pt 2.6.32-220.23.1.el6.x86_64 #1 SMP Mon Jun 18 18:58:52 BST 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@pt ~]# cat /etc/redhat-release
CentOS release 6.2 (Final)

Replicated on Debian Squeeze

I know the intent of this script is to run in an interactive way however the data is too good not to trend in someway, which is done non-interactively.

Environment

None

Activity

Show:

lpjirasync 
January 24, 2018 at 6:48 PM

**Comment from Launchpad by: Raghavendra D Prabhu on: 08-07-2012 20:00:18

You can run it as

perl /usr/bin/pt-diskstats --iterations 2 < /dev/null (with nohup etc.)

as a workaround.

However, http://sprunge.us/KNXc?pl can be added to pt-diskstats I guess, to prevent non-interactive use at all. (since the script is primarily interactive).

Details

Assignee

Reporter

Priority

Created January 24, 2018 at 6:48 PM
Updated December 21, 2019 at 2:32 PM