下载地址如下:

Nagios
4.0.1版本安装,适用于福睿斯HEL/CentOS
5.x/6.x 或者Fedora
17/18/19。

Nagios 4.0.1本子安装,适用于福特ExplorerHEL/CentOS 5.x/6.x 如故Fedora 17/18/19。

一、Nagios概述

实际详细下载地址:

自个儿的遇到如下:

自个儿的条件如下:

1、简介

相关阅读

Centos-6.2

Centos-6.2

Nagios是插件式的结构,它自身并没有其余监察和控制功用,全数的监察都以透过插件进行的,由此其是可观模块化和充实弹性的。Nagios监察和控制的对象可分为两类:主机和劳动。主机日常指的是物理主机,如服务器、路由器、专门的学问站和打字与印刷机等,这里的主机也能够是杜撰设备,如xen虚构出的Linux系统;而服务普通指某些特定的效果,如提供http服务的httpd进程等。而为了管住上的有利,主机和服务还足以独家被设计为主机组和服务组等。

网络监察和控制器Nagios全计谋
http://www.linuxidc.com/Linux/2013-07/87067.htm

Nagios 4.0.1

Nagios 4.0.1

Nagios不监察和控制任何实际数值指标(如操作系统上的进度个数),它仅用种种浮泛属性对被监察和控制对象的情景实行描述:OK、WAQX56NING,
C哈弗ITICAL和UNKNOWN。于是,管理员只须要对某种被监督对象的WA奥德赛NING和CEvoqueITICAL状态的阈值举办关爱和概念就可以。Nagios通过将WARTING和CRTICAL的阈值传递给插件,并由插件担当某具体目的的督察及结果深入分析,其出口音讯为状态音信(OK,WA大切诺基NING,CCRUISERITICAL或UNKOWN)以及一些增大的事无巨细表达音讯。

Nagios搭建与布置详解
http://www.linuxidc.com/Linux/2013-05/84848.htm

Nagios Plugin 1.5

Nagios Plugin 1.5

2、特性

Nginx意况下创设Nagios监察和控制平台
http://www.linuxidc.com/Linux/2011-07/38112.htm

Nagios是三个那多少个棒的不收费的开源的监察工具,它提供给您贰个很完善的监督检查境遇,始终紧密监视你的机器大概网络,不管是在数据基本依然在你和睦的三个小实验室。

Nagios是二个非常的厉害的无需付费的开源的监察和控制工具,它提需求你一个很周详的督察境况,始终紧凑监视你的机器大概互联网,不管是在多少基本如故在您自身的三个小实验室。

由上述表明能够,Nagios是极富弹性的,其监督作用完全能够依据组织者的盼望实行。另外,它外提供了对难点的自动响应本领和三个成效庞大的通报系统。全体那个功效的兑现是依附二个协会明晰的靶子定义系统和少数多少个目标类型达成的。

在奥德赛HEL5.3上安顿基本的Nagios系统(使用Nagios-3.1.2)
http://www.linuxidc.com/Linux/2011-07/38129.htm

手续1:安装必要的借助包

手续1:安装须求的依靠包

1) 命令(Commands)

CentOS
5.5+Nginx+Nagios监察和控制端和被控端安装配备指南
http://www.linuxidc.com/Linux/2011-09/44018.htm

供给设置Apache、PHP和有个别库像:gcc、glibc、glibc-common、gd、gd-devel、make、net-snmp

内需设置Apache、PHP和部分库像:gcc、glibc、glibc-common、gd、gd-devel、make、net-snmp

“命令”用于定义Nagios怎么着施行某一定的监督检查专门的学问。它是依照某一定的Nagios插件定义出的三个抽象层,平常满含一组要实行的操作。

Ubuntu 13.10 Server
安装 Nagios Core 网络监督运用
http://www.linuxidc.com/Linux/2013-11/93047.htm

[root@taoteng ~]# yum install -y httpd php gcc glibc glibc-common gd
gd-devel make net-snmp

[[email protected]
~]# yum install -y httpd php gcc glibc glibc-common gd gd-devel make
net-snmp

2)时段(Time periods)

1 开头下载:
wget

如下图所示,下载free版本的。
图片 1

步骤2:创设四个nagios用户和组

手续2:创设贰个nagios用户和组

“时段”用于定义某“操作”能够施行或无法执行的日期和时间跨度,如专业日内的每日8:00-18:00等;

设置前筹划工作,安装一些lib包:

创立五个新的nagios用户和nagcmd组账户并设置密码。
[root@taoteng ~]# useradd nagios
[root@taoteng ~]# groupadd nagcmd
接下来,添加nagios和Apache用户到nagcmd组。

