Nagios

沒有為 nrpe 外掛的 check_iostat 獲得正確的輸出

  • August 20, 2015

我的 iostat 給出以下輸出

$ iostat 
Linux 3.13.0-29-generic (Inksedge)  08/13/2015  _x86_64_    (4 CPU)
Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
xvdap1            0.62         0.13         9.01    3282841  226020852
xvdb              0.03         0.00         0.12       7721    2999916
xvdc              0.00         0.00         0.00       1376          0

check_iostat 不適用於設備 xvdap1 !我也試過xvda,xvda1但沒用!

# /usr/lib/nagios/plugins/check_iostat -d xvda1 -w 100,100,100 -c 200,200,200
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
OK - I/O stats tps= MB_read/s= MB_written/s= | 'tps'=; 'MB_read/s'=; 'MB_written/s'=;

那麼我應該給設備名稱以獲得正確的輸出?

它適用於 xvdb :

# /usr/lib/nagios/plugins/check_iostat -d xvdb -w 100,100,100 -c 200,200,200
OK - I/O stats tps=0.00 MB_read/s=0.00 MB_written/s=0.00 | 'tps'=0.00; 'MB_read/s'=0.00; 'MB_written/s'=0.00;

得到了答案:由於缺少 iostat 命令,它給出了錯誤的輸出!

apt-get install sysstat

安裝 sysstat 後在 Nagios 上得到輸出:

IO-Stats /dev/xvda

OK  08-19-2015 14:28:10 43d 8h 7m 28s   1/4 OK - I/O stats tps=2.00 MB_read/s=0.00 MB_written/s=0.00 
IO-Stats /dev/xvdb
OK  08-19-2015 14:26:48 61d 4h 47m 46s  1/4 OK - I/O stats tps=0.00 MB_read/s=0.00 MB_written/s=0.00 
IO-Stats /dev/xvdc
OK  08-19-2015 14:26:48 61d 4h 47m 13s  1/4 OK - I/O stats tps=0.00 MB_read/s=0.00 MB_written/s=0.00 
IO-Stats /dev/xvdf
OK  08-19-2015 14:25:10 6d 3h 4m 19s    1/4 OK - I/O stats tps=0.00 MB_read/s=0.00 MB_written/s=0.00 

引用自:https://serverfault.com/questions/713889