标签:nagios 监控 案例
服务端的IP是192.168.223.128,客户端是192.168.223.133,在服务端监控客户端的磁盘负载,swap使用情况,登录的用户数,总进程数,系统负载,僵尸进程数
1、 在服务端安装nagios主程序,nagios-plugins,nrpe。客户端安装nagios-plugins,nrpe。并且启动服务端和客户端的nrpe
启动nrpe命令:
/usr/local/nagios/bin/nrpe -c/usr/local/nagios/etc/nrpe.cfg –d
检测两端nrpe通不通的命令:
/usr/local/nagios/libexec/check_nrpe -H 对端的IP地址
2、 在客户端/usr/local/nagios/etc/nrpe文件下定义要监控的项目
3、 在服务端的/usr/local/nagios/etc/objects/commands.cfg文件下定义nrpe命令,格式如下:
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe-H $HOSTADDRESS$ -c $ARG1$
}
4、 在服务端的/usr/local/nagios/etc/objects/目录下(也可以在别的目录定义,只是为了方便)定义一个以客户端IP为文件名的配置文件192.168.223.133.cfg,加入入下内容:
define host{
use linux-server
host_name 192.168.223.133
alias 192.168.223.133
address 192.168.223.133
}
define service{
use local-service
host_name 192.168.223.133
service_description 133_user
check_command check_nrpe!check_users
}
define service{
use local-service
host_name 192.168.223.133
service_description 133_total_process
check_command check_nrpe!check_total_procs
}
define service{
use local-service
host_name 192.168.223.133
service_description 133_load
check_command check_nrpe!check_load
}
define service{
use local-service
host_name 192.168.223.133
service_description 133_sda1_monitor
check_command check_nrpe!check_sda1
}
define service{
use local-service
host_name 192.168.223.133
service_description 133_sda3_monitor
check_command check_nrpe!check_sda3
}
define service{
use local-service
host_name 192.168.223.133
service_description 133_zombie_procs
check_command check_nrpe!check_zombie_procs
}
define service{
use local-service
host_name 192.168.223.133
service_description 133_swap
check_command check_nrpe!check_swap
}
5、 在服务端的主配置文件/usr/local/nagios/etc/nagios.cfg里引用192.168.223.133.cfg文件
6、 检测,重启nagios服务
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
然后在网页上可以看到如下的画面
本文出自 “pc的个人博客” 博客,请务必保留此出处http://pc1990.blog.51cto.com/10541224/1676590
标签:nagios 监控 案例
原文地址:http://pc1990.blog.51cto.com/10541224/1676590