始建三个新的nagios用户和nagcmd组账户并设置密码。
[[email protected]
~]# useradd nagios
[[email protected]
~]# groupadd nagcmd
接下来,添加nagios和Apache用户到nagcmd组。

3)联系人和关系人组(Contacts and contact groups)

[root@cache-2 root]# yum -y install httpd gcc glibc glibc-common

[root@tecmint]# usermod -G nagcmd nagios
[root@tecmint]# usermod -G nagcmd apache

[[email protected]]#
usermod -G nagcmd nagios
[[email protected]]#
usermod -G nagcmd apache

“联系人”用于定义某监察和控制事件的公告对象、要公告的新闻以及那个接收文告者何时及怎样摄取通知;二个或两个联系人能够定义为关联人组,而贰个关系人也得以属于四个组;

# yum install -y gcc glibc glibc-common gd gd-devel xinetd
openssl-devel 

步骤3:下载Nagios-4.0.1和Nagios-plugin-1.5

步骤3:下载Nagios-4.0.1和Nagios-plugin-1.5

4) 主机和主机组(Host and Host groups)

2 实行selinux设置,恐怕关闭selinux

在/root目录下创办三个安装包以及继续须要下载的安装包的目录。

在/root目录下创办三个安装包以及继续需求下载的安装包的目录。

“主机”平日指某物理主机,其满含此主机相关的通报音信的收信人(即联系人)、怎么样及哪一天举办监督检查的概念。主机也可以分组,即主机组(host
groups),多个主机可同一时候属于多少个组;

查看SELinux状态:

[root@taoteng ~]# mkdir /root/nagios

[[email protected]
~]# mkdir /root/nagios

5) 服务(Services)

(1)/usr/sbin/sestatus -v ##倘诺SELinux status参数为enabled即为开启状态

[root@taoteng ~]# cd /root/nagios

[[email protected]
~]# cd /root/nagios

“服务”平时指某主机上可被监督的特定的效用或财富,其包蕴此服务相关的照应音讯的收信人、怎么着及哪一天进行监督检查等。服务也能够分组,即服务组(Servicegroups),二个服务可同不经常间属于多个服务组;

SELinux status: enabled

后天来下载最新版本的Nagio-4.0.1和Nagios-plugin-1.5通过wget命令

今昔来下载最新版本的Nagio-4.0.1和Nagios-plugin-1.5通过wget命令

3、注重关系

(2)getenforce ##也得以用这几个命令检查

  [root@taoteng nagios]# wget

 
[[email protected]
nagios]# wget

Nagios的强劲功效还呈未来其早熟的借助关系系统上。比方,某路由道具故障必然会促成关联在其上的别的主机无法被符合规律访谈,要是不可能定义这一个器具间的注重关系,那么监察和控制种类上肯定晤面世大批量的道具故障消息。而Nagios则通过注重关系来陈述网络设施的拓扑结构,并能够达成在某设备故障时不再对借助于此设备的别样设备开始展览检查实验,从而防止了无谓的故障音讯,方便管理员及时稳住并排除故障。其它,Nagios的依赖关系还能在劳动品级上贯彻,借使某服务信赖于其余服务时,也能落到实处类似主机依据关系的功力。

关闭SELinux:

  [root@taoteng nagios]# wget

 
[[email protected]
nagios]# wget

4、宏

(3)不时关门(不用重启机器):

步骤4:提取Nagios和nagios-plugins压缩包

步骤4:提取Nagios和nagios-plugins压缩包

Nagios还能够够使用宏,并且宏的概念在全部Nagios系统中颇具一致性。宏是能够用于对象定义中的变量,其值常常注重于上下文。在“命令”中定义的宏,相对于主机、服务或别的众多参数来讲,其值会随之分裂。譬喻,某吩咐能够依据向其传递的IP地址的例外来监督差别的主机。

setenforce 0 ##设置SELinux 成为permissive模式

  大家须求经过tar命令来提取下载的压缩包里面的文件:

  大家供给经过tar命令来提取下载的压缩包里面包车型地铁公文:

5、布署中宕机

##setenforce 1 设置SELinux 成为enforcing模式

  [root@taoteng nagios]# tar -zxvf nagios-4.0.1.tar.gz

 
[[email protected]
nagios]# tar -zxvf nagios-4.0.1.tar.gz

Nagios还提供了调整性安插中的宕机机制,管理员能够周期性的设定某主机或服务为布置中的不可用状态。这种效益能够阻碍Nagios在调整宕机时段公告别的新闻。当然,那也得以让Nagios自动公告管理员该进行主机或劳务保险了。

(4)修改配置文件必要重启机器:

  [root@taoteng nagios]# tar -zxvf nagios-plugins-1.5.tar.gz

 
