1.DBI的安裝
# wget http://www./modules/by-module/DBI/DBI-1.608.tar.gz # tar zxvf DBI-1.608.tar.gz # cd DBI-1.608 # perl Makefile.PL # make # make test # make install 2.DBD的安裝 # wget http://www./modules/by-module/DBD/DBD-mysql-4.011.tar.gz # tar -zxvf DBD-mysql-4.011.tar.gz # cd DBD-mysql-4.011 # perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config --libs=-L/usr/local/mysql/lib-static -lmysqlclient # make # make install 3.關聯(lián)mysql頭文件和庫 # ln -s /usr/local/mysql/lib/mysql/* /usr/lib # ln -s /usr/local/mysql/include/mysql/* /usr/include # ldconfig -v 4.編譯安裝NDOUtils # tar zxf ndoutils-1.4b9.tar.gz # cd ndoutils-1.4b9 # ./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql LDFLAGS=-L/usr/local/mysql/lib --with-mysql-inc=/usr/local/mysql/include/mysql --with-mysql-lib=/usr/local/mysql/lib/mysql # 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/* 5.為NDOUtils創(chuàng)建數據庫 # mysql -uroot -p mysql> create database ndodb; mysql>grant all on ndodb.* to 'ndouser'@'%' identified by '123456'; mysql> flush privileges;
mysql> /q 生成ndoutils所需要的數據庫 # cd db # ./installdb -u n root -p 123456 -h localhost -d ndodb 也可這樣:# /opt/mysql/bin/mysql -u root -p -D nagios -h localhost < ./db/mysql.sql 6.編輯配置文件 # vi /usr/local/nagios/etc/ndo2db.cfg db_user=nagios db_pass=123456 # vi /usr/local/nagios/etc/nagios.cfg # 復制下面內容粘貼到#broker_module=...下面。 broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg 此外,請確保您的/usr/local/nagios/etc/nagios.cfg中有如下行出現(xiàn),否則,請自行添加: event_broker_options=-1 //為Nagios開啟event broker 7啟動ndo2db # /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg # echo '/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg' >> /etc/rc.local 8.重啟動nagios # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg # service nagios restart 檢查安裝 tail -20 /usr/local/nagios/var/nagios.log 遇到問題: 1.執(zhí)行 # /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg 提示錯誤:Could not bind socket: Address already in use 解決:ps aux|grep ndo2db #沒有 查看套接字文件是否存在,刪除之 ll /usr/local/nagios/var/ndo.sock rm /usr/local/nagios/var/ndo.sock 2.#ndo2db數據不能導入到數據庫 原因:編譯時沒有LDFLAGS=-L/opt/mysql/lib 解決:重新編譯ndoutils并加上 LDFLAGS=-L/opt/mysql/lib # ./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql LDFLAGS=-L/usr/local/mysql/lib --with-mysql-inc=/usr/local/mysql/include/mysql --with-mysql-lib=/usr/local/mysql/lib/mysql # make #再執(zhí)行一下安裝過程后,通過 |
|
來自: 我本無我O > 《Linux操作系統(tǒng)》