Nagios实战连载三:监控Linux主机
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-04-19
一、服务器端安装NRPEtar zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure --prefix=/usr/local/nagios make all make install-plugin //安装插件,安装完后会在/usr/local/nagios/libexec目录下多出一个check_nrpe文件 定义check_nrpe命令 #vi /usr/local/nagios/etc/objects/commands.cfg 在文件添加如下内容#''check_nrpe '' command definition define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ } 二、客户端设置 安装nagios插件tar zxvf nagios-plugins-1.4.15.tar.gzcd nagios-plugins-1.4.15./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios make && make install 安装NRPE ./configure --prefix=/usr/local/nagios make all make install make install-plugin make install-daemon / /安装守护进程 make install-daemon-config //安装NRPE配置文件 修改配置文件,设置nagios服务器的IP #vi /usr/local/nagios/etc/nrpe.cfg allowed_hosts=192.168.1.200 修改NRPE监控命令command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1 command[check_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z command[check_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%启动NRPE #/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d 三、配置Nagios服务器添加监控主机 # vi /usr/local/nagios/etc/objects/192.168.1.200.cfgdefine host{ use linux-server host_name 192.168.1.200 alias 192.168.1.200 address 192.168.1.200 } define hostgroup{ hostgroup_name 192.168.1.200 alias 192.168.1.200 members 192.168.1.200 } define service{ use generic-service host_name 192.168.1.200 service_description PING check_command check_ping!100.0,20%!500.0,60% } define service{ use generic-service host_name 192.168.1.200 service_description HTTP check_command check_http notifications_enabled 0 } define service{ use generic-service host_name 192.168.1.200 service_description Users check_command check_nrpe!check_users } define service{ use generic-service host_name 192.168.1.200 service_description CPU check_command check_nrpe!check_load } define service{ use generic-service host_name 192.168.1.200 service_description Disk check_command check_nrpe!check_disk } define service{ use generic-service host_name 192.168.1.200 service_description Swap check_command check_nrpe!check_swap } define service{ use generic-service host_name 192.168.1.200 service_description Procs check_command check_nrpe!check_procs } 拥有帝国一切,皆有可能。欢迎访问phome.net 初始化时的状态 正常监控状态 拥有帝国一切,皆有可能。欢迎访问phome.net |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Nagios实战连载三:监控Linux主机的所有评论