CN105095496A - Method for monitoring MYSQL table space through ZABBIX - Google Patents

Method for monitoring MYSQL table space through ZABBIX Download PDF

Info

Publication number
CN105095496A
CN105095496A CN201510521181.7A CN201510521181A CN105095496A CN 105095496 A CN105095496 A CN 105095496A CN 201510521181 A CN201510521181 A CN 201510521181A CN 105095496 A CN105095496 A CN 105095496A
Authority
CN
China
Prior art keywords
size
mysql
database
name
zabbix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510521181.7A
Other languages
Chinese (zh)
Inventor
周庆勇
付迅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Software Co Ltd
Original Assignee
Inspur Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Software Co Ltd filed Critical Inspur Software Co Ltd
Priority to CN201510521181.7A priority Critical patent/CN105095496A/en
Publication of CN105095496A publication Critical patent/CN105095496A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Storage Device Security (AREA)

Abstract

The invention provides a method for monitoring an MYSQL table space through a ZABBIX. The method includes the following steps of transmitting parameters including an MYSQL user name, an MYSQL password, a database name and a table name to a mysqlsize.sh script by establishing a monitoring item with the key value of mysql.schema.size, and transmitting the data to the ZABBIX and writing the data in a database after the script obtains the data. Compared with the prior art, the method has the advantages that the total size of all MYSQL tables on any server in a cluster, the sizes of all tables of a certain database and the size of a certain table in a certain database can be monitored in real time and displayed on a Web interface in real time, and when the size of the table space exceeds a designated size, warning information is produced and a user is reminded. The method further has the advantages of being reasonable in concept, convenient to use, capable of saving labor, high in intelligent degree and the like, and has quite good use value.

Description

