码迷,mamicode.com
首页 > 移动开发 > 详细

web配置nagios工具

时间:2014-11-20 18:26:43      阅读:389      评论:0      收藏:0      [点我收藏+]

标签:des   http   io   ar   os   使用   sp   java   for   

Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员,在状态恢复后发出正常的邮件或短信通知。

 

 

Nagiosql 安装的配置方法(一个web配置nagios的工具)  

 

 

 

 

 

NagiosQL 本人已经在使用中,它本身的导入功能非常强大,不用自己去处理以前的nagios配置文件,它会自己就处理出来,每台主机hosts是一个配 置,services都在一个配置文件里,一开始用起来不是很习惯,但是当你发现了他的好处你就会爱上他的,那么现在就跟我一起探索nagiosql的神 秘之旅吧。

 

bubuko.com,布布扣

 

官网网站  http://www.nagiosql.org/

nagiosql是一个web配置nagios的工具,可以用web页面里添加主机、服务、主机组、服务组、命令、通知组。。。。。等等首先我们在已经安装好apache、php、nagios目录位置如下:apache /home/nagios/httpd
php /home/nagios/php
nagios /home/nagios/nagios先按nagiosql官方的需求说明:
Requirements
Webserver e.g. Apache 1.x or above
PHP 4.3 or above
MySQL 4.1 or above
Nagios 2 or above
PEAR Module: HTML_Template_IT 1.1 or above
PHP Extension: gettext –with-gettext使用这个参数启用
PHP Extension: mysql –with-mysql使用这个参数启用
PHP Extension: ftp –enable-ftp使用这个参数启用
Javascript enabled at your Webbrowser
1、 注意在编译php时候要将gettext、mysql、ftp三个扩展启用。2、安装pear模块方法如下:[nagios@test-22 ~]$ /home/nagios/php/bin/pear install HTML_Template_IT3、下载nagiosql并解压到htdocs目录中,下载地址如下http://www.nagiosql.org /download.html4、创建nagiosql的配置文件目录[nagios@test-22 ~]$ mkdir /home/nagios/nagiosql; \
mkdir /home/nagios/nagiosql/hosts; \
mkdir /home/nagios/nagiosql/services; \
mkdir /home/nagios/nagiosql/backup; \
mkdir /home/nagios/nagiosql/backup/hosts; \
mkdir /home/nagios/nagiosql/backup/services; \
mkdir /home/nagios/nagiosql/import5、先使用旧的配置文件,/home/nagios/nagios/etc /nagios.cfg文件配置文件使用原来的。(hosts和services配置同以前手动配置相 同)################################################################
cfg_file=/home/nagios/nagios/etc/objects/commands.cfg
cfg_file=/home/nagios/nagios/etc/objects/contacts.cfg
cfg_file=/home/nagios/nagios/etc/objects/timeperiods.cfg
cfg_file=/home/nagios/nagios/etc/objects/templates.cfg
################################################################
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_services.cfg
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hosts.cfg
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hostgroup.cfg
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_servicegroup.cfg
################################################################6、 将nagiosql解压到htdocs目录中[nagios@test-22 ~]$ cd /home/nagios/httpd/htdocs
[nagios@test-22 htdocs]$ rm -rf nagiosql3
[nagios@test-22 htdocs]$ unzip ~/pkgs/nagiosql303.zip
7、在nagiosql的install目录中touch一个ENABLE_INSTALLER文件(该文件启用安装向导)
[nagios@test-22 htdocs]$ cd nagiosql3/install/
[nagios@test-22 install]$ touch ENABLE_INSTALLER8、选择语言
在出现的向导页面中的Setup Language项选择Chinese(Simplified)》点击开始新安装9、安装检查
向导会自动检查php环境和系统权限。都通过就》点击下一步
10、系统设置部分(按下面的格式填入配置,然后》点击下一步)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySQL服务器 127.0.0.1
MySQL服务器端口 3306
数据库名 db_nagiosql_v3
NagiosQL数据库用户 nagiosql_user
NagiosQL数据库密码 nagiosql_pass
如果数据库存在是否删除? (如果是第一次安装不需要打勾)
Mysql管理用户 root
MySQL管理密码 root
初始Nagios登录 admin
初始NagiosQL密码 admin
请重复输入密码 admin
Nagios参考配置文件
导入Nagios参考配置 (如果是新手,可以导入进行学习)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++11、 提示安装完成NagiosQL Installation: 完成安装12、删除ENABLE_INSTALLER后》点击完成
[nagios@test-22 install]$ rm /home/nagios/httpd/htdocs/nagiosql3/install/ENABLE_INSTALLER
13、 导入现有nagios的配置文件到nagiosql配置文件中访问http://192.168.4.131:8080/nagiosql3 /index.php访问你安装好的nagiosql14、配置nagios和nagiosql的关联(配置路径)点击管理》域》点击右边的 localhost进行修改
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++域* localhost
描述* Local installation
服务器名* localhost
方法 Fileaccess配置目录
基目录* /home/nagios/nagiosql
主机目录* /home/nagios/nagiosql/hosts/
服务目录* /home/nagios/nagiosql/services/
备份目录* /home/nagios/nagiosql/backup/
主机备份目录* /home/nagios/nagiosql/backup/hosts/
服务备份目录* /home/nagios/nagiosql/backup/services/
Nagios基目录* /home/nagios/nagios/etc
导入路径 /home/nagios/nagiosql/import/Nagios命令文件 /home/nagios/nagios/var/rw/nagios.cmd
Nagios执行文件 /home/nagios/nagios/bin/nagios
Nagios 进程文件 /home/nagios/nagios/var /nagios.lock++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 完成上面的填入后》点击完成。15、导入Nagios配置到nagiosql中点击工具》导入数据》按住Crtl后多先以下这些文件》点击导入。
commands.cfg gzmachine_hostgroup.cfg gzmachine_servicegroup.cfg templates.cfg
contacts.cfg gzmachine_hosts.cfg gzmachine_services.cfg timeperiods.cfg16、为nagiosql添加好权限
[nagios@test-22 ~]$ chown -R nagios.nagios /home/nagios/nagiosql
[nagios@test-22 ~]$ chmod -R 775 /home/nagios/nagiosql
17、写入nagiosql配置文件17.1、写入检测数据(会根据所导入的数据生成hosts、hostgroup、services、servicegroup之类文件)点击工具》Nagios控制》写入检测数据》提交
此时会在/home/nagios/nagiosql目录中生成如下文件
hostgroups.cfg
hosttemplates.cfg
servicegroups.cfg
servicetemplates.cfg
在/home/nagios/nagiosql/hosts目录生成对应已有主机台数数量的主机配置文件
在/home/nagios/nagiosql/services目录中生成services的文件
17.2、写入其他数据(会根据所导入的数据生成command、timeperiods.cfg、contacts.cfg 等文件)点击工具》Nagios控制》写入其它数据》提交此时会在/home/nagios/nagiosql目录中生成如下文件
commands.cfg
contacts.cfg
timeperiods.cfg
servicetemplates.cfg
.
.
.
.18、关闭nagios配置文件,应用nagiosql配置文件
[nagios@test-22 ~]$ vim /home/nagios/nagios/etc/nagios.cfg将以下项注释掉(nagios原来的配置文件,因为已经导入到nagiosql配 置中,所以需要关 闭)################################################################
#cfg_file=/home/nagios/nagios/etc/objects/commands.cfg
#cfg_file=/home/nagios/nagios/etc/objects/contacts.cfg
#cfg_file=/home/nagios/nagios/etc/objects/timeperiods.cfg
#cfg_file=/home/nagios/nagios/etc/objects/templates.cfg
################################################################
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_services.cfg
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hosts.cfg
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hostgroup.cfg
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_servicegroup.cfg
################################################################将以下项打开(naigosql配置文件,用于替代nagios的配置文件)
################################################################
cfg_dir=/home/nagios/nagiosql/hosts/
cfg_dir=/home/nagios/nagiosql/services/

