To change these settings, see 'perl Makefile.PL --help' and 'perldoc INSTALL'. Using DBI 1.605 (for perl 5.008008 on i386-linux-thread-multi) installed in /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/ Writing Makefile for DBD::mysql
[root@server2 DBD-mysql-3.0008]# make && make install
4:安装ndoutils [root@server2 ~]# cd /usr/local/src/tarbag/ [root@server2 tarbag]# wget --00:56:40--
[root@server2 tarbag]# tar -zxvf ndoutils-1.4b7.tar.gz -C ../software/ [root@server2 tarbag]# cd ../software/ndoutils-1.4b7/ [root@server2 ndoutils-1.4b7]# ./configure --prefix=/usr/local/nagios --enable-mysql ………………………………………………………输出省略……………………………………………… MySQL library and include file(s) were found! configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating subst config.status: creating include/config.h
*** Configuration summary for ndoutils 1.4b7 10-31-2007 ***:
General Options: ------------------------- NDO2DB user: nagios NDO2DB group: nagios
Review the options above for accuracy. If they look okay, type 'make' to compile the NDO utilities.
[root@server2 ndoutils-1.4b7]# make [root@server2 ndoutils-1.4b7]# cd src/ [root@server2 src]# cp ndomod-3x.o ndo2db-3x log2ndo file2sock /usr/local/nagios/bin/ [root@server2 src]# cd ../db [root@server2 db]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.1.36-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
[root@server2 db]# ./installdb -u root -p 123456 -d nagios DBD::mysql::db do failed: Table 'nagios.nagios_dbversion' doesn't exist at ./installdb line 51. ** Creating tables for version 1.4b7 Using mysql.sql for installation... ** Updating table nagios_dbversion Done!
DBD::mysql::db do failed: Table 'nagios.nagios_dbversion' doesn't exist at ./installdb line 51(这个错误可以忽略…)
若出现错误提示“failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at ./installdb line 41“,原因是找不到mysql.sock,编译安装的msyql一般sock的位置是在/tmp下,解决办法有两个,一是修改/etc/my.cnf文件中sock的位置,二是创建一个软链接到/var/lib/mysql下面
[root@server2 db]# cd ../config [root@server2 config]# cp ndo* /usr/local/nagios/etc/
6:修改nagios.cfg #复制下面内容粘贴到/usr/local/nagios/etc/nagios.cfg配置文件的#broker_module=...下面。 #Uncomment the line below if you're running Nagios 3.x broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg #修改/usr/local/nagios/etc/nagios.cfg配置文件下面参数的值为-1(一般默认如此)。
# 启动ndo2db /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg 若出现提示信息“Support for the specified database server is either not yet supported, or was not found on your system“ 应该是没找到mysql.h等头文件导致的,请确保所必须的库已安装,并在./configure时指定头文件目录!