A kind of method being monitored MYSQL table space by ZABBIX
Technical field
The present invention relates to computer automation O&M and monitoring field, specifically a kind of method being monitored MYSQL table space by ZABBIX.
Background technology
Along with the sustainable development of information age, IT O&M has become ingredient important in IT service connotation.In the face of the business that becomes increasingly complex, in the face of more and more diversified user's request, the IT application of constantly expansion need more and more reasonably pattern ensure IT service can flexibly convenient, continue guarantee with security and stability, the security factors in this pattern is exactly IT O&M.Huge data center is developed into from several station servers at initial stage, depend merely on the requirement that manually cannot meet in technology, business, management etc., the factor that so standardization, robotization, framework optimization, process optimization etc. reduce IT cost of serving is more and more valued by the people.Multiple stage mysql database server is often had in a cluster, multiple database is had again in each mysql, multiple are had again to show in each database, cause hydraulic performance decline to prevent overabundance of data or write by hard disk completely causing normally running, carrying out monitoring in real time to mysql table space size is very necessary work.Zabbix is the solution of increasing income providing the enterprise-level of distributed system supervision and network monitoring function at a sing on web interface.The present invention is based on zabbix to expand.Web system due to zabbix has a lot of drawback, so adopt Spring, iBatis, JSP, Highcharts to develop a set of new Web system.
Summary of the invention
The object of the invention is to overcome the deficiencies in the prior art, a kind of method being monitored MYSQL table space by ZABBIX is provided.
Technical scheme of the present invention realizes in the following manner, and its method is as follows:
In zabbix system, find the database server that will monitor, create a new monitored item, type is " Zabbix agency ", and key assignments is mysql.schema.size [mysql user name, mysql password, database name, table name];
Be divided three classes from the different of table name according to database name:
(1), when parameter " database name " is " all ", parameter " table name " is invalid, means the size of all tables of whole mysql, such as: mysql.schema.size [root, root, all];
(2), when parameter " database name " is not " all ", total size of all tables under meaning this database when parameter " table name " is " all ", such as: mysql.schema.size [root, root, cmp, all], i.e. total size of all tables of cmp database;
(3), when parameter " database name " and " table name ", under meaning this database time " all ", certain does not open the size shown, such as: mysql.schema.size [root, root, zabbix, history], i.e. the size of the history table of zabbix database;
Amendment zabbix_agentd.conf configuration file, add UserParameter=mysql.schema.size [*], / usr/local/zabbix/plugins/mysqlsize.sh $ 1 $ 2 $ 3 $ 4, wherein mysql.schema.size [*] is the key assignments of the new monitored item created, mysqlsize.sh is the shell script collecting table size, $ 1 $ 2 $ 3 $ 4 correspond to four parameters of monitored item mysql.schema.size respectively: mysql user name, mysql password, database name, table name;
Timeout value in configuration file is set to 10 or larger, because be defaulted as 3 seconds, and the time that mysqlsize.sh performs once is often greater than 3 seconds, and the execution time that Timeout value must be greater than mysqlsize.sh just can normally perform;
Mysqlsize.sh code is as follows:
#!/bin/bash
user=$1
password=$2
dbname=$3
tablename=$4
Total size of all databases under if [$ dbname==" all "] # inquiry mysql
then
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLES;")
echo$size
else
Total size of all tables under if [$ tablename==" all "] # Query Database $ dbname
then
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLES
WHERETABLE_SCHEMA='$dbname';")
echo$size
The size that $ tablename under else## Query Database $ dbname shows
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLESWHERETABLE_SCHEMA='$dbname'ANDTABLE_NAME='$tablename';")
echo$size
fi
fi
After $ 1 $ 2 $ 3 $ 4 is passed to mysqlsize.sh by Zabbix system, this script can log in mysql according to user name ($ 1) and password ($ 2), then inquire about according to database name ($ 3) and table name ($ 4), finally result is returned to zabbix, then write the database of zabbix.
Advantage of the present invention is:
A kind of method by ZABBIX monitoring MYSQL table space of the present invention compared to the prior art, the size that in cluster, on any server, in total size of all tables of mysql, the size of all tables of certain database and certain database, certain is shown can be monitored in real time, and show in real time on Web interface, produce warning information reminding user when table space exceeds and specifies size.And the present invention also has reasonable idea, easy to use, saving manpower, intelligence degree high, thus has good use value.
Embodiment
Below a kind of method by ZABBIX monitoring MYSQL table space of the present invention is described in detail below.
A kind of method being monitored MYSQL table space by ZABBIX of the present invention, method is as follows:
The database server that will monitor is found in zabbix system, create a new monitored item (item), type is " Zabbix acts on behalf of (passive type) ", key assignments (key) is mysql.schema.size [mysql user name, mysql password, database name, table name].
Be divided three classes from the different of table name according to database name:
1. when parameter " database name " is " all ", parameter " table name " is invalid, means the size of all tables of whole mysql, such as: mysql.schema.size [root, root, all];
2. when parameter " database name " is not " all ", total size of all tables under meaning this database when parameter " table name " is " all ", such as: mysql.schema.size [root, root, cmp, all], i.e. total size of all tables of cmp database;
3. when parameter " database name " and " table name ", under meaning this database time " all ", certain does not open the size shown, such as: mysql.schema.size [root, root, zabbix, history], i.e. and the size of the history table of zabbix database.
Amendment zabbix_agentd.conf configuration file, add UserParameter=mysql.schema.size [*], / usr/local/zabbix/plugins/mysqlsize.sh $ 1 $ 2 $ 3 $ 4, wherein mysql.schema.size [*] is the key assignments of the new monitored item created, mysqlsize.sh is the shell script collecting table size, $ 1 $ 2 $ 3 $ 4 correspond to four parameters of monitored item mysql.schema.size respectively: mysql user name, mysql password, database name, table name.Timeout value in configuration file is set to 10 or larger, because be defaulted as 3 seconds, and the time that mysqlsize.sh performs once is often greater than 3 seconds, and the execution time that Timeout value must be greater than mysqlsize.sh just can normally perform.
Mysqlsize.sh code is as follows:
#!/bin/bash
user=$1
password=$2
dbname=$3
tablename=$4
Total size of all databases under if [$ dbname==" all "] # inquiry mysql
then
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLES;")
echo$size
else
Total size of all tables under if [$ tablename==" all "] # Query Database $ dbname
then
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLES
WHERETABLE_SCHEMA='$dbname';")
echo$size
The size that $ tablename under else## Query Database $ dbname shows
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLESWHERETABLE_SCHEMA='$dbname'ANDTABLE_NAME='$tablename';")
echo$size
fi
fi
After $ 1 $ 2 $ 3 $ 4 is passed to mysqlsize.sh by Zabbix system, this script can log in mysql according to user name ($ 1) and password ($ 2), then inquire about according to database name ($ 3) and table name ($ 4), finally result is returned to zabbix, then write the database of zabbix.
A kind of its processing and fabricating of method by ZABBIX monitoring MYSQL table space of the present invention is very simple and convenient, can process to specifications.
Except the technical characteristic described in instructions, be the known technology of those skilled in the art.