cfg_file=/home/nagios/nagiosql/commands.cfg
cfg_file=/home/nagios/nagiosql/contactgroups.cfg
cfg_file=/home/nagios/nagiosql/contacts.cfg
cfg_file=/home/nagios/nagiosql/contacttemplates.cfg
cfg_file=/home/nagios/nagiosql/hostdependencies.cfg
cfg_file=/home/nagios/nagiosql/hostescalations.cfg
cfg_file=/home/nagios/nagiosql/hostextinfo.cfg
cfg_file=/home/nagios/nagiosql/hostgroups.cfg
cfg_file=/home/nagios/nagiosql/hosttemplates.cfg
cfg_file=/home/nagios/nagiosql/servicedependencies.cfg
cfg_file=/home/nagios/nagiosql/serviceescalations.cfg
cfg_file=/home/nagios/nagiosql/serviceextinfo.cfg
cfg_file=/home/nagios/nagiosql/servicegroups.cfg
cfg_file=/home/nagios/nagiosql/servicetemplates.cfg
cfg_file=/home/nagios/nagiosql/timeperiods.cfg
################################################################

19、登入nagiosql的web界面,http://IP>/ nagiosQL,就可以添加主机和服务了。下面我们试着添加一台主机:19.1、上图了

 

保存后》写入配置》管理》工具》Nagios控制》写入检测数据》提交》重新启动Nagios》提交
我们添加的主机就出现了

