lesovsky / zabbix-extensions

Zabbix additional monitoring modules
BSD 3-Clause "New" or "Revised" License
316 stars 230 forks source link

Update iostat-collect.sh #56

Closed EamonZhang closed 2 years ago

EamonZhang commented 5 years ago

add iostat params -d , only print device info,

stephankn commented 5 years ago

I am not using this template. I tried running the script and it does not print any output. Is the awk filtering of the output correct? What is it trying to do? Fetch only the devices? Wouldn't it be easier just to skip the top lines?

iostat -dx 1 1 | tail --lines=+4
loop0            0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     1.60     0.00   0.00   0.00
sda              3.69    4.25     22.71     31.14     0.31     0.68   7.73  13.80    1.49    6.29   0.03     6.15     7.32   0.23   0.18
dm-0             0.26    0.12      2.46      0.47     0.00     0.00   0.00   0.00    3.42    1.89   0.00     9.54     4.08   0.35   0.01
dm-1             0.00    0.00      0.03      0.00     0.00     0.00   0.00   0.00    0.53    0.00   0.00    23.16     0.00   0.36   0.00
dm-2             3.63    0.33     14.56      3.00     0.00     0.00   0.00   0.00    1.58    0.62   0.01     4.01     9.12   0.33   0.13
dm-3             0.12    4.49      5.60     27.68     0.00     0.00   0.00   0.00    5.13    6.14   0.03    45.40     6.17   0.11   0.05

I saw you added md to the template, should dm-0 etc also be added?

As the template is doing an exec for every item this is creating a huge load for little values. As you are looking into it already: Can you change the handling to fetch all items as once and later parse it into the values? I did this in the postgresql template which you could use as a sample.

iostat -dx -o JSON 1 1 produces the report as JSON which can be parsed by Zabbix.

stephankn commented 3 years ago

@EamonZhang can you please comment on the last question? Looks like the output parsing is broken. Can you reproduce and make the filtering more tolerant? Probably different output by different versions of iostat.

stephankn commented 3 years ago

I merged in #72 which also uses -d parameter. I think this PR is now obsolete. Please confirm,