×

微信扫一扫,快捷登录!

Nagios完整的配置方案(3)

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

20151030淡然
续上




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

###############################################################################################################
安装配置ndoutils
把nagios的数据导入mysql数据库
创建数据库
mysql-uroot–p
mysql>CREATEDATABASEnagios;
mysql>GRANTALLONnagios.*TO'nagios'@localhostIDENTIFIEDBY‘nagios’#授权nagios用户,密码为nagios
mysql>FLUSHPRIVILEGES;


下载安装包
cd/opt/
tarzxvfndoutils-1.4b9.tar.gz–C/usr/src
cd/usr/src/ndoutils-1.4b9
把补丁包放在/usr/src/ndoutils-1.4b9目录下面
mvndoutils1.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
cddb/
./installdb-uroot-pxinqidian-dnagios
mysql-uroot-p
mysql>USEnagios;
mysql>SHOWTABLES;//查看验证表已经生成
cdndoutils-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
chmod774/usr/local/nagios/bin/ndo*
chownnagios:nagios/usr/local/nagios/bin/ndo*
chownnagios:nagios/usr/local/nagios/etc/ndo*
cd/usr/local/nagios/etc
vindo2db.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/ndo2dbnagios配置
chmod+x/etc/init.d/ndo2db
chkconfig--addndo2db
servicenagiosrestart

如果启动失败使用命令检查,看看是什么地方出错,并修正
/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
servicendo2dbstart
tail-f/usr/local/nagios/var/nagios.log
[root@testndoutils-1.4b9]#cat/usr/local/nagios/var/nagios.log
[1345086976]Nagios3.4.1starting...(PID=22899)
[1345086976]LocaltimeisThuAug1611:16:16CST2012
[1345086976]LOGVERSION:2.0
[1345086976]Finisheddaemonizing...(NewPID=22900)
[1345088085]Finisheddaemonizing...(NewPID=27417)
[1345088175]SERVICEALERT:localhost;HTTP;OK;HARD;4;HTTPOK:HTTP/1.1200OK-302bytesin0.001second
responsetime
[1345089958]CaughtSIGTERM,shuttingdown...
[1345089958]Successfullyshutdown...(PID=27417)
[1345089958]Nagios3.4.1starting...(PID=8993)
[1345089958]LocaltimeisThuAug1612:05:58CST2012
监控软件
[1345090128]LOGVERSION:2.0
[1345090128]ndomod:NDOMOD-MERETHIS1.4b9-merethis(10-27-2009)Copyright(c)2009NagiosCoreDevelopmentTeamandCommunityContributors
[1345090128]ndomod:Successfullyconnectedtodatasink.0queueditemstoflush.
[1345090128]Eventbrokermodule'/usr/local/nagios/bin/ndomod.o'initializedsuccessfully.//
初始化成功
[1345090128]Finisheddaemonizing...(NewPID=9360)


phpsession
权限问题
访问pnp4nagios时有
Anerrorwasdetectedwhichpreventedtheloadingofthispage.Ifthisproblempersists,pleasecontactthe
websiteadministrator.
/usr/local/pnp4nagios/lib/kohana/system/libraries/Session.php[160]:nagios实施
session_start():open(/var/lib/php/sess_d1suf0cpph46v95efp1b7l0cbtt0q7nr,O_RDWR)failed:Permissiondenied(13)
错误
检查/var/lib/php5目录的权限,发现原来是root才可以读写,而apache采用了nagios的用户来运行,所以php的session数据没
有权限写入,于是更改/var/lib/php的写入权限
chown-Rnagios.nagios/var/lib/php
chown-R777/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/useraddnagios
passwdnagios
tarxzfnagios-plugins-1.4.16.tar.gz
cdnagios-plugins-1.4.16
./configure--prefix=/usr/local/nagiosnagios培训
编译结果提示:--with-openssl:no,请安装:yum-yinstallopenssl-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

成为第一个吐槽的人

Powered by IT 运维管理
返回顶部