nagios监控端的安装

安装环境:centos 6.5 x86_64
在安装nagios之前,先解决依赖问题,直接使用yum安装

yum -y install gcc glibc glibc-common
yum -y install gd gd-devel    # 用于pnp绘图
yum -y install mysql mysql-devel mysql-server    # 如果要监控数据库,那么需安装mysql,否则mysql的相关插件不会被自动安装
yum -y install httpd php php-mysql php-gd

安装nagios-4.0.8

useradd -m nagios    # 创建nagios用户
passwd nagios
groupadd nagcmd    # 创建nagcmd组
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

tar xzf nagios-4.0.8.tar.gz
cd nagios-4.0.8
./configure --help
./configure --with-command-group=nagcmd --enable-event-broker

# 输出如下:
 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagcmd
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  ${prefix}/var/nagios.lock
   Check result directory:  ${prefix}/var/spool/checkresults
           Init directory:  /etc/rc.d/init.d
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /bin/mail
                  Host OS:  linux-gnu
          IOBroker Method:  epoll

make all
make install
make install-init    # 安装启动脚本
make install-config    # 安装config文件
make install-commandmode

make install-webconf    # 在httpd/conf.d下创建nagios的web配置文件
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart

安装nagios插件以及nrpe

# 编译nagios插件
tar xzf nagios-plugins-2.1.1.tar.gz
cd nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make && make install

chkconfig --add nagios
chkconfig nagios on
chkconfig --list nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg    # 检查配置文件
service nagios start

# 如果开启了selinux,可通过以下方式将nagios的CGI程序运行于selinux/targeted模式而不用关闭selinux
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

# 安装nrpe
tar xzf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/toc.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值