Claims (1)

1. monitored a method for MYSQL table space by ZABBIX, it is characterized in that method is as follows:
In zabbix system, find the database server that will monitor, create a new monitored item, type is " Zabbix agency ", and key assignments is mysql.schema.size [mysql user name, mysql password, database name, table name];
Be divided three classes from the different of table name according to database name:
(1), when parameter " database name " is " all ", parameter " table name " is invalid, means the size of all tables of whole mysql, such as: mysql.schema.size [root, root, all];
(2), when parameter " database name " is not " all ", total size of all tables under meaning this database when parameter " table name " is " all ", such as: mysql.schema.size [root, root, cmp, all], i.e. total size of all tables of cmp database;
(3), when parameter " database name " and " table name ", under meaning this database time " all ", certain does not open the size shown, such as: mysql.schema.size [root, root, zabbix, history], i.e. the size of the history table of zabbix database;
Amendment zabbix_agentd.conf configuration file, add UserParameter=mysql.schema.size [*], / usr/local/zabbix/plugins/mysqlsize.sh $ 1 $ 2 $ 3 $ 4, wherein mysql.schema.size [*] is the key assignments of the new monitored item created, mysqlsize.sh is the shell script collecting table size, $ 1 $ 2 $ 3 $ 4 correspond to four parameters of monitored item mysql.schema.size respectively: mysql user name, mysql password, database name, table name;
Timeout value in configuration file is set to 10 or larger, because be defaulted as 3 seconds, and the time that mysqlsize.sh performs once is often greater than 3 seconds, and the execution time that Timeout value must be greater than mysqlsize.sh just can normally perform;
Mysqlsize.sh code is as follows:
#!/bin/bash
user=$1
password=$2
dbname=$3
tablename=$4
Total size of all databases under if [$ dbname==" all "] # inquiry mysql
then
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLES;")
echo$size
else
Total size of all tables under if [$ tablename==" all "] # Query Database $ dbname
then
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLES
WHERETABLE_SCHEMA='$dbname';")
echo$size
The size that $ tablename under else## Query Database $ dbname shows
size=$(mysql-u${user}-p${password}-Dinformation_schema-BN-e
"SELECTSUM(DATA_LENGTH+INDEX_LENGTH)FROMTABLESWHERETABLE_SCHEMA='$dbname'ANDTABLE_NAME='$tablename';")
echo$size
fi
fi
After $ 1 $ 2 $ 3 $ 4 is passed to mysqlsize.sh by Zabbix system, this script can log in mysql according to user name ($ 1) and password ($ 2), then inquire about according to database name ($ 3) and table name ($ 4), finally result is returned to zabbix, then write the database of zabbix.
CN201510521181.7A 2015-08-24 2015-08-24 Method for monitoring MYSQL table space through ZABBIX Pending CN105095496A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510521181.7A CN105095496A (en) 2015-08-24 2015-08-24 Method for monitoring MYSQL table space through ZABBIX

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510521181.7A CN105095496A (en) 2015-08-24 2015-08-24 Method for monitoring MYSQL table space through ZABBIX

Publications (1)

Publication Number Publication Date
CN105095496A true CN105095496A (en) 2015-11-25

Family

ID=54575931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510521181.7A Pending CN105095496A (en) 2015-08-24 2015-08-24 Method for monitoring MYSQL table space through ZABBIX

Country Status (1)

