0

I'm working on a php script(nagios plugin) to read r/s,w/s,rMB/s,wMB/s,%util from the iostat command, e.g.

#iostat -xm sda
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.05    0.08    1.16    6.24    0.00   91.47

Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s    %util
sda               0.14    10.37    3.63    2.31     0.06     0.05    1.53 

Any ideas how I can filter r/s,w/s,rMB/s,wMB/s and %util values using awk or if there is another way to run commands within a php script?

wogsland
  • 199
  • 1
  • 4
  • 12
  • 1
    Instead of trying to parse the output of a command, maybe parse the contents of `/proc/diskstats`, `/proc/uptime`, `/proc/stat`, which is iostat seems to read from. See the kernel docs/source for details for the format of these state files. – Zoredache Mar 09 '17 at 00:29
  • Is there a reason you're writing your own plugin, instead of using an existing one? – Keith Mar 09 '17 at 17:46
  • @Keith , company standards sadly, php environment –  Mar 10 '17 at 03:24

0 Answers0