通过icinga2监控服务器的top(CPU)信息,主要为cpu iowait值
插件下载网址(复制内容改名为check_iostat_cpu,以便和另1个监控硬盘IO的check_iostat区分):
https://raw.githubusercontent.com/skywalka/check-cpu-perf/master/check_cpu_perf.sh
使用:
# /usr/lib64/nagios/plugins/check_iostat_cpu 20 10 --perf
修改nrpe.cfg文件:
# vi /etc/nagios/nrpe.cfg
command[check_iostat_cpu]=/usr/lib/nagios/plugins/check_iostat_cpu 20 10 --perf
:wq
# service nagios-nrpe-server restart (redhat为nrpe)
修改icinga2配置:
# vi /etc/icinga2/conf.d/templates.conf
object CheckCommand "nrpe-iostat-cpu" {
import "nrpe-common"
vars.nrpe_command = "check_iostat_cpu"
}
:wq
# vi /etc/icinga2/conf.d/services.conf
apply Service "iostat-cpu" {
import "generic-service"
check_command = "nrpe-iostat-cpu"
assign where host.address == "10.0.0.2"
}
:wq
# service icinga2 restart