做mysql的slave时间监控,必须check_mysql文字,check当误差:
error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

1,错误信息例如以下:
[root@slave ~]# /usr/local/nagios/libexec/check_mysql -uadmin -P3306 -S /data/mbdata/open/mysql.sock -H127.0.0.1 -pxxxxx -d openshop -w 300 -c 360
/usr/local/nagios/libexec/check_mysql: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
[root@slave ~]#

2,运行check_mysql --help看下命令,发现也不行。

[root@slave ~]# /usr/local/nagios/libexec/check_mysql --help
/usr/local/nagios/libexec/check_mysql: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
[root@slave ~]# 

3。查看一下报错的libmysqlclient.so.18文件是否存在:
[root@db-m1-slave-1 ~]# find / -name libmysqlclient.so.18
/mysql-5.6.12/libmysql/libmysqlclient.so.18
/usr/local/mysql/lib/libmysqlclient.so.18
文件存在。可是无法识别。

4,可能是libmysqlclient的问题
搜索mysqlclient library linkage problem。

找到文章地址:http://stackoverflow.com/questions/2080679/mysqlclient-library-linkage-problem
发现有/etc/ld.so.conf.d/mysql-x86_64.conf这样一个配置文件,打开看看
cat /etc/ld.so.conf.d/mysql-x86_64.conf

[root@slave ~]# cat /etc/ld.so.conf.d/mysql-x86_64.conf
/usr/lib64/mysql

进入文件夹/usr/lib64/mysql查看下有什么文件:
[root@slave ~]# ll /usr/lib64/mysql
总用量 3108
lrwxrwxrwx. 1 root root      26 9月  29 2013 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
-rwxr-xr-x. 1 root root 1595176 12月  8 2012 libmysqlclient_r.so.16.0.0
lrwxrwxrwx. 1 root root      24 9月  29 2013 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
-rwxr-xr-x. 1 root root 1582952 12月  8 2012 libmysqlclient.so.16.0.0
有一些软连接。并且带了后缀表示so.16之类的。可是没有so.18之类,看来是没有连接到这里,
可能是须要做一个软连接把/usr/local/mysql/lib/libmysqlclient.so.18变成/usr/lib64/libmysqlclient.so.18,
立即去做软连接:ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18,然后再check下。check成功例如以下所看到的:

[root@slave ~]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
[root@slave ~]#
[root@slave ~]#
[root@slave ~]# /usr/local/nagios/libexec/check_mysql --help
check_mysql v2.0 (nagios-plugins 2.0)
Copyright (c) 1999-2014 Nagios Plugin Development Team<devel@nagios-plugins.org>
This program tests connections to a MySQL server
Usage:check_mysql [-d database] [-H host] [-P port] [-s socket][-u user] [-p password] [-S] [-l] [-a cert] [-k key][-C ca-cert] [-D ca-dir] [-L ciphers] [-f optfile] [-g group]Options:-h, --helpPrint detailed help screen-V, --versionPrint version information--extra-opts=[section][@file]Read options from an ini file. Seehttps://www.nagios-plugins.org/doc/extra-opts.htmlfor usage and examples.
..................................
-l, --sslUse ssl encryptation-C, --ca-cert=STRINGPath to CA signing the cert-a, --cert=STRINGPath to SSL certificate-k, --key=STRINGPath to private SSL key-D, --ca-dir=STRINGPath to CA directory-L, --ciphers=STRINGList of valid SSL ciphers
.................................................
Send email to help@nagios-plugins.org if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
devel@nagios-plugins.org[root@slave ~]# 

5,继续运行check_mysql来check一下
[root@slave ~]# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -H127.0.0.1 --password='xxx@0512' /usr/local/mysql/mysql.sock -d test -w 60 -c 100
slave query error: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation
[root@slave ~]# 
报账号错误,
check
slave query error: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation
账号错误,进入mysql界面赋予nagios账号权限
mysql> GRANT PROCESS, SUPER, REPLICATION CLIENT ON *.* TO nagios@'%' identified by 'xxx@0512';

6。再check
[root@slave ~]# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -Hlocalhost --password='xxx@0512' -s /usr/local/mysql/mysql.sock -d test -w 60 -c 100
Slave IO: Yes Slave SQL: No Seconds Behind Master: (null)

mysql slave 检測失败。有错误信息:Slave IO: Yes Slave SQL: No Seconds Behind Master: (null)

进mysql窗体去看具体信息

