CentOS 7.3 安装 Nagios 4.3.4 和 Nagios Plugins 2.2.1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7.3 安装 Nagios 4.3.4 和 Nagios Plugins 2.2.1相关的知识,希望对你有一定的参考价值。

安装要求:

1. 纯净最小化安装 CentOS 7.3

2. 使用 root 用户登录系统

3. 有IP地址,系统能连接公网



安装依赖包及工具软件

# yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp unzip


下载 Nagios Core 和 Nagios Plugins

# cd /tmp

# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz

# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz


添加Nagios用户和组

# useradd nagios

# groupadd nagcmd

# useradd -a -G nagcmd nagios

# usermod -a -G nagios,nagcmd apache


安装 Nagios Core

解压安装包

# tar zxvf nagios-4.3.4.tar.gz

# tar zxvf nagios-plugins-2.2.1.tar.gz


转到Nagios Core安装目录

# cd nagios-4.3.4

# ./configure --with-command-group=nagcmd


*** Configuration summary for nagios 4.3.4 2017-08-24 ***:


 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:  /run/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


 Web Interface Options:

 ------------------------

                 html URL:  http://localhost/nagios/

                  CGI URL:  http://localhost/nagios/cgi-bin/

 Traceroute (used by WAP):  



Review the options above for accuracy.  If they look okay,

type ‘make all‘ to compile the main program and CGIs.


# make all

# make install 

# make install-init 

# make install-config 

# make install-commandmode 

# make install-webconf 

# cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/

# chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

# systemctl start nagios

# systemctl start httpd



新建 Web 访问用户

# htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin


安装 Nagios Plugin

# cd /tmp

# tar zxvf nagios-plugins-2.2.1.tar.gz

# cd nagios-plugins-2.2.1

# ./configure --with-nagios-user=nagios --with-nagios-group=nagios 

# make 

# make install 


设置 Nagios 开机启动服务


# chkconfig --add nagios

# chkconfig --level 35 nagios on

# systemctl enable httpd


配置防火墙

# firewall-cmd --permanent --add-service=http

# firewall-cmd --reload


访问 Nagios Web 界面


http://<your.nagios.server.ip>/nagios



参考官方安装文档:

https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf

本文出自 “望云眷蜀” 博客,请务必保留此出处http://wyjs6.blog.51cto.com/465920/1963380

以上是关于CentOS 7.3 安装 Nagios 4.3.4 和 Nagios Plugins 2.2.1的主要内容,如果未能解决你的问题,请参考以下文章

centos7安装nagios

CentOS6.8下Nagios-4.2.0安装和配置

Centos 7安装与配置nagios监控

CentOS下安装Nagios

CentOS7安装Nagios并配置出图详解

Centos7上yum安装nagios