nagios监控 主机与被监控机配置

主机安装
yum install -y gcc glibc glibc-common gd gd-devel xinetd openssl-devel perl


yum -y install httpd php mysql-devel php-mysql
groupadd nagcmd
useradd -G nagcmd nagios
usermod -a -G nagcmd apache
date
tar zxvf nagios-3.4.3.tar.gz
cd nagios
./configure --sysconfdir=/etc/nagios --with-command-group=nagcmd --enable-event-broker
make all
make install
make install-init
make install-commandmode
make install-config


make install-webconf  


htpasswd -c /etc/nagios/htpasswd.users nagiosadmin


chkconfig --add nagios
chkconfig nagios on
service nagios start


#插件
tar zxvf nagios-plugins-1.4.16.tar.gz 
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
service nagios restart


tar zxvf nrpe-2.13.tar.gz 
cd nrpe-2.13
make all
make install-plugin


#被监控机
useradd -s /sbin/nologin nagios
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios  #如果mysql先装mysql
make
make install


tar zxvf nrpe-2.13.tar.gz 
cd nrpe-2.13
./configure --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config
cd /usr/local/nagios/etc/


vi usr/local/nagios/etc/nrpe.cfg   修改allowed_hosts
#启动加可到rc.local中
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d  


-------------------------------------------下面是检查
./check_nrpe -H 192.168.1.225






commands.cfg  主机上增加
# 'check_nrpe'  command definition
define command{
        command_name  check_nrpe
        command_line  $USER1$/check_nrpe -H $HOSTADDRESS$ -c  $ARG1$
}
object 目录下增加 225.cfg


define host{
        use                     generic-host
        host_name               225     
        alias                   225
        address                 192.168.1.225            ;被测试机ip
        max_check_attempts      10      
        check_command           check-host-alive        ; Default command to check if servers  are "alive" 
}
 
define service{
        use                     generic-service
        host_name               225
        service_description     225-load
        check_command           check_nrpe!check_load
        }
define service{
        use                     generic-service
        host_name               225
        service_description     225-users
        check_command           check_nrpe!check_users
        }
define service{
        use                     generic-service
        host_name               225
        service_description     225-hda1
        check_command           check_nrpe!check_hda1
        }


/usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg 检查语法









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值