Nagios安装配置与登录

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

下载Nagios程序和Nagios插件

[root@server ~]#wget

[root@server ~]#

wget

2、添加Nagios用户和组  

[root@server ~]#useradd nagios

[root@server ~]#groupadd nagcmd

[root@server ~]#usermod -a -G nagcmd nagios

3、Nagios 安装

[root@server ~]#tar zxvf nagios-3.4.1.tar.gz

[root@server ~]#cd nagios

[root@server nagios]#./configure --with-command-group=nagcmd

[root@server nagios]#make all

[root@server nagios]#make install

[root@server nagios]#make install-init

[root@server nagios]#make install-config

[root@server nagios]#make install-commandmode

[root@server nagios]#make install-webconf

复制nagios/contrib/eventhandlers目录下所有文件到/usr/local/nagios/libexec下:

[root@server nagios]#cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/

修改用户和主权限

[root@server nagios]#chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

[root@server nagios]# ll /usr/local/nagios/libexec/eventhandlers/

总用量 28

-rwxr-xr-x. 1 nagios nagios  828 9月  27 11:33 disable_active_service_checks

-rwxr-xr-x. 1 nagios nagios  759 9月  27 11:33 disable_notifications

drwxr-xr-x. 2 nagios nagios 4096 9月  27 11:33 distributed-monitoring

-rwxr-xr-x. 1 nagios nagios  827 9月  27 11:33 enable_active_service_checks

-rwxr-xr-x. 1 nagios nagios  760 9月  27 11:33 enable_notifications

drwxr-xr-x. 2 nagios nagios 4096 9月  27 11:33 redundancy-scenario1

-rwxr-xr-x. 1 nagios nagios 1184 9月  27 11:33 submit_check_result

校验Nagios配置文件,验证配置是否有误

[root@server nagios]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

重启nagios、httpd

[root@server nagios]#/etc/init.d/nagios start

[root@server nagios]#/etc/init.d/httpd start

修改配置文件

[root@server nagios]#vim /usr/local/nagios/etc/objects/contacts.cfg

修改nagiosadmin(这里修改为你自己创建的帐号) 注:nagiosadmin是配置文件默认,可以不用修改。

创建一个默认用户登录Web界面访问: 创建HTTP认证用户登录Nagios,用户名nagiosadmin,密码123456

[root@server nagios]#htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin

4、Nagios插件安装

[root@server ~]#tar zxvf nagios-plugins-1.4.15.tar.gz

[root@server ~]#cd /nagios-plugins-1.4.15

[root@server nagios-plugins-1.4.16]#./configure --with-nagios-user=nagios --with-nagios-group=nagios

[root@server nagios-plugins-1.4.16]#make

[root@server nagios-plugins-1.4.16]#make install

5、Nagios服务设置

以下命令将寄存器Nagios守护进程运行在系统启动。

[root@server ~]#chkconfig --add nagios

[root@server ~]#chkconfig --add httpd

[root@server ~]#chkconfig nagios on

[root@server ~]#chkconfig httpd on

6、登录到WEB界面

输入用户名密码:nagiosadmin  123456

7、FQA

如果WEB无法访问,检查一下IPtables是否关闭。

[root@server ~]# service iptables status

iptables:未运行防火墙。      注:未运行防火墙,表示已经关闭。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3bc9718131c1a037c70a7402702b11d9.html