monicazhang 发表于 2015-10-30 21:32:29

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)::::                   nagios安装
admin::nconf::admin::Administrator::然后再打开http://localhost/nconf,此时跟前面的会不一样,全部下一步就好,最好提示删除INSTALL/ INSTALL.php UPDATE/ UPDATE.php,照做就行
###############################################################################################################安装配置ndoutils 把nagios的数据导入mysql数据库创建数据库 mysql -u root –pmysql>CREATE DATABASE nagios;mysql>GRANT ALL ON nagios.* TO 'nagios'@localhost IDENTIFIED BY ‘nagios’   #授权nagios用户,密码为 nagiosmysql>FLUSH PRIVILEGES;

下载安装包 cd/opt/wget sourceforge/nagios/ndoutils-1.4b9.tar.gz
wget trunk/ndoutils-patch/ndoutils1.4b9_light.patchtar 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 nagiosmysql -u root -p mysql>USE nagios;
mysql>SHOW TABLES; //查看验证表已经生成cd ndoutils-1.4b9cp ./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 //修改为nagiosvi /usr/local/nagios/etc/nagios.cfg添加以下行broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfgcp /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 starttail -f /usr/local/nagios/var/nagios.log@test ndoutils-1.4b9]# cat /usr/local/nagios/var/nagios.log                           
Nagios 3.4.1 starting... (PID=22899)
Local time is Thu Aug 16 11:16:16 CST 2012
LOG VERSION: 2.0
Finished daemonizing... (New PID=22900)
Finished daemonizing... (New PID=27417)
SERVICE ALERT: localhost;HTTP;OK;HARD;4;HTTP OK: HTTP/1.1 200 OK - 302 bytes in 0.001 second response time
Caught SIGTERM, shutting down...
Successfully shutdown... (PID=27417)
Nagios 3.4.1 starting... (PID=8993)
Local time is Thu Aug 16 12:05:58 CST 2012                      监控软件
LOG VERSION: 2.0
ndomod: NDOMOD-MERETHIS 1.4b9-merethis (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
ndomod: Successfully connected to data sink.0 queued items to flush.
Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.//初始化成功
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 :                   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://ITIL-foundation.cn/thread-53052-1-1.html
本帖关键字:Nagios
页: [1]
查看完整版本: Nagios完整的配置方案(3)