开源监控解决方案:ICINGA(Nagios)监控MYSQL Database

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开源监控解决方案:ICINGA(Nagios)监控MYSQL Database相关的知识,希望对你有一定的参考价值。

[[email protected] ~]# tar zxvf DBI-1.637.tar.gz
[[email protected] ~]# cd DBI-1.637
[[email protected] DBI-1.637]# perl Makefile.PL
[[email protected] DBI-1.637]# make all
[[email protected] DBI-1.637]# make install

[[email protected] ~]# tar zxvf DBD-mysql-4.043.tar.gz 
[[email protected] ~]# cd DBD-mysql-4.043cd DBD-mysql-4.043
[[email protected] DBD-mysql-4.043]# perl Makefile.PL 
[[email protected] DBD-mysql-4.043]# make all
[[email protected] DBD-mysql-4.043]# make install

[[email protected] ~]# tar zxvf check_mysql_health-2.2.2.tar.gz 
[[email protected] ~]# cd check_mysql_health-2.2.2
[[email protected] check_mysql_health-2.2.2]# ./configure --prefix=/usr/local/icinga --with-nagios-user=icinga --with-nagios-group=icinga
[[email protected] check_mysql_health-2.2.2]# make
[[email protected] check_mysql_health-2.2.2]# make install

[[email protected] ~]# cd /usr/local/icinga/libexec/
[[email protected] libexec]# ./check_mysql_health 
Please select a mode
Copyright (c) 2009 Gerhard Lausser


  Check various parameters of MySQL databases 

  Usage:
    check_mysql_health [-v] [-t <timeout>] [[--hostname <hostname>] 
        [--port <port> | --socket <socket>]
        --username <username> --password <password>] --mode <mode>
        [--method mysql]
    check_mysql_health [-h | --help]
    check_mysql_health [-V | --version]

  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)
    --replication-user
       the database's replication user name (default: replication)
    --warning
       the warning range
    --critical
       the critical range
    --mode
       the mode of the plugin. select one of the following keywords:
       connection-time          (Time to connect to the server)
       uptime                   (Time the server is running)
       threads-connected        (Number of currently open connections)
       threadcache-hitrate      (Hit rate of the thread-cache)
       threads-created          (Number of threads created per sec)
       threads-running          (Number of currently running threads)
       threads-cached           (Number of currently cached threads)
       connects-aborted         (Number of aborted connections per sec)
       clients-aborted          (Number of aborted connections (because the client died) per sec)
       slave-lag                (Seconds behind master)
       slave-io-running         (Slave io running: Yes)
       slave-sql-running        (Slave sql running: Yes)
       qcache-hitrate           (Query cache 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 cache hitrate)
       table-lock-contention    (Table lock contention)
       index-usage              (Usage of indices)
       tmp-disk-tables          (Percent of temp tables created on disk)
       table-fragmentation      (Show tables which should be optimized)
       open-files               (Percent of opened files)
       slow-queries             (Slow queries)
       long-running-procs       (long running processes)
       cluster-ndbd-running     (ndnd nodes are up and running)
       sql                      (any sql command returning a single number)

[[email protected] libexec]# ./check_mysql_health --hostname 192.168.1.203 --username nagios --password nagios --mode connection-time 
OK - 0.02 seconds to connect as nagios | connection_time=0.0169s;1;5

[[email protected] libexec]# ./check_mysql_health --hostname 192.168.1.203 --username nagios --password nagios --mode uptime
OK - database is up since 7542 minutes | uptime=452541s


以上是关于开源监控解决方案:ICINGA(Nagios)监控MYSQL Database的主要内容,如果未能解决你的问题,请参考以下文章

开源监控解决方案:ICINGA(Nagios)Email Notification

通过icinga2监控服务器的top(CPU)信息

icinga2通过check_hpasm监控HP服务器硬件报警

icinga2通过check_ping.pl插件生成可用性监控

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis介绍

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvisnagios+cacti整合