Country Link
CN (1) CN105095496A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105656685A (en) * 2016-02-26 2016-06-08 浪潮通信信息系统有限公司 Automatic deployment and operation and maintenance monitoring method based on zabbix system oracle
CN107179977A (en) * 2017-05-10 2017-09-19 杭州铭师堂教育科技发展有限公司 Database Full-automatic monitoring system based on mpm models
CN108062272A (en) * 2017-11-06 2018-05-22 福建省天奕网络科技有限公司 A kind of quick-fried table detection method of database and terminal
CN109327343A (en) * 2018-11-27 2019-02-12 武汉烽火信息集成技术有限公司 Automation method for inspecting and system for openstack cloud environment
WO2019242123A1 (en) * 2018-06-20 2019-12-26 平安科技(深圳)有限公司 Method for monitoring database directory, storage medium, terminal device and apparatus
WO2020006868A1 (en) * 2018-07-06 2020-01-09 平安科技(深圳)有限公司 Automatic alarm method and apparatus for tablespace, terminal device and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100131928A1 (en) * 2008-11-21 2010-05-27 Sun Microsystems, Inc. Automated testing and qualification of software-based, network service products
CN103605722A (en) * 2013-11-15 2014-02-26 北京奇虎科技有限公司 Method, device and equipment for database monitoring
CN104579840A (en) * 2015-01-08 2015-04-29 浪潮软件集团有限公司 ZABBIX-based network monitoring system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100131928A1 (en) * 2008-11-21 2010-05-27 Sun Microsystems, Inc. Automated testing and qualification of software-based, network service products
CN103605722A (en) * 2013-11-15 2014-02-26 北京奇虎科技有限公司 Method, device and equipment for database monitoring
CN104579840A (en) * 2015-01-08 2015-04-29 浪潮软件集团有限公司 ZABBIX-based network monitoring system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
APANGHUANG159: "《mysql批量操作数据库、查数据库大小》", 《HTTP://WWW.DOC88.COM/P-9169441411870.HTML》 *
HTRCLN: "Zabbix2.0使用手册", 《HTTPS://WENKU.BAIDU.COM/VIEW/A2210C4BA21614791711287D.HTML?FROM=SEARCH》 *
庸人自扰104: "怎样查看Mysql数据库大小", 《HTTPS://ZHIDAO.BAIDU.COM/QUESTION/585022540.HTML》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105656685A (en) * 2016-02-26 2016-06-08 浪潮通信信息系统有限公司 Automatic deployment and operation and maintenance monitoring method based on zabbix system oracle
CN107179977A (en) * 2017-05-10 2017-09-19 杭州铭师堂教育科技发展有限公司 Database Full-automatic monitoring system based on mpm models
CN107179977B (en) * 2017-05-10 2018-07-17 杭州铭师堂教育科技发展有限公司 Database Full-automatic monitoring system based on mpm models
CN108062272A (en) * 2017-11-06 2018-05-22 福建省天奕网络科技有限公司 A kind of quick-fried table detection method of database and terminal
WO2019242123A1 (en) * 2018-06-20 2019-12-26 平安科技(深圳)有限公司 Method for monitoring database directory, storage medium, terminal device and apparatus
WO2020006868A1 (en) * 2018-07-06 2020-01-09 平安科技(深圳)有限公司 Automatic alarm method and apparatus for tablespace, terminal device and readable storage medium
CN109327343A (en) * 2018-11-27 2019-02-12 武汉烽火信息集成技术有限公司 Automation method for inspecting and system for openstack cloud environment

Similar Documents

Publication Publication Date Title
CN105095496A (en) Method for monitoring MYSQL table space through ZABBIX
US11941017B2 (en) Event driven extract, transform, load (ETL) processing
TWI698108B (en) Blockchain-based data processing method and device
CN105357311B (en) A kind of storage of secondary device big data and processing method of cloud computing technology
Yamamoto et al. Using cloud technologies for large-scale house data in smart city
CN105183860B (en) Method of data synchronization and system
CN111881223B (en) Data management method, device, system and storage medium
US20190050435A1 (en) Object data association index system and methods for the construction and applications thereof
CN109144785A (en) Method and apparatus for Backup Data
CN104881506A (en) Configurable management information system right control method based on database
CN114218218A (en) Data processing method, device and equipment based on data warehouse and storage medium
CN112163026A (en) Multi-source heterogeneous interface management and control method for integrating multi-class technical application data
CN108228756A (en) Data based on the PG databases of daily record analytic technique to Hadoop platform synchronize clone method
CN107203639A (en) Parallel file system based on High Performance Computing
CN113177088B (en) Multi-scale simulation big data management system for material irradiation damage
CN109165262A (en) Fragmentation clustering system and fragmentation method of relational large table
Lee et al. A big data management system for energy consumption prediction models
CN111125226B (en) Configuration data acquisition method and device
CN104991849A (en) Method for monitoring system resources occupied by Linux process through zabbix
CN110674080A (en) Method and system for collecting large-data-volume non-structural files based on NiFi
CN105608190B (en) Collaborative data processing method and system
CN115168474A (en) Internet of things center station system building method based on big data model
CN115757642A (en) Data synchronization method and device based on filing log file
CN105429795A (en) Alarm monitoring system and method
CN109815081A (en) The long range acquisition method and collection device of database performance

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20151125

WD01 Invention patent application deemed withdrawn after publication