I am actively trying to get the output of the iotop for monitoring.

As you know, the iotop is interactive, meaning that once started, it'll provide live updates on disk usage on the system.

I'm trying to capture each iteration of the command and run it to a script that would send the metrics to my server.

I'm tried many commands, including process substitution in order to redirect the output of iotop to a custom script file that I have but nothing seems to work.

Any clues?


You can run iotop in the batch mode, to get a snapshot of it's output, like that:

iotop -b -o -n 1

This will instruct it to run in -batch mode, do just 1 one iteration (-n 1), and only include processes doing actual IO (-o).

  • -q[qq] option may be also helpful to suppress data which is not useful for parsing. – Yurij Goncharuk May 29 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.