[[email protected]
nagios]# tar -zxvf nagios-plugins-1.5.tar.gz

6、软状态和硬状态(Soft and Hard States)

修改/etc/selinux/config 文件

紧接着nagios文件夹里面将会并发解压之后的公文夹

随之nagios文件夹里面将会油然则生解压之后的文本夹

看来,Nagios的主要办事是检查实验主机或劳动的情况,并将其积攒下来。某不时时,主机或服务情形仅能够是种种可用状态之一,由此,其场所能够科学反映主机或劳动的骨子里境况就显得极其重大。为了防止某不时的暂且或随机性难点,Nagios引进了软状态和硬状态。在其实的检查实验中,Nagios一旦发掘某主机或服务的地方为UNKOWN或分歧于上三次检验时的动静,其将会对此主机或劳动进行多次测量检验以管教此情形的更改是非一时性的。具体共要做出五遍测量试验是足以陈设的,在这几个指定次数的测量检验时段内,Nagios尽管此变化后的景况为软件状态。一旦测量试验完了后状态依旧为新变的情事时,此情景就成了硬状态。

将SELINUX=enforcing改为SELINUX=disabled

[root@taoteng nagios]# ll

[[email protected]
nagios]# ll

二、安装配置Nagios

重启机器就能够 

总用量 30668

总用量 30668

1、Nagios程序简要介绍

3 初步希图nagios安装情形

drwxrwxr-x 18 root  root      4096  2月 20 21:22 nagios-4.0.1

drwxrwxr-x 18 root  root      4096  2月 20 21:22 nagios-4.0.1

Nagios经常由二个主程序(Nagios)、贰个插件程序(Nagios-plugins)和多少个可选的ADDON(NRPE、NSCA、NSClient++和NDOUtils)组成。Nagios的督察工作都以透过插件完结的,由此,Nagios和Nagios-plugins是劳务器端职业所不可不的零部件。而三个ADDON中,NRPE用来在监督的远程Linux/Unix主机上进行脚本插件以贯彻对这么些主机财富的监控;NSCA用来让被监督的远程Linux/Unix主机主动将监督消息发送给Nagios服务器(那在冗余监察和控制方式中等职业高校门要选拔);NSClient++是用来监督Windows主机时设置在Windows主机上的零件;而NDOUtils则用来将Nagios的配置新闻和各event发生的数据存入数据库,以促成这个数据的短平快搜索和拍卖。这八个ADDON(附属类小部件)中,NRPE和NSClient++工作于客户端,NDOUtils职业于劳动器端,而NSCA则须求同一时间设置在劳动器端和客户端。

(1) 增添nagios运营所急需的用户和组:

-r-xr-xr-x  1 root  root  1696847  2月 20 20:58 nagios-4.0.1.tar.gz

-r-xr-xr-x  1 root  root  1696847  2月 20 20:58 nagios-4.0.1.tar.gz

图片 2

groupadd nagcmd

drwxr-xr-x 15 nagios nagios    4096  2月 24 00:58 nagios-cn-3.2.3

drwxr-xr-x 15 nagios nagios    4096  2月 24 00:58 nagios-cn-3.2.3

最近,Nagios只好设置在Linux系统主机上,其编写翻译要求用到gcc。同期,假若打算动用web分界面包车型客车管理工科具的话,还必要有apache服务器和GD图形库的支撑。

useradd -m nagios

-r-xr-xr-x  1 root  root  9638175  2月 20 20:58 nagios-cn-3.2.3.tar.bz2

-r-xr-xr-x  1 root  root  9638175  2月 20 20:58 nagios-cn-3.2.3.tar.bz2

在Ubuntu下安顿Mrtg监察和控制Nginx和服务器系统能源
http://www.linuxidc.com/Linux/2013-08/88417.htm

usermod -a -G nagcmd nagios 

drwxr-xr-x 15    200    300    4096  2月 20 22:04 nagios-plugins-1.5

drwxr-xr-x 15    200    300    4096  2月 20 22:04 nagios-plugins-1.5

使用 snmp+Mrtg 监控 Linux 系统
http://www.linuxidc.com/Linux/2012-11/73561.htm

把apache加入到nagcmd组,以便于在经过web
Interface操作nagios时能够具有足够的权限:

-r-xr-xr-x  1 root  root  2428258  2月 20 20:58
nagios-plugins-1.5.tar.gz

-r-xr-xr-x  1 root  root  2428258  2月 20 20:58
nagios-plugins-1.5.tar.gz

Mrtg服务器搭建(监察和控制互联网流量)
http://www.linuxidc.com/Linux/2012-07/64315.htm

# usermod -a -G nagcmd apache 

配置nagios的核心

