温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

centos6安装nagios4.3.1

发布时间:2020-05-20 23:54:57 来源:网络 阅读:1306 作者:linyangjun123 栏目:移动开发

nagios  配置安装


下载准备nagios core 安装包:https://www.nagios.org/downloads/nagios-core/

下载nagios   插件:https://www.nagios.org/downloads/nagios-plugins/


Nagios 基本组件的运行依赖于httpd   cgg  和 gd 可以通过以下命令来检查nagios所依赖的rpm 包是否已经完全安装

#yum -y install httpd gcc glibc glibc-common gd gd-devel php php-mysql mysql mysql-devel mysql-server


说明:以上软件包您也可以通过编译源代码的方式安装,只是后面许多要用到的相关文件的路径等需要按照您的源代码安装时的配置逐一修改,此外还需要按需启动必要的服务,入httpd等


2.添加nagios 运行所需的用户和组


#groupadd nagcmd

#useradd -G nagcmd nagios


#usermod -a -G nagcmd apache


# passwd nagios

centos6安装nagios4.3.1



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

#usermod -a -G nagcmd apache


编译安装nagios

#tar zxf nagios-4.3.1.tar.gz

#cd nagios-4.3.1

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

#make  all

#make install

#make install-init

#make install-commandmode

#make install-config


centos6安装nagios4.3.1

centos6安装nagios4.3.1




注:{为emall指定想用来接收nagios警告信息的邮件地址,默认是本机的nagios用户

#vi /usr/local/nagios/etc/objects/contacts.cfg

email   nagios@localhost   #这个是默认设置}


在httpd的配置文件目录(conf.d)中创建nagios的web程序配置文件

# make install-webconf


centos6安装nagios4.3.1

nagios 页面不能够随便访问,必须使用用户登录之后才能够正常访问,配置访问密码

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

用户名:nagiosadmin    密码ganten2008


centos6安装nagios4.3.1



注:在/etc/httpd/conf.d 下使用  less nagios.conf   可查看读取httpd读取nagios文件位置信息

centos6安装nagios4.3.1

把nagios 加入启动脚本并启动服务

#chkconfig --add nagios

#chkconfig nagios on

#service nagios start

centos6安装nagios4.3.1

安装nagios插件

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

#cd nagios-plugins-2.2.1

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

centos6安装nagios4.3.1


 注:如果需要监控mysql服务器,需要加上--with-mysql=

#make

#make install

centos6安装nagios4.3.1

重启nagios 

#service nagios restart


关闭selinux   

vim /etc/sysconfig/selinux    将SELINUX=enforcing改为SELINUX=disabled  重启机器生效

 注:临时更改可以使用 setenforce 0     使用getenforce可查看状态     Enforcing为执行    Permissive为关闭

 注:也可以使用以下方式将nagios 的CGI程序运行于SEliux/targeted 模式而不用关闭selinux

  # chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin

  # chcon -R -t httpd_sys_content_t /usr/local/nagios/share

  

  

通过web界面查看nagios:

关闭防火墙或者放通防火墙 service iptables stop

http://your_nagios_IP/angios

    

输入用户名:nagiosadmin    密码ganten2008


centos6安装nagios4.3.1



到这里,nagios服务器端已经安装完成,接下来需要配置被监控端,才能进行对其他机器的监控!





向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI