9)可查看或添加 NRPE的监控命令//在/usr/local/nagios/etc/目录下
ps:我的linux服务器端的配置文件代码如下
/usr/local/nagios/etc/nagios.cfg
/usr/local/nagios/etc/objects/localhost.cfg
# Define a host for the local machine
define host{
use linux-server,hosts-pnp ; 给网络设备用的
host_name HomeSwitch
alias HomeSwitch
address 192.168.77.128
icon_image switch.gif
statusmap_image switch.gd2
2d_coords 100,200
3d_coords 100,200,100
}
define host{
use linux-server,hosts-pnp
host_name monitor
alias 理工毕业设计
parents HomeSwitch
address 192.168.77.128
icon_image web.gif
statusmap_image web.gd2
2d_coords 100,300
3d_coords 100,300,100
}
#define host{
# use linux-server
# host_name MyGamePC
# alias MyGamePC
# parents HomeSwitch
# address 127.0.0.1
# icon_image server.gif
# statusmap_image server.gd2
# 2d_coords 200,300
# 3d_coords 200,300,100
# }
#define host{
# use linux-server
# host_name HomeRouter
# alias HomeRouter
# parents HomeSwitch
# address 127.0.0.1
# icon_image router.gif
# statusmap_image router.gd2
# 2d_coords 200,200
# 3d_coords 200,200,100
# }
#define host{
# use linux-server
# host_name xDSL
# alias xDSL
# parents HomeSwitch
# address 127.0.0.1
# icon_image router.gif
# statusmap_image router.gd2
# 2d_coords 200,100
# 3d_coords 200,100,100
# }
#define host{
# use linux-server
# host_name Firewall
# alias Firewall
# parents HomeRouter
# address 127.0.0.1
# icon_image router.gif
# statusmap_image router.gd2
# 2d_coords 300,200
# 3d_coords 300,200,100
# }
#define host{
# use linux-server
# host_name RADIUS
# alias RADIUS
# parents xDSL,MainSwitch
# address 192.168.2.1
# icon_image router.gif
# statusmap_image router.gd2
# 2d_coords 300,100
# 3d_coords 300,100,100
# }
#
#define host{
# use linux-server ; 给网络设备用的
# host_name MainSwitch
# alias MainSwitch
# parents Firewall
# address 127.0.0.1
# icon_image switch.gif
# statusmap_image switch.gd2
# 2d_coords 400,200
# 3d_coords 400,200,100
# }
#define host{
# use linux-server
# host_name IBME450
# alias IBME450
# parents MainSwitch
# address 127.0.0.1
# icon_image server.gif
# statusmap_image server.gd2
# 2d_coords 300,300
# 3d_coords 300,300,100
# }
#define host{
# use linux-server
# host_name SunUltra10
# alias SunUltra10
# parents MainSwitch
# address 127.0.0.1
# icon_image server.gif
# statusmap_image server.gd2
# 2d_coords 400,300
# 3d_coords 400,300,100
# }
#define host{
# use linux-server
# host_name Manager
# alias Manager
# parents MainSwitch
# address 127.0.0.1
# icon_image server.gif
# statusmap_image server.gd2
# 2d_coords 500,200
# 3d_coords 500,200,100
# }
###############################################################################
###############################################################################
#
# HOST GROUP DEFINITION
#
###############################################################################
###############################################################################
# Define an optional hostgroup for Linux machines
define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members * ; Comma separated list of hosts that belong to this group
}
define hostgroup{
hostgroup_name 本地监控机器组
alias 毕业设计服务器
members monitor
}
define servicegroup{
servicegroup_name 系统负荷检查
alias 负荷检查
members monitor,进程总数,monitor,登录用户数,monitor,根分区,monitor,交换空间利用率
}
define servicegroup{
servicegroup_name 全部联通性检查
alias 联通性检查
members HomeSwitch,PING,monitor,PING
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# Define a service to "ping" the local machine
define service{
use local-service,services-pnp ; Name of service template to use
host_name *
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if
# < 10% free space on partition.
define service{
use local-service ; Name of service template to use
host_name monitor
service_description 根分区
check_command check_local_disk!20%!10%!/
}
# Define a esrvice to check the number of currently logged in
# users on the local machine. Warning if > 20 users, critical
# if > 50 users.
define service{
use local-service ; Name of service template to use
host_name monitor
service_description 登录用户数
check_command check_local_users!20!50
}
# Define a service to check the number of currently running procs
# on the local machine. Warning if > 250 processes, critical if
# > 400 users.
define service{
use local-service,services-pnp ; Name of service template to use
host_name monitor
service_description 进程总数
check_command check_local_procs!250!400!RSZDT
}
# Define a service to check the load on the local machine.
define service{
use local-service,services-pnp ; Name of service template to use
host_name monitor
service_description 系统负荷
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}
# Define a service to check the swap usage the local machine.
# Critical if less than 10% of swap is free, warning if less than 20% is free
define service{
use local-service,services-pnp ; Name of service template to use
host_name monitor
service_description 交换空间利用率
check_command check_local_swap!20!10
}
# Define a service to check SSH on the local machine.
# Disable notifications for this service by default, as not all users may have SSH enabled.
define service{
use local-service,services-pnp ; Name of service template to use
host_name monitor
service_description SSH
check_command check_tcp!22!1.0!10.0
notifications_enabled 0
}
# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.
define service{
use local-service,services-pnp ; Name of service template to use
host_name monitor
service_description HTTP
check_command check_http
notifications_enabled 0
}
#网卡流量
define service{
use local-service,services-pnp
host_name monitor
service_description check_traffic
check_command check_traffic
max_check_attempts 5
normal_check_interval 3
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
}