配置nagios的核心

互联网监控器Nagios全攻略
http://www.linuxidc.com/Linux/2013-07/87067.htm

4 编写翻译安装希图

最近,首先我们将布置nagios主旨,将步向到nagios文件夹里面运维configure命令,假若全部运营顺遂将会出现上面包车型客车分界面:

今昔,首先大家将配备nagios宗旨,将跻身到nagios文件夹里面运营configure命令,假若全勤运营顺遂将会油可是生下边包车型大巴分界面:

Nagios搭建与陈设详解
http://www.linuxidc.com/Linux/2013-05/84848.htm

./configure
–with-command-group=nagios
–prefix=/opt/app/nagios
–enable-embedded-perl
–with-httpd-conf=/usr/local/apache2/conf

[root@taoteng nagios]# cd nagios-4.0.1

[[email protected]
nagios]# cd nagios-4.0.1

Nginx意况下创设Nagios监察和控制平台
http://www.linuxidc.com/Linux/2011-07/38112.htm

  1. [root@cache-2 nagios-4.0.6]# ./configure –with-command-group=nagios
    –prefix=/opt/app/nagios –enable-embedded-perl –with-httpd-conf=/usr/local/apache2/conf
  2. checking for a BSD-compatible
    install… /usr/bin/install -c
  3. checking build system type… x86_64-unknown-linux-gnu
  4. checking host system type… x86_64-unknown-linux-gnu
  5. checking for gcc… gcc
  6. checking for C compiler default output file name… a.out
  7. checking whether the C compiler works… yes
  8. checking whether we are cross compiling… no
  9. ………………………..
  10. HTML URL:
  11. CGI URL:
  12. Traceroute (used by WAP): /bin/traceroute
      1. Review the options above for
        accuracy. If they look okay,
  13. type ‘make all’ to compile the main
    program and CGIs.

    [root@cache-2 nagios-4.0.6]# ./configure –with-command-group=nagios –prefix=/opt/app/nagios –enable-embedded-perl –with-httpd-conf=/usr/local/apache2/conf
    checking for a BSD-compatible install… /usr/bin/install -c
    checking build system type… x86_64-unknown-linux-gnu
    checking host system type… x86_64-unknown-linux-gnu
    checking for gcc… gcc
    checking for C compiler default output file name… a.out
    checking whether the C compiler works… yes
    checking whether we are cross compiling… no
    ………………………..
    HTML URL:

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

    Traceroute (used by WAP): /bin/traceroute

[root@taoteng nagios-4.0.1]# ./configure –with-command-group=nagcmd

[[email protected]
nagios-4.0.1]# ./configure –with-command-group=nagcmd

在TucsonHEL5.3上安排基本的Nagios系统(使用Nagios-3.1.2)
http://www.linuxidc.com/Linux/2011-07/38129.htm

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

输出示例:

出口示例:

CentOS
5.5+Nginx+Nagios监察和控制端和被控端安装配置指南
http://www.linuxidc.com/Linux/2011-09/44018.htm

5 开始make安装
5.1 make all

[root@cache-2 nagios-4.0.6]# make
all

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 Web
Interface Options: ————————                HTML URL: 
                  CGI URL: 
Traceroute (used by WAP): 
/bin/tracerouteReview the options above for accuracy.  If they look
okay,type ‘make all’ to compile the main program and CGIs.
继之安插和编写翻译全数的的二进制文件,make和make
install将会在你的机械上设置所需的二进制文件然后才干承袭设置,

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 Web
Interface Options: ————————                HTML URL: 
                  CGI URL: 
Traceroute (used by WAP): 
/bin/tracerouteReview the options above for accuracy.  If they look
okay,type ‘make all’ to compile the main program and CGIs.
随后安插和编写翻译全数的的二进制文件,make和make
install将会在您的机械上设置所需的二进制文件然后技艺持续设置,

Ubuntu 13.10 Server 安装 Nagios Core 互连网监察和控制运用
http://www.linuxidc.com/Linux/2013-11/93047.htm

  1. cd ./base && make
  2. make[1]: Entering directory `/root/nagios-4.0.6/base’
  3. gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nagios.o
    nagios.c
  4. gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o broker.o
    broker.c
  5. gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nebmods.o
    nebmods
  6. …………………….
  7. For more information on obtaining support for Nagios, visit:
    1. *************************************************************
    1. Enjoy.

    cd ./base && make
    make[1]: Entering directory `/root/nagios-4.0.6/base’
    gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nagios.o nagios.c
    gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o broker.o broker.c
    gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nebmods.o nebmods
    …………………….
    For more information on obtaining support for Nagios, visit:

       http://support.nagios.com
    

    Enjoy.

