【Nagios】web管理工具nagiosql安装

Nagios WEB管理工具NagiosQL

下载地址:http://sourceforge.net/projects/nagiosql/files/nagiosql/

[root@localhost src]# pwd

/usr/local/src

[root@localhost src]# wget http://sourceforge.net/projects/nagiosql/files/nagiosql/NagiosQL%203.1.1/nagiosql_311.tar.gz/download

[root@localhost src]# tar zxvf nagiosql_311.tar.gz

[root@localhost src]# mv nagiosql /usr/local/nagios/

建立nagiosQL导出nagios配置文件的目录,并修改权限

建目录和改权限

[root@localhost src]# mkdir -p /etc/nagiosql/{hosts,services,backup/{,hosts,services},import}

[root@localhost src]# chown -R apache:nagios /etc/nagiosql/

[root@localhost src]# chmod -R 755 /etc/nagiosql

[root@localhost src]# chmod 777 /usr/local/nagios/nagiosql/config

Nagios相关文件权限的设定

[root@localhost src]# chown nagios:apache /usr/local/nagios/etc

[root@localhost src]# chown nagios:apache /usr/local/nagios/etc/{nagios.cfg,cgi.cfg}

[root@localhost src]# chown nagios:apache /usr/local/nagios/etc/*

[root@localhost src]# chmod 664 /usr/local/nagios/etc/{nagios.cfg,cgi.cfg}

[root@localhost src]# chmod 775 /usr/local/nagios/etc

设定nagios二进制文件的权限,以便其能够通过Web程序执行

[root@localhost src]# chown nagios:apache /usr/local/nagios/bin/nagios

[root@localhost src]# chmod 750 /usr/local/nagios/bin/nagios

[root@localhost src]# chown -R apache.nagios /usr/local/nagios/var/spool/

[root@localhost src]# chown nagios:apache /usr/local/nagios/var/rw/nagios.cmd

[root@localhost src]# chmod 660 /usr/local/nagios/var/rw/nagios.cmd

为apache添加nagiosQL虚拟目录

[root@localhost src]# vim /etc/httpd/conf.d/nagios.conf

在文件末尾添加如下:

#add virture directory for nagiosql
Alias /nagiosql "/usr/local/nagios/nagiosql"

<Directory "/usr/local/nagios/nagiosql">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

重新加载httpd服务和启动mysqld服务

[root@localhost src]# service httpd reload

[root@localhost src]# service mysqld restart

建立nagiosql安装文件

[root@localhost src]# touch /usr/local/nagios/nagiosql/install/ENABLE_INSTALLER

访问http://serverIP/nagiosql进行安装

tips:如果访问时候无法访问或者提示无权限,开启80端口、修改SELinux的实时运行模式

删除安装目录,这里使用改权限:chmod 000 /usr/local/nagios/nagiosql/install

[root@localhost src]# chmod 000 /usr/local/nagios/nagiosql/install

按如图所示更改相应的路径即可

工具-导入数据 右边会列出一些配置文件,全选择导入即可


工具-nagios控制-写入检测数据-写入其他数据

写入之后就可以看到相应的cfg文件了,查看写入是否成功,由下面的输出可以看出写入是成功滴


修改nagios的配置文件,将原有以cfg_file开头项全部注释掉,加入上面新写入的配置文件

[root@localhost src]# cp /usr/local/nagios/etc/nagios.cfg /usr/local/nagios/etc/nagios.cfgbak

[root@localhost src]# vim /usr/local/nagios/etc/nagios.cfg

注释掉

加入以下

cfg_dir=/etc/nagiosql/hosts/
cfg_dir=/etc/nagiosql/services/
cfg_file=/etc/nagiosql/commands.cfg
cfg_file=/etc/nagiosql/contactgroups.cfg
cfg_file=/etc/nagiosql/contacts.cfg
cfg_file=/etc/nagiosql/contacttemplates.cfg
cfg_file=/etc/nagiosql/hostdependencies.cfg
cfg_file=/etc/nagiosql/hostescalations.cfg
cfg_file=/etc/nagiosql/hostextinfo.cfg
cfg_file=/etc/nagiosql/hostgroups.cfg
cfg_file=/etc/nagiosql/hosttemplates.cfg
cfg_file=/etc/nagiosql/servicedependencies.cfg
cfg_file=/etc/nagiosql/serviceescalations.cfg
cfg_file=/etc/nagiosql/serviceextinfo.cfg
cfg_file=/etc/nagiosql/servicegroups.cfg
cfg_file=/etc/nagiosql/servicetemplates.cfg
cfg_file=/etc/nagiosql/timeperiods.cfg

检查nagios的配置文件是否有问题,然后生重启nagios服务,

你可能感兴趣的:(nagios)