--------------------------------------

 

nagiosql是一个web配置nagios的工具,可以用web页面里添加主机、服务、主机组、服务组、命令、通知组。。。。。等等

首先我们在已经安装好apache、php、nagios目录位置如下:

apache    /home/nagios/httpd
php       /home/nagios/php
nagios    /home/nagios/nagios

先按nagiosql官方的需求说明:

Requirements

  •   Webserver e.g. Apache 1.x or above

  •   PHP 4.3 or above

  •   MySQL 4.1 or above

  •   Nagios 2 or above

  •   PEAR Module: HTML_Template_IT 1.1 or above

  •   PHP Extension: gettext --with-gettext使用这个参数启用

  •   PHP Extension: mysql --with-mysql使用这个参数启用

  •   PHP Extension: ftp --enable-ftp使用这个参数启用

  •   Javascript enabled at your Webbrowser

1、注意在编译php时候要将gettext、mysql、ftp三个扩展启用。

2、安装pear模块方法如下:

[nagios@test-22 ~]$ /home/nagios/php/bin/pear install HTML_Template_IT

3、下载nagiosql并解压到htdocs目录中,下载地址如下

http://www.nagiosql.org/download.html

4、创建nagiosql的配置文件目录

[nagios@test-22 ~]$ mkdir /home/nagios/nagiosql; \
mkdir /home/nagios/nagiosql/hosts; \
mkdir /home/nagios/nagiosql/services; \
mkdir /home/nagios/nagiosql/backup; \
mkdir /home/nagios/nagiosql/backup/hosts; \
mkdir /home/nagios/nagiosql/backup/services; \
mkdir /home/nagios/nagiosql/import

5、先使用旧的配置文件,/home/nagios/nagios/etc/nagios.cfg文件配置文件使用原来的。(hosts和services配置同以前手动配置相同)

################################################################
cfg_file=/home/nagios/nagios/etc/objects/commands.cfg
cfg_file=/home/nagios/nagios/etc/objects/contacts.cfg
cfg_file=/home/nagios/nagios/etc/objects/timeperiods.cfg
cfg_file=/home/nagios/nagios/etc/objects/templates.cfg
################################################################
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_services.cfg
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hosts.cfg
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hostgroup.cfg
cfg_file=/home/nagios/nagios/etc/objects/gzmachine_servicegroup.cfg
################################################################

6、将nagiosql解压到htdocs目录中

[nagios@test-22 ~]$ cd /home/nagios/httpd/htdocs
[nagios@test-22 htdocs]$ rm -rf nagiosql3
[nagios@test-22 htdocs]$ unzip ~/pkgs/nagiosql303.zip
7、在nagiosql的install目录中touch一个ENABLE_INSTALLER文件(该文件启用安装向导)
[nagios@test-22 htdocs]$ cd nagiosql3/install/
[nagios@test-22 install]$ touch ENABLE_INSTALLER

8、选择语言
在出现的向导页面中的Setup Language项选择Chinese(Simplified)》点击开始新安装

9、安装检查
向导会自动检查php环境和系统权限。都通过就》点击下一步
10、系统设置部分(按下面的格式填入配置,然后》点击下一步)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MySQL服务器                    127.0.0.1
MySQL服务器端口                3306
数据库名                       db_nagiosql_v3
NagiosQL数据库用户             nagiosql_user
NagiosQL数据库密码             nagiosql_pass
如果数据库存在是否删除?       (如果是第一次安装不需要打勾)
Mysql管理用户                  root
MySQL管理密码                  root