[root@taoteng nagios-4.0.1]# make

[[email protected]
nagios-4.0.1]# make

2、安装前的备选职业

 

[root@taoteng nagios-4.0.1]# make install

[[email protected]
nagios-4.0.1]# make install

(1)搞虞诩装Nagios的信赖关系:

5.2 make install
[root@cache-2 nagios-4.0.6]# make install

 

 

Nagios基本组件的运行注重于httpd、gcc、gd。能够透过以下命令来检查nagios所正视的rpm包是还是不是早就完全安装:

  1. cd ./base && make install
  2. make[1]: Entering directory `/root/nagios-4.0.6/base’
  3. make install-basic
  4. make[2]: Entering directory `/root/nagios-4.0.6/base’
  5. ……………………………………………..
  6. make[2]: Entering directory `/root/nagios-4.0.6/cgi’
  7. for file in *.cgi; do \
  8. /usr/bin/strip /usr/local/nagios/sbin/$file; \
  9. done

    cd ./base && make install
    make[1]: Entering directory /root/nagios-4.0.6/base'
    make install-basic
    make[2]: Entering directory
    /root/nagios-4.0.6/base’
    ……………………………………………..
    make[2]: Entering directory `/root/nagios-4.0.6/cgi’
    for file in *.cgi; do \
    /usr/bin/strip /usr/local/nagios/sbin/$file; \
    done

输出样例:

出口样例:

[root@DB2 ~]# yum -y install httpd gcc glibc glibc-common gd gd-devel
php php-mysql mysql mysql-devel mysql-server

5.3 make install-config

*** Main program, CGIs and HTML files installed ***You can
continue with installing Nagios as follows (type ‘make’without any
arguments for a list of all possible options):  make install-init    –
This installs the init script in /etc/rc.d/init.d  make
install-commandmode    – This installs and configures permissions on
the      directory for holding the external command file  make
install-config    – This installs sample config files in
/usr/local/nagios/etc
实质上从下面的样例上能够看到下步咱们要求的操作步骤,接着推行make
install-init去安装早先化脚本。

*** Main program, CGIs and HTML files installed ***You can
continue with installing Nagios as follows (type ‘make’without any
arguments for a list of all possible options):  make install-init    –
This installs the init script in /etc/rc.d/init.d  make
install-commandmode    – This installs and configures permissions on
the      directory for holding the external command file  make
install-config    – This installs sample config files in
/usr/local/nagios/etc
实在从地点的样例上得以见到下步大家要求的操作步骤,接着实施make
install-init去安装初阶化脚本。

评释:以上软件包你也得以经过编写翻译源代码的方法安装,只是前面比相当多要用到的有关文书的门路等急需依据你的源代码安装时的配备逐条修改。其它,您还得按需运维要求的劳务,如httpd等。

  1. [root@cache-2 nagios-4.0.6]# make install-config
  2. /usr/bin/install -c -m 775 -o nagios -g nagios -d
    /usr/local/nagios/etc
  3. /usr/bin/install -c -m 775 -o nagios -g nagios -d
    /usr/local/nagios/etc/objects
  4. /usr/bin/install -c -b -m 664 -o nagios -g nagios
    sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
  5. …………………………………………….
  6. /usr/bin/install -c -b -m 664 -o nagios -g nagios
    sample-config/template-object/printer.cfg
    /usr/local/nagios/etc/objects/printer.cfg
  7. /usr/bin/install -c -b -m 664 -o nagios -g nagios
    sample-config/template-object/switch.cfg
    /usr/local/nagios/etc/objects/switch.cfg
    1. *** Config files installed ***

    [root@cache-2 nagios-4.0.6]# make install-config
    /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
    /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
    …………………………………………….
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
    /usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg

    Config files installed

[root@taoteng nagios-4.0.1]# make install-init

[[email protected]
nagios-4.0.1]# make install-init

(2)增加nagios运维所急需的用户和组:

5.4 make install-commandmode

从输出的授命行上能够看来大家须要设置外界命令文件(libxce)

从出口的下令行上能够见到大家须求安装外界命令文件(libxce)

[root@DB2 ~]# groupadd nagcmd

  1. [root@cache-2 nagios-4.0.6]# make install-commandmode
  2. /usr/bin/install -c -m 775 -o nagios -g nagios -d
    /usr/local/nagios/var/rw
  3. chmod g+s /usr/local/nagios/var/rw
    1. *** External command directory configured ***
    1. Remember, these are *SAMPLE* config files. You’ll need to read
  4. the documentation for more information
    on how to actually define
  5. services, hosts, etc. to fit your particular needs.

    [root@cache-2 nagios-4.0.6]# make install-commandmode
    /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/rw
    chmod g+s /usr/local/nagios/var/rw

    External command directory configured

    Remember, these are SAMPLE config files. You’ll need to read
    the documentation for more information on how to actually define
    services, hosts, etc. to fit your particular needs.

