icinga2 借助check_iostat.sh抓取linux服务器的diskIO(硬盘繁忙度)
下载地址:https://exchange.nagios.org/directory/Plugins/Operating-Systems/Linux/Check-Iostat-Updated/details
对脚本进行修改(默认为$12,12为w_await值,14为%util值)
UTIL=`cat $TMP | $AWK ‘{ sum += $14 } END { print sum / NR } ‘`
被监控端:
将改后的脚本拷到nrpe端的/usr/lib/nagios/plugins/下
# vi /etc/nagios/nrpe.cfg (是-u参数,不带/dev/)
command[check_diskio]=/usr/lib/nagios/plugins/check_iostat -w 180 -c 190 -u sdb1
:wq
监控端:
# vi /etc/icinga2/conf.d/templates.conf
object CheckCommand "nrpe-diskio" {
import "nrpe-common"
vars.nrpe_command = "check_diskio"
}
:wq
# vi /etc/icinga2/conf.d/services.conf (shhudson为预定义的os,代表主机group)
apply Service "nrpe-diskio" {
import "generic-service"
check_command = "nrpe-diskio"
assign where host.vars.os == "shhudson"
}
:wq
# service icinga2 restart
原文:http://yangzhiming.blog.51cto.com/4849999/1884208