文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>安装web界面的Nagios配置管理工具Nagiosql3

安装web界面的Nagios配置管理工具Nagiosql3

时间:2010-08-22  来源:marion

1、安装准备

(1)依赖关系
 Webserver,如Apache 1.x或以上版本
 PHP 5或以上版本
 MySQL 4.1或以上版本
 Nagios 2或以上版本
 PEAR Module: HTML_Template_IT 1.1或以上版本
 PHP 扩展模块: gettext,mysql,ftp
 客户端浏览器需要支持JavaScript

(2)准备一个完整的LAMP环境,并使用如下命令需检查PHP5是否开启了Nagiosql3所需要的三个模块:
# php -m | egrep '(^ftp$|^mysql$|^gettext$)'
ftp
gettext
mysql

请把您的执行结果对照上面输出,如果缺少某个扩展模块,请自行使用yum或rpm命令进行安装。如果是编译安装的php,则可能需要重新编译之。

(3)Nagiosql的运行还需要pear(PHP Extension and Application Repository)的支持
# pear install /usr/local/src/HTML_Template_IT-1.2.1.tgz.gz

2、安装Nagiosql3

# unzip nagiosql3.zip
# mv nagiosql3 /var/www/html/nagiosql
# cd /var/www/html/nagiosql

(1)所需文件、目录等创建及权限的设定

创建安装时所需文件
# touch install/ENABLE_INSTALLER

安装过程会为Nagiosql3自动创建配置文件,这需要对配置文件所在目录的写权限:
# chown -R apache config/

安装Nagiosql3以后,Nagios的大部分配置文件(如主机、服务等的定义文件)将由Nagiosql3进行管理,这些文件可以单独存放于由Nagiosql3管理的目录。这些目录需要手动创建,位置可以根据需要指定,这里采用Nagiosql3默认的位置/etc/nagiosql。

/etc/nagiosql/--|                           <--普通配置文件
                |---/hosts            <--主机配置文件
                |---/services               <--服务配置文件
                |---/backup/--|             <--普通配置文件的备份目录
                |             |--/hosts     <--主机配置文件备份目录
                |             |--/services  <--服务配置文件备份目录
                |---/import                 <--用来存放即将导入Nagiosql的旧的或样例配置文件
                        
# mkdir -pv /etc/nagiosql/{hosts,services,backup/{,hosts,services},import}
# chown -R apache.nagios /etc/nagiosql/
# chmod -R 6755 /etc/nagiosql

(2)Nagios相关文件权限的设定

设定Nagios相关配置文件的权限,以使其能够通过Web程序进行管理。
# chgrp apache /usr/local/nagios/etc
# chgrp apache /usr/local/nagios/etc/{nagios.cfg,cgi.cfg}
# chmod 775 /usr/local/nagios/etc
# chmod 664 /usr/local/nagios/etc/{nagios.cfg,cgi.cfg}

设定nagios二进制文件的权限,以便其能够通过Web程序执行。
# chown nagios.apache /usr/local/nagios/bin/nagios
# chmod 750 /usr/local/nagios/bin/nagios
# chown nagios.apache /usr/local/nagios/var/rw/nagios.cmd
# chmod 660 /usr/local/nagios/var/rw/nagios.cmd

# chown -R apache.nagios /usr/local/nagios/var/spool/
# chmod 775

(3)Nagios主配置文件的设定

编辑Nagios的主配置文件/usr/local/nagios/nagios.cfg,重新设定关于主机、服务、主机组、联系人等定义的配置文件位置为/etc/nagiosql中。

# vi /usr/local/nagios/nagios.cfg

注释以下原有项:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

说明:如果您已经开启了其它有关主机、服务等定义的配置文件项,您可以将此些配置文件移至/etc/nagiosql目录(移到此目录后需重新定义文件权限),而后重新指定路径,这样可以方便通过Nagiosql进行管理。例如, /etc/nagiosql目录中有复制来的配置文件,此时则可以使用如下命令对其进行修改:
# chown apache.nagios /etc/nagiosql/*.cfg
# chmod 664 /etc/nagiosql/*.cfg

然后在nagios.cfg中添加如下项(请注意路径):
cfg_file=/etc/nagiosql/commands.cfg
cfg_file=/etc/nagiosql/contacts.cfg
cfg_file=/etc/nagiosql/timeperiods.cfg
cfg_file=/etc/nagiosql/contactgroups.cfg

cfg_file=/etc/nagiosql/hostgroups.cfg
cfg_file=/etc/nagiosql/servicegroups.cfg
cfg_dir=/etc/nagiosql/hosts
cfg_dir=/etc/nagiosql/services

以下为可选的添加进nagios.cfg中选项:
cfg_file=/etc/nagiosql/hosttemplates.cfg  
cfg_file=/etc/nagiosql/servicetemplates.cfg  
cfg_file=/etc/nagiosql/servicedependencies.cfg  
cfg_file=/etc/nagiosql/serviceescalations.cfg  
cfg_file=/etc/nagiosql/hostdependencies.cfg  
cfg_file=/etc/nagiosql/hostescalations.cfg  
cfg_file=/etc/nagiosql/hostextinfo.cfg  
cfg_file=/etc/nagiosql/serviceextinfo.cfg

(4)安装、设定Nagiosql3

在浏览器中输入 http://your_IP/nagiosql 即可进入Nagiosql3的安装界面了。
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载