监控平台: /usr/local/nagios/libexec/check_nrpe -H 被监控机 出错如下.
CHECK_NRPE: Error - Could not complete SSL handshake.
在被监控机# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 也会出错.
(good)
cd check_mysql_health-2.1
mkdir -p /usr/local/nagios/mysql_health/states
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios \
--with-nagios-group=nagios --with-perl \
--with-statefiles-dir=/usr/local/nagios/mysql_health/states
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-perl --with-statefiles-dir=/usr/local/nagios/mysql_health/states
make
make install
###
./check_mysql_health --hostname proxy1.kdb --port 3306 --username root --password ipo2008mimi --mode threads-connected
CRITICAL - cannot connect to information_schema. install_driver(mysq
l) failed: Can't locate DBD/mysql.pm in
下载perl dbi/dbd
http://dev.mysql.com/downloads/dbi.html (rpm包)
##处理
或者
perl -e shell -MCPAN
cpan> install DBI
cpan> install DBD::mysql
cpan> install DBD::mysql which will also check for (other Perl modules) dependencies
###DBD
vim mysql_config #socket='/var/lib/mysql/mysql.sock' -->socket='/data/var/mysql.sock'
perl Makefile.PL --mysql_config=/usr/bin/mysql_config
Perl-DBI版本:DBI-1.56
Step 1: # cp DBI-1.56.tar.gz /usr/local/
Step 2: # cd /usr/local/
Step 3: # tar xvzf DBI-1.56.tar.gz
Step 4: # cd DBI-1.56
Step 5: # perl Makefile.PL
Step 6: # make
Step 7: # make test
Step 8: # make install
Step 9: # perl -MDBI –el (测试是否安装成功,若不报错则成功)
3、 Perl-DBD-MySQL 模块安装
Step 1: # cp DBD-mysql-4.00.tar.gz /usr/local/
Step 2: # cd /usr/local/
Step 3: # tar xvzf DBD-mysql-4.00.tar.gz
Step 4: # cd DBD-mysql-4.00
Step 5: # perl Makefile.PL
Step 6: # make
Step 7: # make test
Step 8: # make install
perl Makefile.PL \
--libs="-L/mysql目录/lib/mysql -lmysqlclient -lz" \
--cflags=-I/mysql目录/include/mysql
make
make test
make install
#!/bin/perl
use DBI;
# Connect to target DB
my $dbh = DBI->connect("DBI:mysql atabase=fb;host=puma.kdb","ipo2008","meiguiyuan", {'RaiseError' => 1});
# query
my $sqr = $dbh->prepare("show databases");
$sqr->execute();
while(my $ref = $sqr->fetchrow_hashref()) {
print "$ref->{'Database'}\n";
}
$dbh->disconnect();
阅读(1502) | 评论(0) | 转发(0) |