共计 2797 个字符,预计需要花费 7 分钟才能阅读完成。
一、NDOUtils 安装需求:
Nagios:安装方法:http://www.linuxidc.com/Linux/2014-01/94658.htm
MySQL:源码安装方法:http://www.linuxidc.com/Linux/2014-04/100758.htm
DBI 和 DBD-mysql 安装方法如下:
shell> perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql
二、关联 mysql 头文件和库:
不做关联可能在 config 或 make 时出错
ln -s /app/mysql/include/* /usr/include/
ln -s /app/mysql/lib/* /usr/lib/
echo '/usr/lib' >> /etc/ld.so.conf
ldconfig -v
三、安装 nodutils:
tar zxvf ndoutils-1.4b7.tar.gz
cd ndoutils-1.4b7
./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql LDFLAGS=-L/app/mysql/lib --with-mysql-inc=/app/mysql/include/mysql --with-mysql-lib=/app/mysql/lib/mysql
make
四、拷贝文件:
cp ./src/ndomod-3x.o /usr/local/nagios/bin
cp ./src/ndo2db-3x /usr/local/nagios/bin
cp ./src/log2ndo /usr/local/nagios/bin
cp ./src/file2sock /usr/local/nagios/bin
chown nagios:nagios /usr/local/nagios/bin/*
五、拷贝配置文件:
cp ./config/ndo* /usr/local/nagios/etc/
chown nagios:nagios /usr/local/nagios/etc/*
六、创建 ndo 的 mysql 数据库及用户
CREATE DATABASE `nagios` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT select,insert,update,delete ON nagios.* TO nagios@localhost identified by 'nagios';
FLUSH PRIVILEGES ;
七、导入数据库结构
cd ./db/
./installdb -u root -p 123456 -h localhost -d nagios
如果这里 root 没有密码的话需要进行修改。
八、修改配置文件
vim /usr/local/nagios/etc/ndo2db.cfg
db_user=nagios
db_pass=nagios
socket_type=tcp
vim /usr/local/nagios/etc/nagios.cfg
broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg
vim /usr/local/nagios/etc/ndomod.cfg
output_type=file
output=/usr/local/nagios/var/ndo.dat
九、启动 ndo2db
/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
十、重启 nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart
十一、检查安装是否正确
tail -f /usr/local/nagios/var/nagios.log
涉及的错误:
启动 ndo 后在日志中出现:nagios ndo2db-3x: Error: mysql_query() failed for ‘INSERT INTO nagios_configfilevariables SET instance_id=’1′, configfile_id=’3′, varname=’cfg_file’, varvalue=’/usr/local/nagios//etc/objects/localhost\.cfg 解决办法是使用:mysql -uroot –password=”canada” -h192.168.1.97 -e “alter table nagios.nagios_configfilevariables drop key instance_id;alter table nagios.nagios_configfilevariables add index (instance_id, configfile_id, varname); 需要修改表结构。alter table nagios.nagios_configfilevariables drop key instance_id; alter table nagios.nagios_configfilevariables add index (instance_id, configfile_id, varname);
tcp 连接 Mysql /usr/local/nagios/bin/file2sock -s /usr/local/nagios/var/ndo.dat -d localhost -t tcp -p 5668
相关阅读 :
网络监控器 Nagios 全攻略 http://www.linuxidc.com/Linux/2013-07/87067.htm
Nagios 搭建与配置详解 http://www.linuxidc.com/Linux/2013-05/84848.htm
Nginx 环境下构建 Nagios 监控平台 http://www.linuxidc.com/Linux/2011-07/38112.htm
在 RHEL5.3 上配置基本的 Nagios 系统 (使用 Nagios-3.1.2) http://www.linuxidc.com/Linux/2011-07/38129.htm
CentOS 5.5+Nginx+Nagios 监控端和被控端安装配置指南 http://www.linuxidc.com/Linux/2011-09/44018.htm
Ubuntu 13.10 Server 安装 Nagios Core 网络监控运用 http://www.linuxidc.com/Linux/2013-11/93047.htm
Nagios 的详细介绍 :请点这里
Nagios 的下载地址 :请点这里