[masamaso@cscc ~]$ ip a
inet 192.168.254.181/20 brd 192.168.255.255 scope global eth0 inet 10.2.0.181/29 brd 10.2.0.183 scope global eth0:0 inet 172.16.1.181/20 brd 172.16.15.255 scope global eth1
inet 10.16.0.181/20 brd 10.16.15.255 scope global eth2
-----------------添加客户端------------
0 0 62sudo su - root/usr/local/sbin/add_nagios.sh
--------------------------------------------
ssh 192.168.253.242
/etc/init.d/nagios restart
检测配置文件是否有问题
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios checkconfig如果需要其他端口 参考以下目录的配置文件,修改到要监控主机的末尾cd /usr/local/nagios/etc/objects/service
vim 192.168.244.49.cfg define service{
use generic-service,srv-pnp
host_name 192.168.244.49 # 这个修改成要监控的主机的ip
service_description check-nginx # 监控项描述
check_command check_tcp!80 # 要检测的端口
contact_groups jincin-db
notification_period 24x7
initial_state o
check_interval 5
retry_interval 1
max_check_attempts 5
active_checks_enabled 1
passive_checks_enabled 1
obsess_over_service 1
event_handler_enabled 1
low_flap_threshold 0
high_flap_threshold 0
flap_detection_enabled 1
flap_detection_options o,w,c,u
freshness_threshold 0
check_freshness 0
notification_options w,u,c,r
notifications_enabled 1
notification_interval 30
first_notification_delay 0
stalking_options n
process_perf_data 1
failure_prediction_enabled 1
retain_status_information 1
retain_nonstatus_information 1
}
nagios服务端重启
/etc/init.d/nagios restart
-=-nagios客户端重启 记的加入rc.local
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
ps -ef |grep nrpe
修改管理员密码 默认用户名nagiosadmin
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
nagios添加后的主机在vim /usr/local/nagios/etc/objects/host.cfg 来自为知笔记(Wiz)
标签:enabled,nagios,etc,usr,local,check From: https://www.cnblogs.com/kaixin940/p/16912144.html