开源监控解决方案:icinga(nagios)监控mysql database
2018-08-07 15:26
615 查看
[root@wxhmdb ~]# mysql -uroot -pabcd.1234 mysql> create user 'nagios'@'%' identified by 'nagios'; Query OK, 0 rows affected (0.07 sec) [root@wxhmdb ~]# mysql -unagios -pnagios mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | +--------------------+ 1 row in set (0.00 sec) [root@nagios ~]# tar zxvf DBI-1.637.tar.gz [root@nagios ~]# cd DBI-1.637 [root@nagios DBI-1.637]# perl Makefile.PL [root@nagios DBI-1.637]# make all [root@nagios DBI-1.637]# make install [root@nagios ~]# tar zxvf DBD-mysql-4.043.tar.gz [root@nagios ~]# cd DBD-mysql-4.043cd DBD-mysql-4.043 [root@nagios DBD-mysql-4.043]# perl Makefile.PL [root@nagios DBD-mysql-4.043]# make all [root@nagios DBD-mysql-4.043]# make install [root@nagios ~]# tar zxvf check_mysql_health-2.2.2.tar.gz [root@nagios ~]# cd check_mysql_health-2.2.2 [root@nagios check_mysql_health-2.2.2]# ./configure --prefix=/usr/local/icinga \ --with-nagios-user=icinga \ --with-nagios-group=icinga [root@nagios check_mysql_health-2.2.2]# make [root@nagios check_mysql_health-2.2.2]# make install [root@nagios ~]# cd /usr/local/icinga/libexec/ [root@nagios 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 b60 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 &nbs 2d98 p;(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) [root@nagios 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 [root@nagios libexec]# ./check_mysql_health --hostname 192.168.1.203 --username nagios --password nagios --mode uptime OK - database is up since 7542 minutes | uptime=452541s [root@nagios ~]# cd /usr/local/icinga/etc/objects [root@nagios objects]# vi commands.cfg define command{ command_name check_mysql command_line $USER1$/check_mysql_health --hostname $ARG1$ --username nagios --password nagios --mode $ARG2$ } [root@nagios objects]# vi mysql.cfg # define a host define host{ use linux-server host_name wxhmdb alias wxhmdb icon_image redhat.gif statusmap_image redhat.gd2 address 192.168.1.203 } # define an hostgroup define hostgroup{ hostgroup_name sale-mysql alias database members wxhmdb } # define an servicegroup define servicegroup { servicegroup_name mysql alias database } # Define a service define service{ hostgroup_name sale-mysql use generic-service service_description alive servicegroups ping check_command check_ping!100.0,20%!500.0,60% } define service{ hostgroup_name sale-mysql use generic-service service_description os cpu usage servicegroups os check_command check_nrpe!check_cpu } define service{ hostgroup_name sale-mysql use generic-service service_description os memory usage servicegroups os check_command check_nrpe!check_memory } define service{ hostgroup_name sale-mysql use generic-service service_description os disk usage servicegroups os check_command check_nrpe!check_disk } define service{ hostgroup_name sale-mysql use generic-service service_description os network usage servicegroups os check_command check_nrpe!check_network } define service{ hostgroup_name sale-mysql use generic-service service_description os uptime servicegroups os check_command check_nrpe!check_uptime } define service{ host_name wxhmdb use &n 27e4 bsp; generic-service service_description mysql connection time servicegroups mysql check_command check_mysql!192.168.1.203!connection-time } define service{ host_name wxhmdb use generic-service service_description mysql uptime servicegroups mysql check_command check_mysql!192.168.1.203!uptime } [root@nagios ~]# cd /usr/local/icinga/etc [root@nagios etc]# vi icinga.cfg cfg_file=/usr/local/icinga/etc/objects/mysql.cfg [root@nagios objects]# service icinga restart Running configuration check...OK Stopping Icinga: Waiting for icinga to exit ..Stopping icinga done. Starting icinga: Starting icinga done.
相关文章推荐
- 开源监控解决方案:icinga(nagios)email notification
- 开源监控解决方案:zabbix 监控mysql database(fpmmm)
- 开源监控解决方案:zabbix 监控mysql database(Golang)
- 开源监控解决方案nagios+pnp4nagios+nconf+ndoutils整合部署
- 开源监控解决方案nagios+pnp4nagios+nconf+ndoutils整合部署 推荐
- nagios中自己写的监控mysql主从复制的插件
- 三大开源运维监控工具zabbix、nagios、open-falcon优缺点比较
- 【转】手把手实现企业级开源监控软件cacti+nagios+ntop整合(图解)
- Mysql查询缓存碎片、缓存命中率及Nagios监控
- Nagios之MySQL单机与主从监控
- 监控利器Nagios之一:监控本地NFS和外部HTTP、MySQL服务
- 开源监控系统整合Nagios+Cacti+Nconf
- LINUX开源监控平台Nagios(主机监控配置)
- nagios监控mysql集群脚本
- mysql database 性能监控工具:mysqltuner.pl
- Mysql实现监控数据统计分析:Druid开源分布式系统与阿里巴巴的Druid数据库连接池
- nagios监控mysql
- nagios 监控 mysql 主从同步状态
- about-开源监控nagios.
- 【nagios】监控mysql主从复制