五,配置nagios服务端.
1,定义命令
在 "/usr/local/nagios/etc/objects/commands.cfg" 定义一条命令;
# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}
2,配置
define host{
use windows-server ; Inherit default values from a template
host_name 192.168.5.31 ; The name we're giving to this host
alias Host31 ; A longer name associated with the host
address 192.168.5.31 ; IP address of the host
}
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}
# 监控系统运行时间
define service{
use generic-service
host_name 192.168.5.31
service_description Uptime
check_command check_nt!UPTIME
}
# 监控 CPU 负载
define service{
use generic-service
host_name 192.168.5.31
service_description Load Average
check_command check_nt!CPULOAD!-l 5,80,90
}
# 监控 内存
define service{
use generic-service
host_name 192.168.5.31
service_description Memory
check_command check_nt!MEMUSE!-w 80 -c 90
}
#监控 C 盘使用情况
define service{
use generic-service
host_name 192.168.5.31
service_description C Disk
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
#监控 HTTP
define service{
use generic-service
host_name 192.168.5.31
service_description HTTP
check_command check_http
}
3,重启nagios
六,收工,看看效果