设为首页 - 加入收藏 郑州电脑维修网(hcyzs.cn),专注电脑维修,打印机维修加粉,公司组网布网,监控安防等数十年!
热搜: RJ-11 TP-LINK casque by dr casque by dr
广告位
当前位置: 主页 > 操作系统 > Linux教程 >

Nagios监控信息存入mysql

2010-05-03 23:25 [Linux教程] 来源于:
导读:环境介绍 系统:红帽企业版5.4 Nagios正确安装运行,版本3.0.6 安装目录:/usr/local/nagios,这部分可以参
环境介绍
系统:红帽企业版5.4
Nagios正确安装运行,版本3.0.6 安装目录:/usr/local/nagios,这部分可以参考http://hi.baidu.com/naruto6006/blog/item/49d243d8688877e239012fa0.html

MySQL正确安装并运行,安装目录:/usr/local/mysql,这部分可以参考http://hi.baidu.com/naruto6006/blog/item/67aff4125a046728dd54011f.html

1:安装DBI包
[root@server2 ~]# cd /usr/local/src/tarbag/
[root@server2 tarbag]# wget http://www.cpan.org/modules/by-module/DBI/DBI-1.605.tar.gz
[root@server2 tarbag]# tar zxvf DBI-1.605.tar.gz -C ../software/
[root@server2 tarbag]# cd ../software/DBI-1.605/
[root@server2 DBI-1.605]# perl Makefile.PL
[root@server2 DBI-1.605]# make && make install

2:安装DBD-mysql
[root@server2 DBI-1.605]# cd -
/usr/local/src/tarbag
[root@server2 tarbag]# wget http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-3.0008.tar.gz
[root@server2 tarbag]# tar -zxvf DBD-mysql-3.0008.tar.gz -C ../software/
[root@server2 tarbag]# cd ../software/DBD-mysql-3.0008/
[root@server2 DBD-mysql-3.0008]# unset LANG
[root@server2 DBD-mysql-3.0008]# 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=/tmp/mysql.sock --testdb=nagios --testuser=root --testpassword=password

………………………………………………………输出省略………………………………………………
I will use the following settings for compiling and testing:

cflags (User\'s choice) = -I/usr/local/mysql/include/mysql
embedded (mysql_config ) =
libs (User\'s choice) = -L/usr/local/mysql/lib/mysql -lmysqlclient -L/usr/lib -lz
mysql_config (Users choice ) = /usr/local/mysql/bin/mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (User\'s choice) = nagios
testhost (User\'s choice) = 127.0.0.1
testpassword (default ) = password
testsocket (User\'s choice) = /tmp/mysql.sock
testuser (User\'s choice) = root

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

3:创建mysql头文件和库文件的链接到/usr相关目录下
[root@server2 DBD-mysql-3.0008]# cd
[root@server2 ~]# ln -s /usr/local/mysql/include/* /usr/include/
[root@server2 ~]# ln -s /usr/local/mysql/lib/* /usr/lib/

4:安装ndoutils
[root@server2 ~]# cd /usr/local/src/tarbag/
[root@server2 tarbag]# wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.4b7/ndoutils-1.4b7.tar.gz/download
--00:56:40-- http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.4b7/ndoutils-1.4b7.tar.gz/download

[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.

mysql> create database nagios;

(编辑:admin)

网友评论
推荐文章