cgi.cfg #cgi配置文件
commands.cfg #命令配置文件
contacts.cfg #联系人配置文件
resource.cfg #定义插件路径文件
templates.cfg、timeperiods.cfg 组,监控时间段等配置文件
linux.cfg #用户自定义文件,监控linux主机,定义主机配置文件
windows.cfg #用户自定义文件,监控windows主机,定义主机配置文件
l-services.cfg #用户自定义文件,定义linux主机服务配置文件
w-services.cfg #用户自定义文件,定义windows主机服务配置文件
vi cgi.cfg #以下是需要修改的地方
authorized_for_system_information=nagiosadmin,test
authorized_for_configuration_information=nagiosadmin,test
authorized_for_system_commands=nagiosadmin,test
authorized_for_all_services=nagiosadmin,test
authorized_for_all_hosts=nagiosadmin,test authorized_for_all_service_commands=nagiosadmin,test authorized_for_all_host_commands=nagiosadmin,test
use_authentication=0
and check the authorization options in your CGI configuration file.
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_dir=/usr/local/nagios/etc/linux #配置linux主机加载自定义文件的目录(下面包括linux.cfg、l-services.cfg文件)
cfg_dir=/usr/local/nagios/etc/windows #配置win主机加载自定义文件的 目录(包括windows.cfg、w-services.cfg)
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
command_name check_mysql_health #定义mysql监控命令 command_line $USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$
}
define command{
command_name notify-service-by-sms #定义飞信监控命令 command_line /usr/local/tools/install/fetion --mobile=159230***** --pwd=2255*** --to=$CONTACTPAGER$ --msg-gb="$HOSTNAME$ $SERVICEDESC$ is $SERVICESTATE$ on $TIME$ result is $SERVICEOUTPUT$" $CONTACTPAGER$
}
notify-host-by-email、notify-service-by-email这二项是定义mail报警的命令,默认文件有这二项
contact_name nagiosadmin
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email,notify-service-by-sms
host_notification_commands notify-host-by-email
email [email]test@[/email],[email]test@[/email]
}
define host{
use generic-host
host_name cvs-1.11
alias cvs-server
address 192.168.1.11
check_command check-host-alive
max_check_attempts 10
check_period 24x7
notification_interval 20
notification_period 24x7
notification_options d,r
contact_groups admins
name cvs-1.11 #定义名字
}
define host{
use generic-host
alias web-server
address 192.168.1.72
use cvs-1.11 #调用cvs-1.11的配置
}
use generic-host
host_name windows-1.8
alias win-server
address 192.168.1.8
check_command check-host-alive
max_check_attempts 10
check_period 24x7
notification_interval 20
notification_period 24x7
notification_options d,r
contact_groups admins
name windows-1.8 #定义名字
}
define host{
use generic-host
alias web-server
address 192.168.1.71
use windows-1.8 #调用windows-1.8配置文件
}
use generic-service
host_name cvs-1.11 #与l-linux.cfg主机服务的名字相对应
service_description HTTP status
is_volatile 0 #类似声音警告功能关闭
check_period 24x7 #监控期限为24X7
max_check_attempts 3 #最大检测3次
normal_check_interval 1 #每一分钟检测一次
retry_check_interval 1 #间隔1分钟检测
contact_groups admins #监控组
notification_options w,u,c,r # w,u,c,r 发生这四种情况时,进行通告
notification_interval 5 # 通告间隔
notification_period 24x7 #检测时间段
check_command check_http
}
use generic-service
host_name windows-1.8
service_description NSClient++ Version
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 1
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 5
notification_period 24x7
check_command check_nt!CLIENTVERSION
}
use generic-service
host_name windows-1.8
service_description E:\ Drive Space
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 1
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 5
notification_period 24x7
check_command check_nt!USEDDISKSPACE!-l e -w 80 -c 90
}
cd nrpe-2.8.1
./configure –prefix=/usr/local/nrpe
make
make install
cp /usr/local/nagios/libexec/check_disk /usr/local/nrpe/libexec
cp /usr/local/nagios/libexec/check_load /usr/local/nrpe/libexec
cp /usr/local/nagios/libexec/check_ping /usr/local/nrpe/libexec
cp /usr/local/nagios/libexec/check_procs /usr/local/nrpe/libexec
server_address=192.168.1.56 #服务器IP
allowed_hosts=127.0.0.1,192.168.1.56 #充许nagios服务器IP访问
tcp 0 0 192.168.1.56:5666 0.0.0.0:* LISTEN 2233/nrpe
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
CheckWMI.dll
net start nsclient
Total Errors: 0


