初始Nagios登录             admin
初始NagiosQL密码               admin
请重复输入密码                 admin

Nagios参考配置文件
导入Nagios参考配置             (如果是新手,可以导入进行学习)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

11、提示安装完成

NagiosQL Installation: 完成安装

12、删除ENABLE_INSTALLER后》点击完成
[nagios@test-22 install]$ rm /home/nagios/httpd/htdocs/nagiosql3/install/ENABLE_INSTALLER


13、导入现有nagios的配置文件到nagiosql配置文件中

访问http://192.168.4.131:8080/nagiosql3/index.php访问你安装好的nagiosql

14、配置nagios和nagiosql的关联(配置路径)

点击管理》域》点击右边的localhost进行修改
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

域*                        localhost
描述*                      Local installation
服务器名*                  localhost
方法                       Fileaccess

配置目录
基目录*                    /home/nagios/nagiosql
主机目录*                  /home/nagios/nagiosql/hosts/
服务目录*                  /home/nagios/nagiosql/services/
备份目录*                  /home/nagios/nagiosql/backup/
主机备份目录*              /home/nagios/nagiosql/backup/hosts/
服务备份目录*              /home/nagios/nagiosql/backup/services/
Nagios基目录*              /home/nagios/nagios/etc
导入路径                   /home/nagios/nagiosql/import/

Nagios命令文件             /home/nagios/nagios/var/rw/nagios.cmd
Nagios执行文件             /home/nagios/nagios/bin/nagios
Nagios进程文件             /home/nagios/nagios/var/nagios.lock

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

完成上面的填入后》点击完成。

15、导入Nagios配置到nagiosql中

点击工具》导入数据》按住Crtl后多先以下这些文件》点击导入。
commands.cfg  gzmachine_hostgroup.cfg  gzmachine_servicegroup.cfg  templates.cfg
contacts.cfg  gzmachine_hosts.cfg      gzmachine_services.cfg      timeperiods.cfg

16、为nagiosql添加好权限
[nagios@test-22 ~]$ chown -R nagios.nagios /home/nagios/nagiosql
[nagios@test-22 ~]$ chmod -R 775 /home/nagios/nagiosql


17、写入nagiosql配置文件

17.1、写入检测数据(会根据所导入的数据生成hosts、hostgroup、services、servicegroup之类文件)

点击工具》Nagios控制》写入检测数据》提交
此时会在/home/nagios/nagiosql目录中生成如下文件
hostgroups.cfg
hosttemplates.cfg
servicegroups.cfg
servicetemplates.cfg
在/home/nagios/nagiosql/hosts目录生成对应已有主机台数数量的主机配置文件
在/home/nagios/nagiosql/services目录中生成services的文件
17.2、写入其他数据(会根据所导入的数据生成command、timeperiods.cfg、contacts.cfg 等文件)

点击工具》Nagios控制》写入其它数据》提交

此时会在/home/nagios/nagiosql目录中生成如下文件
commands.cfg
contacts.cfg
timeperiods.cfg
servicetemplates.cfg
.
.
.
.

18、关闭nagios配置文件,应用nagiosql配置文件
[nagios@test-22 ~]$ vim /home/nagios/nagios/etc/nagios.cfg

将以下项注释掉(nagios原来的配置文件,因为已经导入到nagiosql配置中,所以需要关闭)

################################################################
#cfg_file=/home/nagios/nagios/etc/objects/commands.cfg
#cfg_file=/home/nagios/nagios/etc/objects/contacts.cfg
#cfg_file=/home/nagios/nagios/etc/objects/timeperiods.cfg
#cfg_file=/home/nagios/nagios/etc/objects/templates.cfg
################################################################
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_services.cfg
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hosts.cfg
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_hostgroup.cfg
#cfg_file=/home/nagios/nagios/etc/objects/gzmachine_servicegroup.cfg
################################################################

将以下项打开(naigosql配置文件,用于替代nagios的配置文件)
################################################################
cfg_dir=/home/nagios/nagiosql/hosts/
cfg_dir=/home/nagios/nagiosql/services/
 
