由于本人在安装mysql安装包时yum默认安装为5.1,而我要安装的mysql为5.6版本,因此从官网下载的rpm安装包安装的。但是在此服务器上安装nagios时,发现安装的nagios-plugin插件中check_mysql没有安装,因此无法监控mysql服务。通过查资料说是需要先安装mysql-devel,然后在安装插件才可以。但是mysql5.6环境下不管用,因此将该安装过程记录如下:
1. 默认安装为mysql5.6的rpm包环境:
(1)检查当前是否安装了mysql-devel:
$ rpm -qa |grep -i mysql
MySQL-client-5.6.27-1.el6.x86_64
php-mysql-5.3.3-46.el6_6.x86_64
MySQL-server-5.6.27-1.el6.x86_64
MySQL-shared-compat-5.6.27-1.el6.x86_64
MySQL-devel-5.6.27-1.el6.x86_64
已经安装MySQL-devel-5.6.27-1.el6.x86_64.
(2)重新编译安装nagios-plugin:
$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios
.......
checking for mysql_config... /usr/bin/mysql_config
checking for mysql_init in -lmysqlclient... no
configure: WARNING: Skipping mysql plugin
configure: WARNING: install mysql client libs to compile this plugin (see REQUIREMENTS).
checking utmpx.h usability... yes
.......
--with-apt-get-command:
--with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
--with-ping-command: /bin/ping -n -U -w %d -c %d %s
--with-ipv6: yes
--with-mysql: no
--with-openssl: yes
--with-gnutls: no
--enable-extra-opts: yes
--with-perl: /usr/bin/perl
--enable-perl-modules: no
--with-cgiurl: /nagios/cgi-bin
--with-trusted-path: /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
--enable-libtap: no
经过查看过程,发现如上问题。
2. 在yum安装mysql-devel的环境中如下:
(1)yum安装mysql-devel:
$ sudo yum -y install mysql-devel
..........
.........
已安装:
mysql-devel.x86_64 0:5.1.73-5.el6_6
作为依赖被安装:
mysql.x86_64 0:5.1.73-5.el6_6 mysql-libs.x86_64 0:5.1.73-5.el6_6
完毕!
(2)编译安装nagios-plugin插件:
$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios
...........
checking for mysql_config... /usr/bin/mysql_config
checking for mysql_init in -lmysqlclient... yes
checking utmpx.h usability... yes
.....................
-with-apt-get-command:
--with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
--with-ping-command: /bin/ping -n -U -w %d -c %d %s
--with-ipv6: yes
--with-mysql: /usr/bin/mysql_config
--with-openssl: yes
--with-gnutls: no
--enable-extra-opts: yes
--with-perl: /usr/bin/perl
--enable-perl-modules: no
--with-cgiurl: /nagios/cgi-bin
--with-trusted-path: /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
--enable-libtap: no
(3)搜索一下mysqlclient的位置:
#updatedb
# locate mysqlclient
/soft/nagios-plugins-2.1.1/m4/np_mysqlclient.m4
/usr/lib/mysql/libmysqlclient.a
/usr/lib/mysql/libmysqlclient.so
/usr/lib/mysql/libmysqlclient.so.15
/usr/lib/mysql/libmysqlclient.so.15.0.0
/usr/lib/mysql/libmysqlclient_r.a
/usr/lib/mysql/libmysqlclient_r.so
/usr/lib/mysql/libmysqlclient_r.so.15
/usr/lib/mysql/libmysqlclient_r.so.15.0.0
/usr/lib64/mysql/libmysqlclient.a
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so.15
/usr/lib64/mysql/libmysqlclient.so.15.0.0
/usr/lib64/mysql/libmysqlclient_r.a
/usr/lib64/mysql/libmysqlclient_r.so
/usr/lib64/mysql/libmysqlclient_r.so.15
/usr/lib64/mysql/libmysqlclient_r.so.15.0.0
通过对比发现,rpm安装的mysql5.6版本没有生成如上的接口文件,导致编译安装nagios-plugin时无法安装check_mysql。
解决方法:
目前只能先卸载rpm包所安装的mysql-devel,然后在yum安装。还没有找到rpm包安装解决的方法。
转载于:https://blog.51cto.com/kunka/1711727