# groupadd mysql
# useradd -g mysql mysql
|
# gunzip ./mysql-5.0.51b.tar.gz
# tar xvf ./mysql-5.0.51b.tar
# cd ./mysql-5.0.51b
# CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
-fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static
|
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
# cd bin
# ./mysql -u root -p -h localhost
|
//
进入MySql的安装目录
# cd /usr/local/mysql
//
进入bin目录
# cd ./bin
//
运行mysql,使用root用户登录数据库,密码为空
# ./mysql -u root -p -h localhost
mysql> CREATE DATABASE nagiosdb;
mysql> GRANT ALL ON nagiosdb.* TO 'nagiosmysql'@'localhost' IDENTIFIED BY "nagiosmysql";
mysql> exit
//
退出登录,使用刚刚创建的用户登录刚刚创建的数据库
# ./mysql -u nagiosmysql -p -h localhost -D nagiosdb
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.51b-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
|
|
图3.1.1
|
Data-Dumper-2.121
|
DBI-1.607
|
DBD-mysql-4.007
|
perl-5.8.8-sol10-x86-local
|
#
cd $NDOUTILS_DIR
# ./configure --prefix=/usr/local/nagios --enable-mysql \
--with-mysql-lib=/usr/local/mysql/lib/mysql \
--with-mysql-inc=/usr/local/mysql/include
|
# cd /usr/local/include
# ln -s /usr/local/mysql/include/mysql ./mysql
# cd /usr/local/lib
# ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so \
./libmysqlclient.so
# ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15\
./libmysqlclient.so.15
|
# cd $NDOUTILS_DIR
# vi ./src/Makefile
ndo2db-2x: ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-2x.o
$(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_2X -o ndo2db-2x ndo2db.c dbhandlers-2x.o ../common/snprintf.o \
$(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS)
ndo2db-3x: ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-3x.o
$(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_3X -o ndo2db-3x ndo2db.c dbhandlers-3x.o ../common/snprintf.o \
$(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS)
|
# cd $NDOUTILS_DIR
# cp -R ../nagios-3.0.3/common ./ #
拷贝
snprintf.o
文件
# make
|
# cd $NDOUTILS_DIR/src
# cp ndomod-3x.o ndo2db-3x log2ndo file2sock \
/usr/local/nagios/bin
# cd $NDOUTILS_DIR/config
# cp ndomod.cfg ndo2db.cfg /usr/local/nagios/etc
|
# cd /usr/local/nagios/etc
# vi ./ndo2db.cfg
db_name=nagiosdb
db_user=nagiosmysql
db_pass=nagiosmysql
|
# cd /usr/local/nagios/etc
# vi ./nagios.cfg
# Uncomment the line below if you're running Nagios 2.x
#broker_module=/usr/local/nagios/bin/ndomod-2x.o config_file=/usr/local/nagios/etc/ndomod.cfg
# 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
|
event_broker_options=-1
|
# gunzip ./perl-5.8.8-sol10-x86-local.gz
# pkgadd -d ./perl-5.8.8-sol10-x86-local
# cd /usr/bin
# ln -sf /usr/local/bin/perl ./perl
# perl -v
This is perl, v5.8.8 built for i86pc-solaris
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at [url]http://www.perl.org/[/url], the Perl Home Page.
|
# gunzip ./Data-Dumper-2.121.tar.gz
# tar xvf ./Data-Dumper-2.121.tar
# cd ./Data-Dumper-2.121
# perl ./Makefile.PL
# make
# make install
|
# gunzip ./DBI-1.607.tar.gz
# tar xvf ./DBI-1.607.tar
# cd ./DBI-1.607
# perl ./Makefile.PL
# make
# make install
|
# gunzip ./DBD-mysql-4.007.tar.gz
# tar xvf ./DBD-mysql-4.007.tar
# cd ./DBD-mysql-4.007
# perl Makefile.PL \
--libs="-L/usr/local/mysql/lib/mysql -lmysqlclient -lz" \
--cflags=-I/usr/local/mysql/include/mysql \
--testhost=localhost
# make
# make test
# make install
|
# cd $NDOUTILS_DIR
# export PATH=$PATH:/usr/local/mysql/bin
# cd ./db
# ./installdb -u nagiosmysql -p nagiosmysql \
-h localhost -d nagiosdb
|
# cd /usr/local/nagios/bin
# ./ndo2db-3x -c ../etc/ndo2db.cfg
|