[root@taoteng nagios-4.0.1]# make install-commandmode

[[email protected]
nagios-4.0.1]# make install-commandmode

[root@DB2 ~]# useradd -G nagcmd nagios

5.5 make install-init

接下去安装nagios示例文件,运营上面包车型地铁吩咐:

接下去安装nagios示例文件,运营上边包车型地铁命令:

[root@DB2 ~]# passwd nagios

  1. [root@cache-2 nagios-4.0.6]# make install-init
  2. /usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d/init.d
  3. /usr/bin/install -c -m 755 -o root -g root daemon-init
    /etc/rc.d/init.d/nagios
    1. *** Init script installed ***

    [root@cache-2 nagios-4.0.6]# make install-init
    /usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d/init.d
    /usr/bin/install -c -m 755 -o root -g root daemon-init /etc/rc.d/init.d/nagios

    Init script installed

[root@taoteng nagios-4.0.1]# make install-config

[[email protected]
nagios-4.0.1]# make install-config

把apache加入到nagcmd组,以便于在通过web
Interface操作nagios时亦可享有丰硕的权位:

[root@cache-2 nagios-4.0.6]#

出口示例:
/usr/bin/install -c -m 775 -o nagios -g nagios -d
/usr/local/nagios/etc/usr/bin/install -c -m 775 -o nagios -g nagios -d
/usr/local/nagios/etc/objects/usr/bin/install -c -b -m 664 -o nagios -g
nagios sample-config/nagios.cfg
/usr/local/nagios/etc/nagios.cfg/usr/bin/install -c -b -m 664 -o nagios
-g nagios sample-config/cgi.cfg
/usr/local/nagios/etc/cgi.cfg/usr/bin/install -c -b -m 660 -o nagios -g
nagios sample-config/resource.cfg
/usr/local/nagios/etc/resource.cfg/usr/bin/install -c -b -m 664 -o
nagios -g nagios sample-config/template-object/templates.cfg
/usr/local/nagios/etc/objects/templates.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/commands.cfg
/usr/local/nagios/etc/objects/commands.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/contacts.cfg
/usr/local/nagios/etc/objects/contacts.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/timeperiods.cfg
/usr/local/nagios/etc/objects/timeperiods.cfg/usr/bin/install -c -b -m
664 -o nagios -g nagios sample-config/template-object/localhost.cfg
/usr/local/nagios/etc/objects/localhost.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/windows.cfg
/usr/local/nagios/etc/objects/windows.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/printer.cfg
/usr/local/nagios/etc/objects/printer.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/switch.cfg
/usr/local/nagios/etc/objects/switch.cfg*** Config files installed
***Remember, these are *SAMPLE* config files.  You’ll need to
readthe documentation for more information on how to actually
defineservices, hosts, etc. to fit your particular needs.
手续5:自定义nagios配置文件

出口示例:
/usr/bin/install -c -m 775 -o nagios -g nagios -d
/usr/local/nagios/etc/usr/bin/install -c -m 775 -o nagios -g nagios -d
/usr/local/nagios/etc/objects/usr/bin/install -c -b -m 664 -o nagios -g
nagios sample-config/nagios.cfg
/usr/local/nagios/etc/nagios.cfg/usr/bin/install -c -b -m 664 -o nagios
-g nagios sample-config/cgi.cfg
/usr/local/nagios/etc/cgi.cfg/usr/bin/install -c -b -m 660 -o nagios -g
nagios sample-config/resource.cfg
/usr/local/nagios/etc/resource.cfg/usr/bin/install -c -b -m 664 -o
nagios -g nagios sample-config/template-object/templates.cfg
/usr/local/nagios/etc/objects/templates.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/commands.cfg
/usr/local/nagios/etc/objects/commands.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/contacts.cfg
/usr/local/nagios/etc/objects/contacts.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/timeperiods.cfg
/usr/local/nagios/etc/objects/timeperiods.cfg/usr/bin/install -c -b -m
664 -o nagios -g nagios sample-config/template-object/localhost.cfg
/usr/local/nagios/etc/objects/localhost.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/windows.cfg
/usr/local/nagios/etc/objects/windows.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/printer.cfg
/usr/local/nagios/etc/objects/printer.cfg/usr/bin/install -c -b -m 664
-o nagios -g nagios sample-config/template-object/switch.cfg
/usr/local/nagios/etc/objects/switch.cfg*** Config files installed
***Remember, these are *SAMPLE* config files.  You’ll need to
readthe documentation for more information on how to actually
defineservices, hosts, etc. to fit your particular needs.
手续5:自定义nagios配置文件

