check mysql health_check_mysql_health 监控mysql 服务器

萧萧迟
2023-12-01

check_mysql_health 监控mysql 服务器

/usr/local/nagios/libexec/custom/check_mysql_health --hostname localhost --socket /tmp/mysql.sock --username root --password xxxxxx --mode xxxxx --warning xxxxx --criticalxxxxx

mode:

connection-time (Time to connect to the server)

uptime (Time the server is running)

threads-connected (Number of currently open connections)

threadcache-hitrate (线程缓存命中率)

slave-lag (Seconds behind master)

slave-io-running (Slave io running: Yes)

slave-sql-running (Slave sql running: Yes)

qcache-hitrate (查询命中率,如果这个值接近100%,说明服务器select的优化就越好)

qcache-lowmem-prunes (因为内存小,从内存删除缓存查询的数量,可以增大query_cache_size,减小lowmem,增加命中率的优化)

keycache-hitrate (MyISAM key 缓存命中率,如果命中率太低,增大key_buffer_size)

bufferpool-hitrate (InnoDB 缓冲池命中率)

bufferpool-wait-free (InnoDB 缓冲池等待清理的页面)

log-waits (InnoDB log 等待写入时间,如果这个等待时间太大,增大log缓冲池大小)

tablecache-hitrate (Table 缓存命中率)

table-lock-contention (Table 的lock率)

index-usage (索引使用率,越大说明索引越好,越小说明索引优化不充分)

tmp-disk-tables (临时表创建的数量)

slow-queries (慢查询占所有查询的比率,这个值如果很高说明mysql数据库优化不够)

long-running-procs (长期运行的进程)

cluster-ndbd-running (mysql集群监控)

sql (执行一个返回一个数字的SQL,检查mysql是否可以链接查询)

 类似资料: