nagios编译安装、搭建

基本准备

创新互联专注于涉县企业网站建设,响应式网站设计,商城系统网站开发。涉县网站建设公司,为涉县等地区提供建站服务。全流程按需网站设计,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务

yum -y install httpd php MySQL-devel php-mysql            安装需要的包

groupadd nagcmd                                    创建nagios的管理组

useradd –g nagcmd nagios                            将nagios添加到组nagioscmd内

usermod -a -G nagcmd apache                        将apache加入到组nagcmd内

yum –y install gcc                                    编译安装的需要

安装httpd【apache环境】

[root@zhangpub]# tar zxvf nagios-3.0.6.tar.gz

[root@localhosthttpd-2.2.6]# cd /var/ftp/upload/httpd-2.2.6

[root@localhosthttpd-2.2.6]# ./configure --prefix=/usr/local/apache  

[root@localhosthttpd-2.2.6]# make

[root@localhosthttpd-2.2.6]# make install

[root@localhost httpd-2.2.6]#service httpd start

Starting httpd: httpd: Could notreliably determine the server's fully qualified domain name, usinglocalhost.localdomain for ServerName

(98)Address already in use:make_sock: could not bind to address [::]:80

(98)Address already in use:make_sock: could not bind to address 0.0.0.0:80

no listening sockets available,shutting down

Unable to open logs

                                                         [FAILED]

[root@localhost httpd-2.2.6]#(98)Address already in use: make_sock: could not bind to address [::]:80

-bash: syntax error nearunexpected token `Address'

[root@localhost httpd-2.2.6]#(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

-bash: syntax error nearunexpected token `Address'

启动报错:

[root@localhosthttpd-2.2.6]# netstat -lnp|grep 80

tcp        0     0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      3536/nginx

tcp        0     0 127.0.0.1:631              0.0.0.0:*                   LISTEN      1802/cupsd

tcp        0     0 ::1:631                    :::*                        LISTEN      1802/cupsd

udp        0     0 0.0.0.0:631                0.0.0.0:*                              1802/cupsd

unix  2     [ ACC ]     STREAM     LISTENING     15688 2517/gnome-power-ma /tmp/orbit-root/linc-9d5-0-e7ccb8c8800b

unix  2     [ ACC ]     STREAM     LISTENING     10437 1802/cupsd         /var/run/cups/cups.sock

kill掉进程。

Kill -93536

再次启动httpd服务

[root@localhosthttpd-2.2.6]#service httpd start

安装nagios

#useraddnagios –s /sbin/nologin

#tar zxvfnagios-3.0.6.tar.gz

#cdnagios-3.0.6

./configure--sysconfdir=/etc/nagios --with-commend-group=nagcmd --enable-event-broker

#make all查看安装步骤

有如下内容

*** Compile finished ***

If the main program and CGIscompiled without any errors, you

can continue with installingNagios as follows (type 'make'

without any arguments for a listof all possible options):

make install

    - This installs the main program, CGIs,and HTML files

make install-init

    - This installs the init script in/etc/rc.d/init.d

makeinstall-commandmode

    - This installs and configures permissionson the

      directory for holding the externalcommand file

makeinstall-config

    - This installs *SAMPLE* config files in/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios/etc

      You'll have to modify these sample filesbefore you can

      use Nagios.  Read the HTML documentation for more info

      on doing this.  Pay particular attention to the docs on

      object configuration files, as theydetermine what/how

      things get monitored!

makeinstall-webconf

    - This installs the Apache config file forthe Nagios

      web interface

*** Support Notes*******************************************

编译安装

make all                                            安装主程序、CGI和HTML文件

make install                                        在/etc/rc.d/init.d安装启动脚本

make install-init    把nagios做成一个运行脚本,使nagios随系统开机启动,这是一个很方便的措施。

make install-commendmode                来配置目录权限

make install-config    把配置文件的例子复制到nagios的安装目录

make install-webconf        创建一个nagiosadmin的用户用于nagios的web接口登录

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

Newpassword:

Re-typenew password:

Addingpassword for user nagiosadmin

配置密码。

service httpd restart                                启动apache服务

chkconfig --add nagios  将nagios加入到服务中

chkconfig nagios on  开机启动

servicenagios start

Nagios-plugins安装

[root@localhost upload]# tar zxvf nagios-plugins-1.4.13        解压

[root@localhost upload]# cd nagios-plugins-1.4.13        进入文件夹

[root@localhost nagios-plugins-1.4.13]#./configure--with-nagios-user=nagios --with-nagios-group=nagios                                        执行配置

[root@localhost nagios-plugins-1.4.13]# make            进行编译安装

[root@localhostnagios-plugins-1.4.13]# make install

[root@localhostnagios-plugins-1.4.13]# service nagios restart

关闭selinux

setenforce0

访问nagios

IP/nagios

nagios编译安装、搭建

输入账号密码。

默认已在监控localhost


网站标题:nagios编译安装、搭建
网站地址:http://azwzsj.com/article/pggcsg.html