[root@DB2 ~]# usermod -a -G nagcmd apache

加到运维项里面去:

开发“contacts.cfg”文件编写制定当出现报告警察方情况时候的nagios助理馆员的电子邮箱

开荒“contacts.cfg”文件编写制定当出现报告警方情状时候的nagios管理员的电子邮箱

3、编写翻译安装nagios:

# chkconfig –add nagios

[root@taoteng nagios-4.0.1]# vi
/usr/local/nagios/etc/objects/contacts.cfg

[[email protected]
nagios-4.0.1]# vi /usr/local/nagios/etc/objects/contacts.cfg

[root@DB2 ~]# tar -zxf nagios-3.3.1.tar.gz

# chkconfig –level 35 nagios on

输出样例:

出口样例:

[root@DB2 ~]# cd nagios

# chkconfig –list nagios

###############################################################################

###############################################################################

[root@DB2 nagios]# ./configure –with-command-group=nagcmd
–enable-event-broker

图片 3

#

#

*** Configuration summary for nagios 3.3.1 07-25-2011 ***:

检查主机配置文件是还是不是正确:

# CONTACTS

# CONTACTS

 General Options:

/var/www/nagios/bin/nagios -v /var/www/nagios/etc/nagios.cfg

#

#

 ————————-

5.6 Check安装是不是准确:

###############################################################################

###############################################################################

        Nagios executable:  nagios

5.6.1说明:

###############################################################################

###############################################################################

        Nagios user/group:  nagios,nagios

切换目录到安装路线(这里是/usr/local/nagios),看是还是不是留存etc、bin、sbin、share、var
那多少个目录,假如存在则足以注解程序被科学的装置到系统了。Nagios
各种目录用途表明如下:

 

 

      Command user/group:  nagios,nagcmd

bin Nagios 可施行程序所在目录

# Just one contact defined by default – the Nagios admin (that’s you)

# Just one contact defined by default – the Nagios admin (that’s you)

            Embedded Perl:  no

etc Nagios 配置文件所在目录

# This contact definition inherits a lot of default values from the
‘generic-contact’

# This contact definition inherits a lot of default values from the
‘generic-contact’

            Event Broker:  yes

sbin Nagios CGI 文件所在目录,也正是施行外界命令所需文件所在的目录

# template which is defined elsewhere.

# template which is defined elsewhere.

        Install ${prefix}:  /usr/local/nagios

share Nagios网页文件所在的目录

 

 

                Lock file:  ${prefix}/var/nagios.lock

libexec Nagios 外界插件所在目录

