CN109669835B - MySQL database monitoring method, device, equipment and readable storage medium - Google Patents

MySQL database monitoring method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN109669835B
CN109669835B CN201811090617.1A CN201811090617A CN109669835B CN 109669835 B CN109669835 B CN 109669835B CN 201811090617 A CN201811090617 A CN 201811090617A CN 109669835 B CN109669835 B CN 109669835B
Authority
CN
China
Prior art keywords
monitoring
database
alarm
mysql database
host
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.)
Active
Application number
CN201811090617.1A
Other languages
Chinese (zh)
Other versions
CN109669835A (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811090617.1A priority Critical patent/CN109669835B/en
Publication of CN109669835A publication Critical patent/CN109669835A/en
Application granted granted Critical
Publication of CN109669835B publication Critical patent/CN109669835B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a MySQL database monitoring method, which comprises the following steps: when a database monitoring request is received, configuring a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set; logging in a target MySQL database host according to the host IP in the current monitoring template set, and executing monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host; and determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and executing database alarm operation when the database alarm instruction is triggered. The invention also provides a MySQL database monitoring device, equipment and a readable storage medium. The invention can improve the monitoring efficiency and the applicability of the MySQL database.

Description

MySQL database monitoring method, device, equipment and readable storage medium
Technical Field
The invention relates to the technical field of database monitoring, in particular to a MySQL database monitoring method, a MySQL database monitoring device, MySQL database monitoring equipment and a readable storage medium.
Background
In the running process of the MySQL database, the running state of the MySQL database needs to be monitored in real time, including monitoring of connection conditions, throughput, execution performance, buffer pool use conditions and the like, the running abnormity and resource consumption condition of the MySQL database are found in real time, and a user can be quickly reminded when the MySQL database runs abnormally.
Currently, the monitoring mode of the MySQL database is single monitoring, that is, a maintenance operator configures each monitoring item separately through a server platform, and executes the monitoring item in a corresponding MySQL database host after configuration, however, in the MySQL database monitoring, multiple monitoring items are often needed for different indexes, the maintenance operator needs to configure multiple single monitoring items in parallel to realize multiple monitoring, and the MySQL database used under different application systems needs to configure different strategies, so that the monitoring efficiency of the MySQL database is low, and the applicability is low.
Therefore, how to improve the monitoring efficiency and the applicability of the MySQL database is a problem to be solved urgently at present.
Disclosure of Invention
The invention mainly aims to provide a MySQL database monitoring method, a MySQL database monitoring device, MySQL database monitoring equipment and a readable storage medium, and aims to improve the MySQL database monitoring efficiency and applicability.
In order to achieve the above object, the present invention provides a MySQL database monitoring method, which comprises the following steps:
when a database monitoring request is received, configuring a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set;
logging in a target MySQL database host according to the host IP in the current monitoring template set, and executing monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host;
and determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and executing database alarm operation when the database alarm instruction is triggered.
Optionally, the step of configuring a preset monitoring template set according to the database monitoring data in the database monitoring request to obtain a current monitoring template set includes:
reading database monitoring data from the database monitoring request, and acquiring an identification field of each monitoring parameter in a preset monitoring template set;
acquiring corresponding configuration information of each monitoring parameter from the database monitoring data according to the identification field of each monitoring parameter;
and configuring each monitoring parameter in a preset monitoring template set according to the corresponding configuration information of each monitoring parameter so as to obtain the current monitoring template set.
Optionally, the step of logging in the target MySQL database host according to the host IP in the current monitoring template set includes:
reading a host IP from the current monitoring template set, and acquiring a login password of a target MySQL database host according to the host IP;
and logging in the corresponding target MySQL database host according to the login password.
Optionally, the step of determining whether to trigger the database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item includes:
judging whether at least one monitoring index is abnormal in each monitoring index in the monitoring result information of each monitoring item;
and if at least one monitoring index in the monitoring result information of each monitoring item is abnormal, triggering a database alarm instruction.
Optionally, the step of performing a database alarm operation includes:
determining the alarm level of a database according to each monitoring index in the monitoring result information;
and determining a target alarm mode according to the alarm level of the database, and executing corresponding database alarm operation according to the target alarm mode.
Optionally, according to the alarm manner, the step of executing the corresponding database alarm operation includes:
and when the target alarm mode is a telephone alarm, dialing an alarm call to the corresponding alarm contact according to the alarm notification sequence of each alarm contact in the preset alarm contact tree until the alarm call is answered.
Optionally, the step of logging in the target MySQL database host according to the host IP in the current monitoring template set includes:
determining a target MySQL database host according to the host IP in the current monitoring template set;
judging whether the firewall strategies of the target MySQL database host and the local machine are opened or not;
if the firewall policy of the target MySQL database host computer is not opened, executing firewall policy opening operation until the firewall policy of the target MySQL database host computer is opened;
and acquiring a login password of the target MySQL database host according to the host IP, and logging in the corresponding target MySQL database host according to the login password.
In addition, in order to achieve the above object, the present invention further provides a MySQL database monitoring device, which includes:
the system comprises a configuration module, a monitoring module and a monitoring module, wherein the configuration module is used for configuring a preset monitoring template set according to database monitoring data in a database monitoring request when the database monitoring request is received so as to obtain a current monitoring template set;
the execution module is used for logging in a target MySQL database host according to the host IP in the current monitoring template set and executing the monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host;
and the alarm module is used for acquiring monitoring result information of each monitoring item, determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information, and executing database alarm operation when the database alarm instruction is triggered.
In addition, in order to achieve the above object, the present invention further provides a MySQL database monitoring device, which includes a processor, a memory, and a MySQL database monitoring program stored on the memory and executable by the processor, wherein when the MySQL database monitoring program is executed by the processor, the steps of the MySQL database monitoring method are implemented.
In addition, in order to achieve the above object, the present invention further provides a readable storage medium, where the readable storage medium stores a MySQL database monitoring program, and when the MySQL database monitoring program is executed by a processor, the steps of the MySQL database monitoring method are implemented.
The invention provides a MySQL database monitoring method, device, equipment and readable storage medium, when receiving a database monitoring request, configuring a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set, then logging in a target MySQL database host according to a host IP in the current monitoring template set, executing monitoring SQL sentences of each monitoring item in the current monitoring template set in the target MySQL database host, finally determining whether to trigger a database alarm instruction according to each monitoring index in monitoring result information of each monitoring item, if the database alarm instruction is triggered, executing database alarm operation, and by setting the monitoring template set, an operation and maintenance person can realize multiple monitoring of the MySQL database only through simple configuration, the method and the system perform database alarm operation, effectively improve the monitoring efficiency and the applicability of the MySQL database, and are convenient for quickly and timely giving an alarm when the database is abnormal.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of a MySQL database monitoring device according to embodiments of the present invention;
FIG. 2 is a schematic flow chart of a MySQL database monitoring method according to a first embodiment of the invention;
FIG. 3 is a flowchart illustrating a MySQL database monitoring method according to a second embodiment of the invention;
fig. 4 is a functional module diagram of the MySQL database monitoring apparatus according to the first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
The MySQL database monitoring method related by the embodiment of the invention is mainly applied to MySQL database monitoring equipment which can be equipment with display and processing functions, such as a PC (personal computer), a portable computer, a mobile terminal and the like.
Referring to fig. 1, fig. 1 is a schematic diagram of a hardware structure of a MySQL database monitoring device according to an embodiment of the present invention. In this embodiment of the present invention, the MySQL database monitoring apparatus may include a processor 1001 (e.g., a Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used for realizing connection communication among the components; the user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface); the memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as a disk memory, and the memory 1005 may optionally be a storage device separate from the processor 1001. Those skilled in the art will appreciate that the hardware configuration depicted in FIG. 1 is not intended to be limiting of the present invention, and may include more or less components than those shown, or some components in combination, or a different arrangement of components.
With continued reference to fig. 1, the memory 1005 of fig. 1, which is one type of readable storage medium, may include an operating system, a network communication module, and a MySQL database monitor. In fig. 1, the network communication module is mainly used for connecting to a server and performing data communication with the server; the processor 1001 may call the MySQL database monitoring program stored in the memory 1005, and execute the steps of the MySQL database monitoring method provided by the embodiment of the present invention.
The embodiment of the invention provides a MySQL database monitoring method.
Referring to fig. 2, fig. 2 is a schematic flow chart of a MySQL database monitoring method according to a first embodiment of the present invention.
In this embodiment, the MySQL database monitoring method is implemented by a MySQL database monitoring device, which may be a terminal device such as a PC, a palm computer, a tablet computer, or the like, and may be selected as the device shown in fig. 1, and the MySQL database monitoring method includes the following steps:
step S101, when a database monitoring request is received, configuring a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set;
step S102, logging in a target MySQL database host according to the host IP in the current monitoring template set, and executing monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host;
step S103, determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and executing database alarm operation when the database alarm instruction is triggered.
Currently, the monitoring mode of the MySQL database is single monitoring, that is, a maintenance operator configures each monitoring item separately through a server platform, and executes the monitoring item in a corresponding MySQL database host after configuration, however, in the MySQL database monitoring, multiple monitoring items are often needed for different indexes, the maintenance operator needs to configure multiple single monitoring items in parallel to realize multiple monitoring, and the MySQL database used under different application systems needs to configure different strategies, so that the monitoring efficiency of the MySQL database is low, and the applicability is low. In view of the above problems, the present embodiment provides a MySQL database monitoring method, and the specific steps of the MySQL database monitoring method are described in detail as follows:
step S101, when a database monitoring request is received, configuring a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set;
in this embodiment, when a configuration instruction of a monitoring template set triggered by a user is monitored, a monitoring parameter configuration interface is displayed at the front end, database monitoring data is received through the monitoring parameter configuration interface, a database monitoring request carrying the database monitoring data is generated, and the database monitoring request is sent to a device. The database monitoring data includes, but is not limited to, placeholders (belonging system of the target MySQL database, belonging group of system, belonging department or subsidiary of system), SQL statements, alarm contact group, MySQL database host IP, MySQL database host port, database name, database login user, database login password, monitoring template type, alarm manner, execution duration, execution interval, and monitoring description.
When a database monitoring request sent by a front end is received, a preset monitoring template set is configured according to database monitoring data in the database monitoring request to obtain a current monitoring template set, namely, placeholders (a system to which a target MySQL database belongs, a group in which the system belongs, a department or a subsidiary company to which the system belongs, SQL sentences, alarm contact groups, MySQL database host computers IP, MySQL database host computer ports, database names, database login users, database login passwords, monitoring template types, alarm modes, execution duration and execution intervals are configured. The preset monitoring template set includes, but is not limited to, a monitoring SQL statement for an availability monitoring item, a monitoring SQL statement for a throughput monitoring item, a monitoring SQL statement for a connection number monitoring item, a monitoring SQL statement for an execution performance monitoring item, and a monitoring SQL statement for a buffer pool monitoring item.
Specifically, the database monitoring data is read from the database monitoring request, the identification fields of the monitoring parameters in the preset monitoring template set are obtained, the corresponding configuration information of the monitoring parameters is obtained from the database monitoring data according to the identification fields of the monitoring parameters, namely the configuration information corresponding to the identification fields is obtained from the database monitoring data, then the monitoring parameters in the preset monitoring template set are configured according to the corresponding configuration information of the monitoring parameters, so as to obtain the current monitoring template set, namely the configuration information is distributed to the corresponding monitoring parameters according to the corresponding relation between the configuration information and the identification fields. The monitoring parameters include but are not limited to SQL statements, an alarm contact group, a MySQL database host IP, a MySQL database host port, a database name, a database login user, and a database login password.
Step S102, logging in a target MySQL database host according to the host IP in the current monitoring template set, and executing monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host;
in this embodiment, after the preset monitoring template set is configured and the current monitoring template set is obtained, the target MySQL database host is logged in according to the host IP in the current monitoring template set, that is, the host IP is obtained from the current monitoring template set, the database login password associated with the host IP is obtained, and the corresponding target MySQL database host is logged in according to the login password; and then, in the target MySQL database host, executing the monitoring SQL sentences of all monitoring items in the current monitoring template set, namely executing the monitoring SQL sentences of the availability monitoring items, the throughput monitoring items, the connection number monitoring items, the execution performance monitoring items, the buffer pool monitoring items and the like to obtain the monitoring result information of all monitoring items. The monitoring SQL sentences of the availability monitoring items are used for monitoring whether the MySQL database can receive external requests, the monitoring SQL sentences of the throughput monitoring items are used for monitoring the throughput of the MySQL database, the monitoring SQL sentences of the connection number monitoring items are used for monitoring the current connection number of the MySQL database, the monitoring SQL sentences of the execution performance monitoring items are used for monitoring the execution efficiency of the MySQL database, and the monitoring SQL sentences of the buffer pool monitoring items are used for monitoring the buffer pool of the MySQL database.
Step S103, determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and executing database alarm operation when the database alarm instruction is triggered.
In this embodiment, after the monitoring SQL statement of each monitoring item in the current monitoring template set is executed, the monitoring result information of each monitoring item is obtained, and whether a database alarm instruction is triggered is determined according to each monitoring index in the monitoring result information of each monitoring item, that is, whether the MySQL database is abnormal is determined according to each monitoring index in the monitoring result information of each monitoring item, if the MySQL database is abnormal, a database alarm instruction is triggered, and if the MySQL database is normal, a database alarm instruction is not triggered.
Specifically, whether at least one monitoring index in each monitoring index in the monitoring result information of each monitoring item is abnormal is judged, if at least one monitoring index in each monitoring index in the monitoring result information of each monitoring item is abnormal, the MySQL database is determined to be abnormal, a database alarm instruction needs to be triggered, and if all the monitoring indexes in the monitoring result information of each monitoring item are normal, the MySQL database is determined to be normal, and the database alarm instruction does not need to be triggered. The monitoring indexes include, but are not limited to, throughput, database connection number, database execution efficiency and buffer pool free resources, and when the throughput exceeds a preset throughput, the database connection number exceeds a preset connection number, the database execution efficiency is lower than the preset execution efficiency or the buffer pool free resources are lower than the preset resources, the MySQL database is determined to be abnormal.
When the database alarm instruction is triggered, executing database alarm operation, namely generating alarm information according to each monitoring index, and sending the alarm information to an alarm contact group according to a preset alarm mode. Specifically, a preset alarm information template is obtained, and the monitoring result information of each monitoring item is filled into the preset alarm information template to generate alarm information, that is, the position information of each monitoring item in the preset alarm information template is obtained, the filling position of each monitoring item in the preset alarm information template is determined according to the position information of each monitoring item, and the monitoring result information of each monitoring item is filled into the corresponding filling position in the preset alarm information template to generate alarm information. The alarm information includes but is not limited to belonging system, system group, system department or subsidiary, alarm contact group and abnormal information, and the abnormal information includes but is not limited to throughput, database connection number, database execution efficiency and buffer pool free resources, and the alarm mode includes but is not limited to mail alarm, short message alarm and telephone alarm.
Further, according to the host IP concentrated by the current monitoring template, determining a target MySQL database host, judging whether the firewall policies of the target MySQL database host and the local machine are opened or not, if the firewall policies of the local machine of the target MySQL database host are not opened, executing the firewall policy opening operation until the firewall policies of the local machine of the target MySQL database host are opened, then obtaining the login password of the target MySQL database host according to the host IP, and logging in the corresponding target MySQL database host according to the login password. Before logging in the target MySQL database host, whether the firewall strategies of the target MySQL database host and the local machine are opened or not is verified, so that the situation that the target MySQL database host cannot be logged in due to the fact that the firewall strategies are not opened is prevented when the target MySQL database host is logged in.
In this embodiment, when a database monitoring request is received, a preset monitoring template set is configured according to database monitoring data in the database monitoring request to obtain a current monitoring template set, then a target MySQL database host is logged in according to a host IP in the current monitoring template set, and a monitoring SQL statement of each monitoring item in the current monitoring template set is executed in the target MySQL database host, and finally whether a database alarm instruction is triggered is determined according to each monitoring index in monitoring result information of each monitoring item, if the database alarm instruction is triggered, a database alarm operation is executed, an operation and maintenance worker can realize multiple monitoring on the MySQL database by setting the monitoring template set only through simple configuration, and when the database alarm instruction is triggered, the database alarm operation is executed, thereby effectively improving the monitoring efficiency and the applicability of the MySQL database, and the alarm can be quickly and timely sent out when the database is abnormal.
Further, referring to fig. 3, a second embodiment of the MySQL database monitoring method according to the present invention is proposed based on the first embodiment, and the difference from the foregoing embodiment is that the step of performing the database alarm operation in step S103 includes:
step S1031, determining a database alarm level according to each monitoring index in the monitoring result information;
in this embodiment, if the database alarm instruction is triggered, the database alarm level is determined according to each monitoring index in the monitoring result information. It should be noted that, the specific number, the importance degree, and the time efficiency requirement of the alarm levels may be set by those skilled in the art based on actual situations, which is not specifically limited in this embodiment, the specific number of the alarm levels may be selected as 5, which are respectively the first alarm level, the second alarm level, the third alarm level, the fourth alarm level, and the fifth alarm level, and the importance degree and the time efficiency requirement are shown in the following table:
alarm rating Degree of importance Aging requirement Response to aging requirements Aging treatment efficiency
First alarm level Is very important 7 x 24 real-time response <1 hour >=95%
Second alarm level Of importance 7 x 24 real-time response <2 hours >=95%
Third alarm level Of greater importance 5 x 24 real-time response <6 hours >=90%
Fourth warning level Is lower than 5 x 24 real-time response <8 hours >=85%
Fifth alarm level Is low in Without requirement Without requirement Without requirement
The specific determination mode of the database alarm level may be to count the number of monitoring indexes with abnormality, to be recorded as the number of first abnormal monitoring indexes, to query the mapping relationship between the number of the first abnormal monitoring indexes and the database alarm level, and to determine the database alarm level corresponding to the number of the first abnormal monitoring indexes, wherein the higher the number of the first abnormal monitoring indexes is, the higher the database alarm level is, and the higher the importance degree thereof is; the specific determination method of the database alarm levels may also be to count the number of monitoring indexes which are abnormal and located in a preset monitoring index group, to be recorded as the number of second abnormal monitoring indexes, to query the mapping relationship between the number of the second abnormal monitoring indexes and the database alarm levels, and to determine the database alarm levels corresponding to the number of the second abnormal monitoring indexes, wherein the higher the number of the second abnormal monitoring indexes is, the higher the database alarm level is, and the higher the importance degree thereof is. It should be noted that the mapping relationship between the number of the abnormal monitoring indexes and the alarm level of the database may be set by a person skilled in the art based on actual situations, and this embodiment is not particularly limited thereto.
And S1032, determining a target alarm mode according to the alarm level of the database, and executing corresponding database alarm operation according to the target alarm mode.
In the embodiment, after the alarm level of the database is determined, the alarm mode is determined according to the alarm level of the database, namely, the mapping relation between the alarm level of the database and the alarm mode is inquired, the alarm mode corresponding to the alarm level of the database is determined as a target alarm mode, and the corresponding alarm operation of the database is executed according to the alarm mode; and then, according to the target alarm mode, executing corresponding database alarm operation, namely generating alarm information according to each monitoring index, and sending the alarm information to an alarm contact group according to the target alarm mode. Specifically, when the target alarm mode is a telephone alarm, according to the alarm notification sequence of each alarm contact in the preset alarm contact tree, the alarm call is made to the corresponding alarm contact until the alarm call is answered, namely, the alarm call is made to the alarm contact where the root node of the preset alarm contact tree is located, when the alarm call is not answered, the alarm call is made to the next alarm contact until the alarm call is answered, and the alarm information is played in the answering process.
In the embodiment, different alarm modes are adopted based on different alarm levels, so that a user can know that the database is abnormal quickly, problems can be solved in time, and accident loss is reduced.
In addition, the embodiment of the invention also provides a MySQL database monitoring device.
Referring to fig. 4, fig. 4 is a functional module diagram of a MySQL database monitoring apparatus according to a first embodiment of the present invention.
The MySQL database monitoring device is a virtual device, is stored in the memory 1005 of the MySQL database monitoring equipment shown in the figure 1, and is used for realizing all functions of a MySQL database monitoring program; when a database monitoring request is received, configuring a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set; logging in a target MySQL database host according to the host IP in the current monitoring template set, and executing monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host; and determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and executing database alarm operation when the database alarm instruction is triggered.
Specifically, in this embodiment, the MySQL database monitoring apparatus includes:
the configuration module 101 is configured to, when a database monitoring request is received, configure a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set;
the execution module 102 is configured to log in a target MySQL database host according to the host IP in the current monitoring template set, and execute the monitoring SQL statements of each monitoring item in the current monitoring template set in the target MySQL database host;
the alarm module 103 is configured to determine whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and execute a database alarm operation when the database alarm instruction is triggered.
Further, the configuration module 101 is further configured to:
reading database monitoring data from the database monitoring request, and acquiring an identification field of each monitoring parameter in a preset monitoring template set;
acquiring corresponding configuration information of each monitoring parameter from the database monitoring data according to the identification field of each monitoring parameter;
and configuring each monitoring parameter in a preset monitoring template set according to the corresponding configuration information of each monitoring parameter so as to obtain the current monitoring template set.
Further, the execution module 102 is further configured to:
reading a host IP from the current monitoring template set, and acquiring a login password of a target MySQL database host according to the host IP;
and logging in the corresponding target MySQL database host according to the login password.
Further, the alarm module 103 is further configured to:
judging whether at least one monitoring index is abnormal in each monitoring index in the monitoring result information of each monitoring item;
and if at least one monitoring index in the monitoring result information of each monitoring item is abnormal, triggering a database alarm instruction.
Further, the alarm module 103 is further configured to:
determining the alarm level of a database according to each monitoring index in the monitoring result information;
and determining a target alarm mode according to the alarm level of the database, and executing corresponding database alarm operation according to the target alarm mode.
Further, the alarm module 103 is further configured to:
and when the target alarm mode is a telephone alarm, dialing an alarm call to the corresponding alarm contact according to the alarm notification sequence of each alarm contact in the preset alarm contact tree until the alarm call is answered.
Further, the execution module 102 is further configured to:
determining a target MySQL database host according to the host IP in the current monitoring template set;
judging whether the firewall strategies of the target MySQL database host and the local machine are opened or not;
if the firewall policy of the target MySQL database host computer is not opened, executing firewall policy opening operation until the firewall policy of the target MySQL database host computer is opened;
and acquiring a login password of the target MySQL database host according to the host IP, and logging in the corresponding target MySQL database host according to the login password.
The function implementation of each module in the MySQL database monitoring device corresponds to each step in the MySQL database monitoring method embodiment, and the functions and implementation processes are not described in detail here.
In addition, the embodiment of the invention also provides a readable storage medium.
The readable storage medium of the invention stores a MySQL database monitoring program, wherein when the MySQL database monitoring program is executed by a processor, the steps of the MySQL database monitoring method are realized.
The method implemented when the MySQL database monitoring program is executed may refer to each embodiment of the MySQL database monitoring method of the present invention, and details thereof are not repeated here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention or the portions contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) as described above and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A MySQL database monitoring method is characterized by comprising the following steps:
when a database monitoring request is received, configuring a preset monitoring template set according to database monitoring data in the database monitoring request to obtain a current monitoring template set, wherein the preset monitoring template set comprises one or more of monitoring SQL statements of availability monitoring items, monitoring SQL statements of throughput monitoring items, monitoring SQL statements of connection number monitoring items, monitoring SQL statements of execution performance monitoring items and monitoring SQL statements of buffer pool monitoring items;
logging in a target MySQL database host according to the host IP in the current monitoring template set, and executing monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host;
determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and executing database alarm operation when the database alarm instruction is triggered;
the step of configuring a preset monitoring template set according to the database monitoring data in the database monitoring request to obtain a current monitoring template set comprises:
reading database monitoring data from the database monitoring request, and acquiring an identification field of each monitoring parameter in a preset monitoring template set;
acquiring corresponding configuration information of each monitoring parameter from the database monitoring data according to the identification field of each monitoring parameter;
and configuring each monitoring parameter in a preset monitoring template set according to the corresponding configuration information of each monitoring parameter so as to obtain the current monitoring template set.
2. The MySQL database monitoring method of claim 1, wherein the step of logging in a target MySQL database host according to the host IP in the current monitoring template set comprises:
reading a host IP from the current monitoring template in a centralized manner, and acquiring a login password of a target MySQL database host according to the host IP;
and logging in the corresponding target MySQL database host according to the login password.
3. The MySQL database monitoring method according to claim 1, wherein the step of determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item includes:
judging whether at least one monitoring index in the monitoring result information of each monitoring item is abnormal or not;
and if at least one monitoring index in the monitoring result information of each monitoring item is abnormal, triggering a database alarm instruction.
4. The MySQL database monitoring method according to any of claims 1-3, wherein the step of performing a database alarm operation comprises:
determining the alarm level of a database according to each monitoring index in the monitoring result information;
and determining a target alarm mode according to the alarm level of the database, and executing corresponding database alarm operation according to the target alarm mode.
5. The MySQL database monitoring method according to claim 4, wherein the step of executing the corresponding database alarm operation according to the alarm mode includes:
and when the target alarm mode is a telephone alarm, dialing an alarm call to the corresponding alarm contact according to the alarm notification sequence of each alarm contact in the preset alarm contact tree until the alarm call is answered.
6. The MySQL database monitoring method of any one of claims 1-3, wherein the step of logging in the target MySQL database host according to the host IP in the current monitoring template set comprises:
determining a target MySQL database host according to the host IP in the current monitoring template set;
judging whether the firewall strategies of the target MySQL database host and the local machine are opened or not;
if the firewall policy of the target MySQL database host computer is not opened, executing firewall policy opening operation until the firewall policy of the target MySQL database host computer is opened;
and acquiring a login password of the target MySQL database host according to the host IP, and logging in the corresponding target MySQL database host according to the login password.
7. The MySQL database monitoring device is characterized by comprising the following components:
the configuration module is used for configuring a preset monitoring template set according to database monitoring data in a database monitoring request to acquire a current monitoring template set when the database monitoring request is received, wherein the preset monitoring template set comprises one or more of monitoring SQL statements of availability monitoring items, monitoring SQL statements of throughput monitoring items, monitoring SQL statements of connection number monitoring items, monitoring SQL statements of execution performance monitoring items and monitoring statements of buffer pool monitoring items;
the execution module is used for logging in a target MySQL database host according to the host IP in the current monitoring template set and executing the monitoring SQL sentences of all monitoring items in the current monitoring template set in the target MySQL database host;
the alarm module is used for determining whether to trigger a database alarm instruction according to each monitoring index in the monitoring result information of each monitoring item, and executing database alarm operation when the database alarm instruction is triggered;
the configuration module is further used for reading database monitoring data from the database monitoring request and acquiring identification fields of all monitoring parameters in a preset monitoring template set; acquiring corresponding configuration information of each monitoring parameter from the database monitoring data according to the identification field of each monitoring parameter; and configuring each monitoring parameter in a preset monitoring template set according to the corresponding configuration information of each monitoring parameter so as to obtain the current monitoring template set.
8. A MySQL database monitoring device comprising a processor, a memory, and a MySQL database monitoring program stored on the memory and executable by the processor, wherein the MySQL database monitoring program when executed by the processor implements the steps of the MySQL database monitoring method of any of claims 1 to 6.
9. A readable storage medium having stored thereon a MySQL database monitor, wherein the MySQL database monitor, when executed by a processor, performs the steps of the MySQL database monitor method according to any of claims 1 to 6.
CN201811090617.1A 2018-09-18 2018-09-18 MySQL database monitoring method, device, equipment and readable storage medium Active CN109669835B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811090617.1A CN109669835B (en) 2018-09-18 2018-09-18 MySQL database monitoring method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811090617.1A CN109669835B (en) 2018-09-18 2018-09-18 MySQL database monitoring method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN109669835A CN109669835A (en) 2019-04-23
CN109669835B true CN109669835B (en) 2022-05-20

Family

ID=66141603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811090617.1A Active CN109669835B (en) 2018-09-18 2018-09-18 MySQL database monitoring method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN109669835B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110233759B (en) * 2019-06-10 2022-07-22 平安科技(深圳)有限公司 Load abnormity warning method and related device
CN110324179B (en) * 2019-06-10 2022-08-02 平安科技(深圳)有限公司 Load abnormity warning method and related device
CN110716832B (en) * 2019-09-24 2022-06-07 腾讯科技(深圳)有限公司 Service operation monitoring and alarming method, system, electronic equipment and storage medium
CN111124805A (en) * 2019-11-25 2020-05-08 中国联合网络通信集团有限公司 Data acquisition method, device, equipment and storage medium
CN111078501A (en) * 2019-12-16 2020-04-28 深圳市随手科技有限公司 ORM-based database monitoring method, system, server and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101989283A (en) * 2009-08-04 2011-03-23 中兴通讯股份有限公司 Monitoring method and device of performance of database
CN104253706A (en) * 2013-06-29 2014-12-31 北京新媒传信科技有限公司 Method and device for monitoring database management platform
WO2016095551A1 (en) * 2014-12-16 2016-06-23 新余兴邦信息产业有限公司 Method and apparatus for implementing mysql database monitoring option script
CN106201823A (en) * 2016-06-30 2016-12-07 国云科技股份有限公司 The system of a kind of real-time monitoring mysql data base and monitoring method thereof
CN107977467A (en) * 2017-12-21 2018-05-01 广东金赋科技股份有限公司 Database monitoring device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101989283A (en) * 2009-08-04 2011-03-23 中兴通讯股份有限公司 Monitoring method and device of performance of database
CN104253706A (en) * 2013-06-29 2014-12-31 北京新媒传信科技有限公司 Method and device for monitoring database management platform
WO2016095551A1 (en) * 2014-12-16 2016-06-23 新余兴邦信息产业有限公司 Method and apparatus for implementing mysql database monitoring option script
CN106201823A (en) * 2016-06-30 2016-12-07 国云科技股份有限公司 The system of a kind of real-time monitoring mysql data base and monitoring method thereof
CN107977467A (en) * 2017-12-21 2018-05-01 广东金赋科技股份有限公司 Database monitoring device

Also Published As

Publication number Publication date
CN109669835A (en) 2019-04-23

Similar Documents

Publication Publication Date Title
CN109669835B (en) MySQL database monitoring method, device, equipment and readable storage medium
CN109660380B (en) Server running state monitoring method, platform, system and readable storage medium
US11756404B2 (en) Adaptive severity functions for alerts
WO2017131774A1 (en) Log event summarization for distributed server system
US20190147354A1 (en) Event identification through machine learning
CN110175465A (en) Log desensitization method, device, computer equipment and computer readable storage medium
CN110198305A (en) It attends a banquet method for detecting abnormality, system, computer equipment and the storage medium of IP
CN109543891B (en) Method and apparatus for establishing capacity prediction model, and computer-readable storage medium
CN112311617A (en) Configured data monitoring and alarming method and system
CN111934920B (en) Monitoring alarm method, device, equipment and storage medium
US9071551B2 (en) Mobile trouble ticket
EP3343421A1 (en) System to detect machine-initiated events in time series data
CN111475369A (en) Log monitoring adding method and device, computer equipment and storage medium
CN108616668B (en) Method for monitoring dialing task, electronic device and computer readable storage medium
CN106709057A (en) Distributed cluster visualized database
US11146447B2 (en) Method and apparatus of establishing computer network monitoring criteria
CN113672475A (en) Alarm processing method and device, computer equipment and storage medium
CN109391658B (en) Account data synchronization method and equipment, storage medium and terminal thereof
CN109302336B (en) Mail generation method and device, computer equipment and storage medium
CN110893616B (en) Remote control method and device, computer equipment and storage medium
CN113535439B (en) Service request processing method, device, equipment and storage medium
CN113901153A (en) Data processing method and related equipment
CN113590276A (en) Information pushing method and related product
CN110543470A (en) Message early warning method and device, storage medium and electronic device
CN109508356B (en) Data abnormality early warning method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant