NDOutils

 
环境准备
************************
#rpm -aq |grep php
php-common-5.1.6-23.el5
php-gd-5.1.6-23.el5
php-xml-5.1.6-23.el5
php-mysql-5.1.6-23.el5
php-5.1.6-23.el5
php-devel-5.1.6-23.el5
php-mbstring-5.1.6-23.el5
php-xmlrpc-5.1.6-23.el5
php-cli-5.1.6-23.el5
php-pdo-5.1.6-23.el5
 
 
(yum install mysql-server等包)
#rpm -aq |  grep mysql
mysql-bench-5.0.45-7.el5
php-mysql-5.1.6-23.el5
mysql-5.0.45-7.el5
mysql-server-5.0.45-7.el5 (server包,包含/etc/init.d/mysqld)
mysql-devel-5.0.45-7.el5  (缺少此包可能报无法连接数据库,数据库版本未知等错)
mysql-test-5.0.45-7.el5
 
 
#rpm �Cqa |grep DBI
perl-DBI-1.52-2.EL5
#rpm �Caq |grep DBD
perl-DBD-MySQL-3.0007-2.el5
 
 
****************************
951  cd DBI-1.50
953  perl Makefile.PL
954  make
955  make install
****************************
 
958  cd DBD-mysql-3.0002_4
960  unset LANG
961  perl Makefile.PL --libs="-L/usr/local/mysql/lib/mysql -lmysqlclient -L/usr/lib -lz " --cflags=-I/usr/local/mysql/include/mysql   --mysql_config=/usr/local/mysql/bin/mysql_config --testhost=127.0.0.1 --testsocket=/usr/local/mysql/tmp/mysql.sock --testdb=nagios --testuser=root --testpassword=123456      (此部分有误,但不影响后续插件nagvis使用,其他应用未知)
962  make
963  make install
=================================================================== 
966  cd ndoutils-1.4b9
967  ./configure --with-mysql-lib=/usr/lib/mysql/ --with-mysql-inc=/usr/include/mysql/ --disable-pgsql
968  make
969  cd src/
970  ls
971  cp ndomod-3x.o ndo2db-3x log2ndo file2sock /usr/local/nagios/bin
972  cd ../db
 
  975  service mysqld start
  976  mysqladmin -u root -p password                              
  977  mysql -u root -p
  978  service mysqld restart
  979  mysql -u root
  980  mysql -u root -p
  981  service mysqld restart
  982  ./installdb -u root -p ABC -d nagios
  983  cd ../config
  984  ls
  985  cp ndo* /usr/local/nagios/etc/
  986  ls
  987  cd /usr/local/nagios/etc
  988  ls
  989  cp ndo2db.cfg-sample.in ndo2db.cfg
  990  cp ndomod.cfg-sample.in ndomod.cfg
  991  vi nagios.cfg
  992  vi ndo2db.cfg
  993  vi ndomod.cfg
  994  /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
  995  service nagios restart
  996  vi /var/log/messages
 
*************************
976
 mysql 默认密码为空 mysqladmin  -u root password  ABC添加密码。
                                  或 mysqladmin  -u root -p password newABC 修改密码
       #mysql -u root -p 命令连接。(此root为mysql的root)
       > create database nagios ;
       > grant  select,insert,update,delete  on nagios.* to root@localhost identified by 'ABC'  ;(非root用户时添加权限)
       > flush privileges; 
       >quit
**************************
991
# vi /usr/local/nagios/etc/nagios.cfg
在文件中添加:
broker_module=/usr/local/nagios/bin/ndomod-3x.o  config_file=/usr/local/nagios/etc/ndomod.cfg     
***********************
#vi ndo2db.cfg
#lock_file=@localstatedir@/ndo2db.lock
#ndo2db_user=@ndo2db_user @
#ndo2db_group=@ndo2db_user @
ndo2db_user=nagios
ndo2db_group=nagios
#socket_type=unix
socket_type=tcp
socket_name=@localstatedir@/ndo.sock
db_servertype=mysql
db_host=localhost
db_port=3306
db_name=nagios
db_prefix=nagios_
db_user=root
db_pass=ABC  数据库密码
 
 
 
# vi /usr/local/nagios/etc/ndomod.cfg
output_type=tcpsocket
output=127.0.0.1
 
*****************************
994
启动ndo2db守护进程
 
# /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagiso/etc/ndo2db.cfg
 
*****************************
编入>>/etc/rc.d/rc.local 每次开机自启动。
 