define contact{

define contact{

  Check result directory:  ${prefix}/var/spool/checkresults

var Nagios 日志文件、lock 等文件所在的目录

        contact_name                    nagiosadmin            ; Short
name of user

        contact_name                    nagiosadmin            ; Short
name of user

          Init directory:  /etc/rc.d/init.d

var/archives Nagios 日志自动归档目录

        use                            generic-contact        ; Inherit
default values from generic-contact template (defined above)

        use                            generic-contact        ; Inherit
default values from generic-contact template (defined above)

  Apache conf.d directory:  /etc/httpd/conf.d

var/rw 用来寄存外界命令文件的目录

        alias                          Nagios Admin            ; Full
name of user

        alias                          Nagios Admin            ; Full
name of user

            Mail program:  /bin/mail

5.6.2 check
cd /usr/local/nagios
ll

 

 

                  Host OS:  linux-gnu

  1. [root@cache-2 nagios-4.0.6]# cd /usr/local/nagios
  2. [root@cache-2 nagios]# ll
  3. 总用量 24
  4. drwxrwxr-x. 2 nagios nagios 4096 5月 5 15:31 bin
  5. drwxrwxr-x. 3 nagios nagios 4096 5月 5 15:32 etc
  6. drwxrwxr-x. 2 nagios nagios 4096 5月 5 15:31 libexec
  7. drwxrwxr-x. 2 nagios nagios 4096 5月 5 15:31 sbin
  8. drwxrwxr-x. 10 nagios nagios 4096 5月 5 15:31 share
  9. drwxrwxr-x. 5 nagios nagios 4096 5月 5 15:32 var

    [root@cache-2 nagios-4.0.6]# cd /usr/local/nagios
    [root@cache-2 nagios]# ll
    总用量 24
    drwxrwxr-x. 2 nagios nagios 4096 5月 5 15:31 bin
    drwxrwxr-x. 3 nagios nagios 4096 5月 5 15:32 etc
    drwxrwxr-x. 2 nagios nagios 4096 5月 5 15:31 libexec
    drwxrwxr-x. 2 nagios nagios 4096 5月 5 15:31 sbin
    drwxrwxr-x. 10 nagios nagios 4096 5月 5 15:31 share
    drwxrwxr-x. 5 nagios nagios 4096 5月 5 15:32 var

        email                          xiantao412@sina.com      ;
<<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

        email                         
[email protected] 
    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

 

5.7 安装nagios插件
wget

        }

        }

 Web Interface Options:

  1. [root@cache-2 ~]# wget
  2. –2014-05-05 15:52:52–
  3. 正在深入分析主机 nagios-plugins.org… 72.14.186.43
  4. 正在连接 nagios-plugins.org|72.14.186.43|:80… 已三番五次。
  5. 已发出 HTTP 乞请,正在守候回应… 200 OK
  6. ……………………………………..
  7. 2014-05-05 15:53:00 (373 KB/s) – 已保存 “nagios-plugins-2.0.tar.gz”
    [2501847/2501847])
    1. [root@cache-2 ~]# tar -xvf nagios-plugins-2.0.tar.gz
  8. [root@cache-2 ~]# cd nagios-plugins-2.0
  9. [root@cache-2 ~]#./configure –with-nagios-user=nagios –with-nagios-group=nagios
    –prefix=/usr/local/nagios –with-mysql
  10. [root@cache-2 ~]# make && make install

    [root@cache-2 ~]# wget
    –2014-05-05 15:52:52–
    正在剖析主机 nagios-plugins.org… 72.14.186.43
    正在连接 nagios-plugins.org|72.14.186.43|:80… 已连接。
    已产生 HTTP 央浼,正在等待回应… 200 OK
    ……………………………………..
    贰零壹肆-05-05 15:53:00 (373 KB/s) – 已保存 “nagios-plugins-2.0.tar.gz” [2501847/2501847])

    [root@cache-2 ~]# tar -xvf nagios-plugins-2.0.tar.gz
    [root@cache-2 ~]# cd nagios-plugins-2.0
    [root@cache-2 ~]#./configure –with-nagios-user=nagios –with-nagios-group=nagios –prefix=/usr/local/nagios –with-mysql
    [root@cache-2 ~]# make && make install

手续6:安装和配备Nagios的web接口

步骤6:安装和安排Nagios的web接口

 ————————

5.8 安装配备apache和php
(1)安装apache
下载 wget

 到如今截止,大家已经达成了富有的铺排,接下去将用上面包车型客车通令来配置Nagios的web接口。

 到近来截至,大家曾经做到了颇具的铺排,接下去将用上边包车型地铁命令来陈设Nagios的web接口。

                HTML URL: 

  1. [root@cache-2 ~]# wget
  2. –2014-05-05 16:15:48–
  3. 正在条分缕析主机 archive.apache.org… 192.87.106.229, 140.211.11.131,
    2002:610:1:80bc:192:87:106:229
  4. 正在连接 archive.apache.org|192.87.106.229|:80… 已三番两次。
  5. 已发出 HTTP 恳求,正在守候回应… 200 OK
  6. 长度:6747087 (6.4M) [application/x-gzip]
  7. 正值保存至: “httpd-2.4.7.tar.gz”
    1. 1% [=>
      ……………………………………………………..
  8. 2014-05-05 16:16:01 (574 KB/s) – 已保存 “httpd-2.4.7.tar.gz”
    [6747087/6747087])

    [root@cache-2 ~]# wget
    –2014-05-05 16:15:48–
    正在条分缕析主机 archive.apache.org… 192.87.106.229, 140.211.11.131, 二零零四:610:1:80bc:192:87:106:229
    正在连接 archive.apache.org|192.87.106.229|:80… 已三回九转。
    已发生 HTTP 乞请,正在等候回应… 200 OK
    长度:6747087 (6.4M) [application/x-gzip]
    正在保存至: “httpd-2.4.7.tar.gz”

    1% [=> ……………………………………………………..
    2014-05-05 16:16:01 (574 KB/s) – 已保存 “httpd-2.4.7.tar.gz” [6747087/6747087])

 上面包车型客车通令将铺排web接口并同不常间创设多个“nagiosadmin”管理用户。

 上边包车型大巴下令将安顿web接口并同一时间创立一个“nagiosadmin”管理用户。

                  CGI URL: 

始安装:
tar -xvf httpd-2.4.7.tar.gz
cd httpd-2.4.7
./configure –prefix=/usr/local/apache2
make && make install

[root@taoteng nagios-4.0.1]# make install-webconf

[[email protected]
nagios-4.0.1]# make install-webconf

 Traceroute (used by WAP): 

Author

发表评论

电子邮件地址不会被公开。 必填项已用*标注