欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

nagios安装部署

程序员文章站 2022-05-16 20:30:28
...

1.搭建LAMP环境并安装所需要的工具和库

 yum -y install httpd php openssl-devel gcc gcc-c++

2.整合Apache和PHP=lamp

[aaa@qq.com ~]# cat /etc/httpd/conf/httpd.conf | grep -v "^#"|grep -w "DirectoryIndex"
    DirectoryIndex index.php index.html
[aaa@qq.com ~]# cat /etc/httpd/conf/httpd.conf | grep -w "AddType application/x-httpd-php .php"
    AddType application/x-httpd-php .php
[aaa@qq.com ~]# cat /var/www/html/index.php 
<?php
phpinfo();
?>
[aaa@qq.com ~]# systemctl start httpd

nagios安装部署

3.安装nagios

3.1创建组和用户

# groupadd nagios
# useradd -g nagios nagios

3.2解压

 cd nagios-4.2.1/
 ./configure --prefix=/usr/local/nagios
 make all
 make install
 make install-init
 make install-config
 make install-webconf
 make install-commandmode

3.3生成Nagios网页认证文件并创建用户

htpasswd  -c  /usr/local/nagios/etc/htpasswd.users   admin

3.4启动nagios和apache

 service httpd  restart
 service nagios restart

3.5安装Nagios-plugins

tar zxf nagios-plugins-2.1.2.tar.gz 
cd nagios-plugins-2.1.2/
./configure --prefix=/usr/local/nagios
make
make install

nagios安装部署nagios安装部署nagios安装部署
nagios安装部署

添加一个主机

[aaa@qq.com ]# vim /usr/local/nagios/etc/objects/localhost.cfg 

define host{
        use                     linux-server            ; Name of host templat
e to use
                                                        ; This host definition
 will inherit all variables that are defined
                                                        ; in (or inherited by)
 the linux-server host template definition.
        host_name               1708a
        alias                   1708a
        address                 127.0.0.1
        }

nagios安装部署

相关标签: 监控 nagios