潇湘夜雨移动版

主页 > 系统 >

nagios监控部署(一)(10)

 
 
vi /usr/local/nagios/etc/objects/commands.cfg
 
Change the definition of the check_nt command to include the "-s <PASSWORD>" argument (where PASSWORD is the password you specified on the Windows machine) like this:
 
 
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s PASSWORD -v $ARG1$ $ARG2$
}
也可以自定义程序检测模板
如:
define service{
        use                     generic-service
        host_name               winserver
        service_description     收音机
        check_command           check_nt!PROCSTATE!-d SHOWALL -l CRadio.exe
        }
 
Save the file.
启用Windows模板
vim etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
2、基于NRPE
 
NSClient++要启用如下模块:
[modules]
CheckSystem.dll
CheckDisk.dll
CheckExternalScripts.dll
FileLogger.dll
NRPEListener.dll
 
 
NRPE specific setting in NSClient++
use_ssl
allow_arguments
allow_nasty_meta_chars
 
 
check_nrpe语法:
check_nrpe ... -c <command> [-a <argument> <argument> <argument>]
 
 
check_nrpe的内置命令:
· CheckAlwaysCRITICAL (check)
· CheckAlwaysOK (check)
· CheckAlwaysWARNING (check)
· CheckCPU (check)
· CheckCRITICAL (check)
· CheckCounter (check)
· CheckEventLog/CheckEventLog (check)
· CheckFile (check)
· CheckFileSize (check)
· CheckMem (check)
· CheckMultiple (check)
· CheckOK (check)
· CheckProcState (check)
· CheckServiceState (check)
· CheckTaskSched/CheckTaskSched (check)
· CheckUpTime (check)
· CheckVersion (check)
· CheckWARNING (check)
· CheckWMI/CheckWMI (check)
· CheckWMIValue (check)
 
用法如:
# check_nrpe ... -c CheckCPU -a warn=80 crit=90 time=20m time=10s time=4
 
 
 
 
Nagios端的配置:
 
1) Template
 
define host{
name tpl-windows-servers 
use generic-host 
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 
}
 
2) 定义主机:
define host{
use tpl-windows-servers 
host_name windowshost
alias My First Windows Server
address 172.16.100.66
}
 
3) 定义服务:
 
define service{
use generic-service
host_name windowshost
service_description CPU Load
check_command check_nrpe!alias_cpu
}
 
define service{
use generic-service
host_name windowshost
service_description Free Space
check_command check_nrpe!alias_disk
}
 
 
3、基于NSCA
 
[modules]
CheckSystem.dll
CheckDisk.dll
CheckExternalScripts.dll
CheckHelpers.dll
(责任编辑:liangzh)