×

微信扫一扫,快捷登录!

Nagios完整的配置方案(3)

标签: 暂无标签
本帖最后由 monicazhang 于 2015-10-30 21:34 编辑

20151030淡然
续上




及/var/www/html/nconf/./index.php
帐号密码保存在/var/www/html/nconf/config/.file_accounts.php文件中,帐号密码格式如下
#username::password::authorization(user|admin)::[user's full name (optional)]::                   nagios安装
admin::nconf::admin::Administrator::
然后再打开http://localhost/nconf,此时跟前面的会不一样,全部下一步就好,最好提示删除INSTALL/ INSTALL.php UPDATE/
UPDATE.php,照做就行

###############################################################################################################
安装配置ndoutils
把nagios的数据导入mysql数据库
创建数据库
mysql -u root –p
mysql>CREATE DATABASE nagios;
mysql>GRANT ALL ON nagios.* TO 'nagios'@localhost IDENTIFIED BY ‘nagios’     #授权nagios用户,密码为 nagios
mysql>FLUSH PRIVILEGES;


下载安装包
cd  /opt/
tar zxvf ndoutils-1.4b9.tar.gz –C /usr/src
cd /usr/src/ndoutils-1.4b9
把补丁包放在/usr/src/ndoutils-1.4b9目录下面
mv ndoutils1.4b9_light.patcusr/src/ndoutils-1.4b9                       开源监控软件
patch -p1 -N < ndoutils1.4b9_light.patch
提示补丁成功打上
./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
make
cd db/
./installdb -u root -p xinqidian -d nagios
mysql -u root -p
mysql>USE nagios;
mysql>SHOW TABLES; //查看验证表已经生成
cd ndoutils-1.4b9
cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
chmod 774 /usr/local/nagios/bin/ndo*
chown nagios:nagios /usr/local/nagios/bin/ndo*
chown nagios:nagios /usr/local/nagios/etc/ndo*
cd /usr/local/nagios/etc
vi ndo2db.cfg
db_name=nagios
db_user=nagios //
修改为nagios
db_pass=nagios //修改为nagios
vi /usr/local/nagios/etc/nagios.cfg
添加以下行
broker_module=/usr/local/nagios/bin/ndomod.o
config_file=/usr/local/nagios/etc/ndomod.cfg
cp /usr/src/ndoutils-1.4b9/daemon-init /etc/init.d/ndo2db                nagios配置
chmod +x /etc/init.d/ndo2db
chkconfig --add ndo2db
service nagios restart

如果启动失败使用命令检查,看看是什么地方出错,并修正
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
     service ndo2db start
tail -f /usr/local/nagios/var/nagios.log
[root@test ndoutils-1.4b9]# cat /usr/local/nagios/var/nagios.log                           
[1345086976] Nagios 3.4.1 starting... (PID=22899)
[1345086976] Local time is Thu Aug 16 11:16:16 CST 2012
[1345086976] LOG VERSION: 2.0
[1345086976] Finished daemonizing... (New PID=22900)
[1345088085] Finished daemonizing... (New PID=27417)
[1345088175] SERVICE ALERT: localhost;HTTP;OK;HARD;4;HTTP OK: HTTP/1.1 200 OK - 302 bytes in 0.001 second
response time
[1345089958] Caught SIGTERM, shutting down...
[1345089958] Successfully shutdown... (PID=27417)
[1345089958] Nagios 3.4.1 starting... (PID=8993)
[1345089958] Local time is Thu Aug 16 12:05:58 CST 2012                     
监控软件
[1345090128] LOG VERSION: 2.0
[1345090128] ndomod: NDOMOD-MERETHIS 1.4b9-merethis (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1345090128] ndomod: Successfully connected to data sink.  0 queued items to flush.
[1345090128] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.  //
初始化成功
[1345090128] Finished daemonizing... (New PID=9360)


php session
权限问题
访问pnp4nagios时有
An error was detected which prevented the loading of this page. If this problem persists, please contact the
website administrator.
/usr/local/pnp4nagios/lib/kohana/system/libraries/Session.php [160]:                   nagios实施
session_start(): open(/var/lib/php/sess_d1suf0cpph46v95efp1b7l0cbtt0q7nr, O_RDWR) failed: Permission denied (13)
错误
检查 /var/lib/php5目录的权限,发现原来是root才可以读写,而apache采用了nagios的用户来运行,所以php的session数据没
有权限写入,于是更改/var/lib/php的写入权限
chown -R nagios.nagios /var/lib/php      
chown -R 777 /var/lib/php


被监控客户端(
Linux
安装包NRPE和nagios-plugin
nagios-plugins-1.4.16.tar.gz和nrpe-2.12.tar.gz。
安装插件nagios-plugins-1.4.16.tar.gz
执行以下命令:
/usr/sbin/useradd nagios
passwd nagios
tar xzf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --prefix=/usr/local/nagios                  nagios培训
编译结果提示:--with-openssl:no,请安装:yum -y install openssl-devel
make








待续:http://www.ITILxf.com/thread-53052-1-1.html
本帖关键字:Nagios





上一篇:Nagios完整的配置方案(2)
下一篇:Nagios完整的配置方案(4)
monicazhang

写了 2297 篇文章,拥有财富 12859,被 21 人关注

您需要登录后才可以回帖 登录 | 立即注册
B Color Link Quote Code Smilies

成为第一个吐槽的人

返回顶部