服务器端(IP:124.172.223.141):
因为服务器自己也要监控本地,所以也要安装nrpe(被监控),plugins插件则是规定服务器可以监控哪些服务和主机
设置需要监控什么
可以添加哪些服务或主机被监控
[root@bogon objects]# cat /usr/local/nagios/etc/objects/linux.cfg
define host{
use linux-server
host_name 124.172.223.141
alias 124.172.223.141
address 124.172.223.141
}
define service{
use generic-service
host_name 124.172.223.141
service_description check-swap
check_command check_nrpe!check_swap
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.141
service_description check-load
check_command check_nrpe!check_load
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.141
service_description check-disk
check_command check_nrpe!check_df
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.141
service_description check-users
check_command check_nrpe!check_users
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.141
service_description otal_procs
check_command check_nrpe!check_total_procs
notifications_enabled 1
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.141
service_description check_mysql
check_command check_nrpe!check_mysql
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.141
service_description 05. The Nginx Status
check_command check_nrpe!check_nginx
notifications_enabled 1
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.141
service_description check-ping
check_command check_nrpe!check_ping
contact_groups system
}
###########################################################################
define host{
use linux-server
host_name 124.172.223.142
alias 124.172.223.142
address 124.172.223.142
}
define service{
use generic-service
host_name 124.172.223.142
service_description check-swap
check_command check_nrpe!check_swap
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.142
service_description check-load
check_command check_nrpe!check_load
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.142
service_description check-disk
check_command check_nrpe!check_df
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.142
service_description check-users
check_command check_nrpe!check_users
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.142
service_description otal_procs
check_command check_nrpe!check_total_procs
contact_groups system
notifications_enabled 1
}
define service{
use generic-service
host_name 124.172.223.142
service_description 05. The Nginx Status
check_command check_nrpe!check_nginx
notifications_enabled 1
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.142
service_description check_mysql
check_command check_nrpe!check_mysql
# action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICED
#ESC$
contact_groups system
}
define service{
use generic-service
host_name 124.172.223.142
service_description check-ping
check_command check_nrpe!check_ping
contact_groups system
}
[root@bogon objects]#
联系人设置,即接受警告的管理人员或组
[root@bogon objects]# cat contacts.cfg
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email nagios@localhost ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}
#######################################################################################
#######################################################################################
############## SYSTEM ADMINISTRATOR MEMBERS
#######################################################################################
#######################################################################################
define contact{
contact_name li1
use generic-contact
alias li1
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email 15218402325@139.com
}
define contact{
contact_name li2
use generic-contact
alias li2
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email 15218402325@163.com
}
#######################################################################################
#######################################################################################
############## SYSTEM ADMINISTRATOR GROUP
#######################################################################################
#######################################################################################
define contactgroup{
contactgroup_name system
alias system
members li1,li2
}
[root@bogon objects]#
客户端 (linux客户端也就一个nrpe,这里主要说的是linux)
IP:124.172.223.142
被监控是这么简单
服务器监控本地和客户端的一个截图