若socket address 被占用
rm /usr/local/nagios/var/ndo.sock
或 ps -ef |grep ndo ,kill掉相应进程。
 
======================================
#service nagios restart
 
#vi /var/log/messages 看到successfully connected to data sink即连接成功!
NDOutils_第1张图片
 
#vi /usr/local/nagios/var/nagios.log
 
 
 
==================================================
后记:
NDOutils是nagvis的连接nagios数据库的插件,是必须的。
我在虚拟机(rhel5.3)里调试完成后,在真机(CENTOS5.3)上调试却无论如何都无法连接数据库,出现以下错误
nagios: ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
无论如何如何修改重调都无济于事。而同时,在虚拟机中镜像还原调试却都能成功,确定不是配置过程有误。最后无奈选择删除所有mysql数据库相关包重装mysql后调试成功!
 
命令如下。
 887  cd /usr/local/nagios/etc
  900  rm -rf ndo*
  902  cd ..
  904  cd etc
  906  vi nagios.cfg
  907  cd ..
  909  cd bin/
  911  rm file2sock
  912  rm log2ndo
  913  rm ndo*
  914  ls
  915  init 6
  916  cd /d1
  917  ls
  918  cd nagvis/
  919  ls
  920  cd DBI-1.50
    922  ls
  923  make clean
  924  cd ..
  925  cd DBD-mysql-3.0002_4
  926  make clean
  927  vi /usr/local/nagios/etc/nagios.cfg
  928  service nagios restart
  931  yum erase  mysql-server
  932  yum erase  mysql
  933  rpm -qa |grep mysql
  934  rpm -qa |grep php
                                                          //以上为卸载。

  935  yum install mysql-server
  936  yum install  mysql-server
  937  rpm -aq |grep mysql
  938  yum install mysql-devel
  939  rpm -aq |grep mysql
  940  yum install mysql-test
  941  rpm -aq |grep mysql
  942  yum install mysql-bench
  943  rpm -aq |grep mysql
  944  rpm -aq |grep
  945  rpm -aq |grep  mysql
  946  rpm -aq |grep  perl
  947  cd /d1/
  948  ls
  949  cd nagvis/
  950  ls
  951  cd DBI-1.50
  952  ls
  953  perl Makefile.PL
  954  make
  955  make install
  956  cd ..
  957  ls
  958  cd DBD-mysql-3.0002_4
  959  ls
  960  unset LANG
  961  perl Makefile.PL --libs="-L/usr/local/mysql/lib/mysql -lmysqlclient -L/usr/lib -lz " --cflags=-I/usr/local/mysql/include/mysql --mysql_config=/usr/local/mysql/bin/mysql_config --testhost=127.0.0.1 --testsocket=/usr/local/mysql/tmp/mysql.sock --testdb=nagios --testuser=root --testpassword=123456
  962  make
  963  make install
  964  cd ..
  965  ls
  966  cd ndoutils-1.4b9
  967  ./configure --with-mysql-lib=/usr/lib/mysql/ --with-mysql-inc=/usr/include/mysql/ --disable-pgsql
  968  make
  969  cd src/
  970  ls
  971  cp ndomod-3x.o ndo2db-3x log2ndo file2sock /usr/local/nagios/bin
  972  cd ../db
  973  mysqladmin -u root -p password
  974  service mysqld start
  975  service mysqld start
  976  mysqladmin -u root -p password
  977  mysql -u root -p
  978  service mysqld restart
  979  mysql -u root
  980  mysql -u root -p
  981  service mysqld restart
  982  ./installdb -u root -p qwer1234 -d nagios
  983  cd ../config
  984  ls
  985  cp ndo* /usr/local/nagios/etc/
  986  ls
  987  cd /usr/local/nagios/etc
  988  ls
  989  cp ndo2db.cfg-sample.in ndo2db.cfg
  990  cp ndomod.cfg-sample.in ndomod.cfg
  991  vi nagios.cfg
  992  vi ndo2db.cfg
  993  vi ndomod.cfg
  994  /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
  995  service nagios restart
  996  vi /var/log/messages
  997  history
  998  vi /var/log/messages
  999  vi /d1/historylog.txt
 
 
================================================
================================================
安装文档参考 http://nagios.sourceforge.net/docs/ndoutils/NDOUtils.pdf
报错参考http://blog.c1gstudio.com/archives/635
 

你可能感兴趣的:(职场,休闲,nagvis)