[root@slave ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.6.12-log Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show slave status\G
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 10.xx.3.xxMaster_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.010294Read_Master_Log_Pos: 21764Relay_Log_File: mysql-relay-bin.003125Relay_Log_Pos: 91805Relay_Master_Log_File: mysql-bin.010275Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB: xx,xx_db,xxsystemReplicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1590Last_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary logSkip_Counter: 0Exec_Master_Log_Pos: 91642Relay_Log_Space: 1780004Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 1590Last_SQL_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary logReplicate_Ignore_Server_Ids: Master_Server_Id: 71Master_UUID: 9b0dcf62-29f4-11e3-9471-677b33903869Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Master_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: 140512 11:29:54Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0
1 row in set (0.00 sec)
mysql>

关于Slave IO: Yes Slave SQL: No Seconds Behind Master: (null),參考blog:  http://blog.csdn.net/mchdba/article/details/25738991

7,slave重做之后,再check,slave状态是正常的。

# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -s /usr/local/mysql/mysql.sock -Hlocalhost --password='xxx@0512' -d test -w 60 -c 100

[root@slave ~]# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -s /usr/local/mysql/mysql.sock -Hlocalhost --password='xxx@0512' -d test -w 60 -c 100
Uptime: 18431321  Threads: 3  Questions: 1447646  Slow queries: 735  Opens: 18605  Flush tables: 1  Open tables: 214  Queries per second avg: 0.078 Slave IO: Yes Slave SQL: Yes Seconds Behind Master: 0|Connections=1380c;;; Open_files=32;;; Open_tables=214;;; Qcache_free_memory=66980240;;; Qcache_hits=778c;;; Qcache_inserts=5338c;;; Qcache_lowmem_prunes=0c;;; Qcache_not_cached=12516c;;; Qcache_queries_in_cache=34;;; Queries=1447647c;;; Questions=99727c;;; Table_locks_waited=0c;;; Threads_connected=1;;; Threads_running=1;;; Uptime=18431321c;;; 'seconds behind master'=0.000000s;60.000000;100.000000;
[root@db-m1-slave-1 ~]# 

版权声明:本文博主原创文章。博客,未经同意不得转载。

转载于:https://www.cnblogs.com/yxwkf/p/4828451.html

Nagios显示器mysql定从库: libmysqlclient.so.18: cannot open shared object file: No such相关推荐

  1. mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No suc

    For Redhat Linux 8 try this: sudo yum install libncurses*

  2. 缺少动态连接库.so--cannot open shared object file: No such file or directory

    总结下来主要有3种方法: 1. 用ln将需要的so文件链接到/usr/lib或者/lib这两个默认的目录下边 ln -s /where/you/install/lib/*.so /usr/lib su ...

  3. nagios监控mysql(check_mysql)及内存使用率(check_mem)

    一.监控本地(localhost)内存 1.上传监控脚本 check_mem 到/usr/local/nagios/libexec # chown -R nagios.nagios check_mem ...

  4. MySQLdb ImportError: libmysqlclient.so.18 No Such File or Directory

    启动项目的时候,报了这个错误,如题所示,缺少libmysqlclient.so.18文件. 问题一: ImportError: libmysqlclient.so.18: cannot open sh ...

  5. nagios存入 mysql数据说明与提取_4.使用NDOUtils将Nagios监控信息存入数据库

    使用NDOUtils将Nagios监控信息存入数据库 1.NDOUtils安装需求: Nagios正确安装运行,版本>=2.0安装目录:/usr/local/nagios MySQL正确安装并运 ...

  6. 【原创】MySQL Connector/C 库的版本选择

          公司内部封装的的 dbi 库依赖于 mysql connector/c 库,但由于历史原因,其所依赖的  mysql connector/c 库的版本为原始的 v6.0.2 , 为了对此现 ...

  7. Ubuntu 安装MySQL报共享库找不到

    错误信息1: ./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: ...

  8. version libmysqlclient_18 not defined in file libmysqlclient.so.18 with link time reference

    在运行php -m时报错: PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli.so' (tried: /usr/lib ...

  9. 小记mysql备份同库中一张表的历史记录

    mysql备份同库中一张表的历史记录 insert into -select 需求 如今有个这么一个需求.mysql中有个表.数据增长的非常快.可是呢这个数据有效期也就是1个月,一个月曾经的记录不太重 ...

最新文章

  1. Exchange服务器系列课程之四--管理Exchange收件人
  2. 我理解的javascript事件循环(一)
  3. android 下载进度条代码实现,Android 文件下载进度条的实现
  4. 阿里科学家再获世界级荣誉,平头哥首席科学家谢源当选AAASFellow
  5. cocos2dx热更新tmx的一个坑
  6. SpringMVC由浅入深day01_1springmvc框架介绍
  7. Freemarker获取项目根目录
  8. html网络通信协议设计,智能家居无线网络通讯协议设计方案
  9. MySQL中int(11)最大长度是多少?
  10. 算法笔记_面试题_13.二叉树的最近公共祖先
  11. 应用电子计算机英文,应用电子技术英文介绍
  12. PDF文件怎么拆分,PDF拆分技巧
  13. C#做的一个简易图片浏览器
  14. android微信7,微信7.0安卓版之初体验
  15. android button 字母自动变大写的解决
  16. 模仿百度“您要找的是不是:”提示功能
  17. 奇迹按键精灵挂机脚本_奇迹脚本代码导入按键精灵后怎么使用?
  18. api接口 php_PHP关于API接口实例分享
  19. [Unity]实现按住WASD角色移动
  20. JAVA毕设项目家庭记账系统(java+VUE+Mybatis+Maven+Mysql)

热门文章

  1. android手机用户,[信息图]Android手机用户如何使用自己的设备?
  2. 广数系统u盘支持什么格式_u盘装系统,u盘要格式化成什么格式
  3. android动画view上移,在Android开发中使用View制作一个引导动画
  4. php get 数据类型,PHP基础-数据类型-integet
  5. python模块:运行机制与编写方法
  6. linux ipset 流量,linux中ipset命令的使用方法详解
  7. HTML+CSS+JS实现 ❤️ 粒子倒计时特效❤️
  8. mysql 正则替换 换行,MySQL中使用replace、regexp进行正则表达式替换的用法分析
  9. 小米游戏手柄pc插件_在电视上玩电脑游戏
  10. md5 java 工具类_Java实现一个MD5工具类