cfg_file=/home/nagios/nagiosql/commands.cfg
cfg_file=/home/nagios/nagiosql/contactgroups.cfg
cfg_file=/home/nagios/nagiosql/contacts.cfg
cfg_file=/home/nagios/nagiosql/contacttemplates.cfg
cfg_file=/home/nagios/nagiosql/hostdependencies.cfg
cfg_file=/home/nagios/nagiosql/hostescalations.cfg
cfg_file=/home/nagios/nagiosql/hostextinfo.cfg
cfg_file=/home/nagios/nagiosql/hostgroups.cfg
cfg_file=/home/nagios/nagiosql/hosttemplates.cfg
cfg_file=/home/nagios/nagiosql/servicedependencies.cfg
cfg_file=/home/nagios/nagiosql/serviceescalations.cfg
cfg_file=/home/nagios/nagiosql/serviceextinfo.cfg
cfg_file=/home/nagios/nagiosql/servicegroups.cfg
cfg_file=/home/nagios/nagiosql/servicetemplates.cfg
cfg_file=/home/nagios/nagiosql/timeperiods.cfg
################################################################

19、登入nagiosql的web界面,就可以添加主机和服务了。

下面我们试着添加一台主机:

19.1、点击管理》监督》主机》添加

bubuko.com,布布扣

保存后》写入配置》管理》工具》Nagios控制》写入检测数据》提交》重新启动Nagios》提交
我们添加的主机就出现了。。。。哈哈

 

 

通过nagiosQL管理nagios非常方便,简单

 

1.环境: 
ubuntu         9.04 x86_64 
nagios        3.2.1 
nagios-plugins    1.4.14 
lighttpd    1.4.19

 

2.下载地址 
http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz 
http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz

 

web admins 
http://downloads.sourceforge.net/project/nagiosql/nagiosql/NagiosQL%203.0.3/nagiosql303.zip?use_mirror=nchc

 

3.安装依赖包 
apt-get install  build-essential lighttpd php5-cgi php5-cli php5-curl php5-gd php5-mysql php-html-template-it unzip

 

 

4.添加相关用户 

useradd nagios passwd nagios usermod -G nagios nagios groupadd nagcmd usermod -G nagcmd nagios usermod -G nagcmd www-data

 

 

5.编译安装Nagios

tar xvzf nagios-3.2.1.tar.gz

./configure –with-command-group=nagcmd

make all

make install

make install-init

make install-config

make install-commandmode

cp sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf

 

 

6.编译安装Nagios插件

tar xvzf nagios-plugins-1.4.14.tar.gz

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

make

make install

 

 

7.验证Nagios配置文件,启动

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

/etc/init.d/nagios start

 

 

8.lighttpd配置

生成auth key

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin  #回车后输入2次密码

启用php fastcgi

lighty-enable-mod fastcgi

修改Lighttpd主配置文件,添加nagios支持

vi /etc/lighttpd/lighttpd.conf

server.modules              = (

            "mod_access",

            "mod_alias",

            "mod_cgi",

            "mod_setenv",

            "mod_auth",

            "mod_compress"

)

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".cgi" )

alias.url += (

        "/nagios/cgi-bin" => "/usr/local/nagios/sbin",

        "/nagios"       =>      "/usr/local/nagios/share/"

        )

$HTTP["url"] =~ "^/nagios/cgi-bin" {

        cgi.assign = ( "" => "" )

}

$HTTP["url"] =~ "^/nagios" {

        auth.backend = "htpasswd"

        auth.backend.htpasswd.userfile = "/usr/local/nagios/etc/htpasswd.users"

        auth.require = ( "" => (

                "method" => "basic",

                "realm" => "nagios",

                "require" => "user=nagiosadmin"

                )

        )

        setenv.add-environment = ( "REMOTE_USER" => "user" )

}

 

 

9.安装配置nagiosql

unzip nagiosql303.zip

mv nagiosql3 /www/web/nagadmin

chown -R www-data:www-data /www/web/nagadmin/

cd /www/web/nagadmin/install

touch ENABLE_INSTALLER

http://gaojinbo.com/nagadmin  安装sample数据

lighttpd.conf

alias添加一行,修改为:

alias.url += (

        "/nagios/cgi-bin" => "/usr/local/nagios/sbin",

        "/nagios"       =>      "/usr/local/nagios/share/",

        "/nagadmin"             =>      "/www/web/nagadmin"

        )

 

 

10.通过web访问配置nagios

http://gaojinbo.com/nagadmin

建立文件夹

mkdir -p /etc/nagiosql/backup/hosts

