设为首页 收藏本站
查看: 1264|回复: 0

Nagios监控数据库

[复制链接]

尚未签到

发表于 2015-11-23 09:34:33 | 显示全部楼层 |阅读模式
  一、check_mysql_health监控数据库
  1、check_mysql_health安装
  在监控服务器上安装
  # cd /usr/local/src/tarbag
  # wget http://labs.consol.de/wp-content/uploads/2010/03/check_mysql_health-2.1.1.tar.gz
  # tar zxvf check_mysql_health-2.1.1.tar.gz -C ../software/
  # ./configure /
  --prefix=/usr/local/nagios/ /
  --with-nagios-user=nagios /
  --with-nagios-group=nagios /
  --with-perl=/usr/bin/perl /
  --with-statefiles-dir=/usr/local/nagios/var/tmp /
  --with-perl perl/ 程序运行路径
  --with-statefiles-dir 状态信息文件路径
  # make
  # make install
  2、check_mysql_health选项
  Options:
  --hostname
  the database server's hostname
  --port
  the database's port. (default: 3306)
  --socket
  the database's unix socket.
  --username
  the mysql db user
  --password
  the mysql db user's password
  --database
  the database's name. (default: information_schema)
  --warning
  the warning range
  --critical
  the critical range
  --mode
  the mode of the plugin. select one of the following keywords:
  connection-time 连接到服务器上的时间
  uptime 服务器运行的时间
  threads-connected 当前连接到数据库的连接数
  threadcache-hitrate 线程缓存命中率
  slave-lag slave落后master多少时间
  slave-io-running slave复制是否正常
  slave-sql-running slave复制是否正常
  qcache-hitrate 查询缓存命中率
  qcache-lowmem-prunes (Query cache entries pruned because of low memory)
  keycache-hitrate (MyISAM key cache hitrate)
  bufferpool-hitrate (InnoDB buffer pool hitrate)
  bufferpool-wait-free (InnoDB buffer pool waits for clean page available)
  log-waits (InnoDB log waits because of a too small log buffer)
  tablecache-hitrate 表缓存命中率
  table-lock-contention 表锁率
  index-usage 索引使用情况
  tmp-disk-tables (Percent of temp tables created on disk)
  slow-queries 慢查询
  long-running-procs 长时间运行的进程
  cluster-ndbd-running ndb节点运行状况
  sql 返回一个数字的任何SQL语句
  3、check_mysql_health监控配置
  监控服务器:10.59.97.42
  MySQL数据授权:
  在要监控的MySQL数据库服务器上
  mysql> grant usage on *.* to honyho@10.59.97.42 identified by "honyho@8123";
  mysql> flush privileges;
  在监控服务器上
  1》查看当前连接到数据库的连接数
  #./check_mysql_health --hostname 10.59.97.57 --username honyho --password honyho@8123 --mode threads-connected
  OK - 3 client connection threads | threads_connected=3;10;20
  threads_connected=3;10;20
  3表示连接数
  10 表示warning阀值(默认)
  20 表示critical阀值(默认)
  Nagios相关配置
  1》配置commands.cfg文件
  define command{
  command_name check_mysql_health
  command_line $USER1$/check_mysql_health --hostname $ARG1$ --username $ARG2$ --password $ARG3$ --warning $ARG4$ --critical $ARG5$ --mode $ARG6$
  }
  2》配置121_207_231_17.cfg文件
  define service{
  use local-service
  host_name 121.207.231.17
  service_description threads-connected
  check_command check_mysql_health!10.59.97.57!honyho!honyho@8123!1000!1500!threads-connected
  }
  -----------------------------------------------------------
  二、nagios-mysql-plugins插件监控数据库
  一、安装此插件
  #wget 北北没有给地址
  #tar zxvf nagios-mysql-plugins-0.3.tar.gz -C ../software/
  #cd nagios-mysql-plugins-0.3
  #chmod +x *mysql*
  二、插件内容
  check_db_mysql.pl 检测mysql是否运行
  check_errorlog_mysql.pl 检测mysql数据库错误日志
  check_repl_mysql_cnt_slave_hosts.pl 统计连接到从主机数
  check_repl_mysql_heartbeat.pl 检测心跳 (安装完默认名字是check_repl_mysql_hearbeat.pl)
  check_repl_mysql_io_thread.pl 检测IO线程
  check_repl_mysql_read_exec_pos.pl
  check_repl_mysql_readonly.pl 检测从是否设置为只读
  check_repl_mysql_seconds_behind_master.pl检测从多少时间与主同步
  check_repl_mysql_sql_thread.pl 检测SQL线程
  perf_mysql.pl 收集性能数据
  perf_mysql.pl -m
  connections,
  thread_cache,
  network_traffic,
  queries,query_cache,
  myisam_key_buffer,
  table_cache,
  temporary_tables,
  tables,
  slow_queries,
  bin_log,uptime,
  innodb_buffer_pool,
  innodb_buffer_pool_io,
  innodb_io,innodb_data,
  innodb_logfile,
  innodb_row_locking,
  innodb_queries

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-142434-1-1.html 上篇帖子: 网络监控软件Nagios 下篇帖子: Nagios3.0 NRPE 安装 监控远程Linux服务
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表