mkdir -p /etc/nagiosql/backup/services

mkdir -p /etc/nagiosql/hosts

mkdir -p /etc/nagiosql/services

mkdir /etc/nagios

mkdir /etc/nagios/import

touch /etc/nagios/nagios.cfg

touch /etc/nagios/cgi.cfg

Permissions权限设置

chgrp www-data /etc/nagios

chgrp www-data /etc/nagios/nagios.cfg

chgrp www-data /etc/nagios/cgi.cfg

chmod 775 /etc/nagios

chmod 664 /etc/nagios/nagios.cfg

chmod 664 /etc/nagios/cgi.cfg

chgrp www-data /usr/local/nagios/etc/nagios.cfg

chgrp www-data /usr/local/nagios/etc/cgi.cfg

chmod 664 /usr/local/nagios/etc/nagios.cfg

chmod 664 /usr/local/nagios/etc/cgi.cfg

chmod 6755 /etc/nagiosql

chown www-data.nagios /etc/nagiosql

chmod 6755 /etc/nagiosql/hosts

chown www-data.nagios /etc/nagiosql/hosts

chmod 6755 /etc/nagiosql/services

chown www-data.nagios /etc/nagiosql/services   
chmod 6755 /etc/nagiosql/backup

chown www-data.nagios /etc/nagiosql/backup

chmod 6755 /etc/nagiosql/backup/hosts

chown www-data.nagios /etc/nagiosql/backup/hosts

chmod 6755 /etc/nagiosql/backup/services

chown www-data.nagios /etc/nagiosql/backup/services

chmod 644 /etc/nagiosql/*.cfg

chown www-data.nagios /etc/nagiosql/*.cfg

chmod 644 /etc/nagiosql/hosts/*.cfg

chown www-data.nagios /etc/nagiosql/hosts/*.cfg   
chmod 644 /etc/nagiosql/services/*.cfg

chown www-data.nagios /etc/nagiosql/services/*.cfg  

修改/usr/local/nagios/etc/nagios.cfg

注释掉所有cfg_file,cfg_dir开始的行,添加以内容到文件最后

#change for hugwww

   cfg_file=/etc/nagiosql/contacttemplates.cfg

   cfg_file=/etc/nagiosql/contactgroups.cfg

   cfg_file=/etc/nagiosql/contacts.cfg

   cfg_file=/etc/nagiosql/timeperiods.cfg

   cfg_file=/etc/nagiosql/commands.cfg

   cfg_file=/etc/nagiosql/hostgroups.cfg

   cfg_file=/etc/nagiosql/servicegroups.cfg

   cfg_dir=/etc/nagiosql/hosts

   cfg_dir=/etc/nagiosql/services

   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

Administration -> Domains -> 修改

Nagios base directory* /usr/local/nagios/etc/

 

完成!

----------------------------------------------------------------------

 

Nagios Plugin for Cacti 简称 npc,是cacti的一个插件,这篇文章主要介绍如何在cacti中使用npc插件。

测试环境:
操作系统:rhel4u4 php4.4.4 mysql-4.1.22 httpd-2.2.4
npc主页:http://www.divagater.com/npc/
npc 当前版本:NPC 0.1.1a
nagios 主页:http://www.nagios.org
nagios 当前版本:nagios-2.7
nagios 插件当前版本:nagios-plugins-1.4.6
fruity::图形化配置nagios的工具,需要php5.x版本才能运行

http://fruity.sourceforge.net/
http://heanet.dl.sourceforge.net/sourceforge/fruity/
http://pear.php.net/get/HTML_TreeMenu-1.2.0.tgz
http://puzzle.dl.sourceforge.net/sourceforge/adodb/adodb471-1.tgz
将HTML_TreeMenu-1.2.0.tgz和adodb471-1.tgz直接解压复制到fruity 下 分别改名为HTML 和adodb 其他不做修改
修改 fruity/includes下的config.ifg,需要更改的地方有,路径,mysql信息
mysql 添加fruity 数据库和user,password.
这样,就可以用fruity来进行配置了。
注意:
在cacti服务器上的mysql版本必须是4.1以上,因为npc是以mysql4.1为基础进行开发的。

 

web配置nagios工具

标签:des   http   io   ar   os   使用   sp   java   for   

原文地址:http://www.cnblogs.com/steven9801/p/4111067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!