WO2019237585A1 - Zookeeper的监控方法、装置、计算机设备及存储介质 - Google Patents

Zookeeper的监控方法、装置、计算机设备及存储介质 Download PDF

Info

Publication number
WO2019237585A1
WO2019237585A1 PCT/CN2018/109321 CN2018109321W WO2019237585A1 WO 2019237585 A1 WO2019237585 A1 WO 2019237585A1 CN 2018109321 W CN2018109321 W CN 2018109321W WO 2019237585 A1 WO2019237585 A1 WO 2019237585A1
Authority
WO
WIPO (PCT)
Prior art keywords
command
zookeeper
value
monitoring
preset
Prior art date
Application number
PCT/CN2018/109321
Other languages
English (en)
French (fr)
Inventor
丁江
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019237585A1 publication Critical patent/WO2019237585A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Definitions

  • the present application relates to the field of computer technology, and in particular, to a monitoring method, device, computer equipment, and storage medium for Zookeeper.
  • Zookeeper is a distributed, open source, distributed application coordination service. At present, it is widely used in various distributed service platforms, providing functions such as configuration maintenance, domain name services, distributed synchronization, and group services, so as to ensure that the distributed service platform can better provide services to users. Because of the importance of Zookeeper, once Zookeeper is abnormal, it will affect the normal operation of the distributed service platform. Therefore, how to monitor the running status of Zookeeper has become an urgent technical issue.
  • This application provides a method, device, computer equipment, and storage medium for monitoring Zookeeper to monitor the running status of Zookeeper.
  • the present application provides a method for monitoring Zookeeper, which includes: calling an nc command; establishing a connection with Zookeeper through the nc command; and sending an attribute acquisition command to Zookeeper to obtain the running attributes of Zookeeper Receiving a running attribute value fed back by the Zookeeper, and obtaining a running attribute value that matches a preset running attribute identifier from the running attribute value as a monitoring attribute value; and sending the monitoring attribute value to a monitoring server So that the monitoring server monitors the running status of the Zookeeper according to the monitoring attribute value and the corresponding preset threshold condition.
  • the present application provides a Zookeeper monitoring device, which includes: a command call unit for calling an nc command; a connection unit for establishing a connection with Zookeeper through the nc command; an attribute value acquisition unit, Configured to send a property acquisition command to the Zookeeper to obtain the running attribute value of the Zookeeper; a receiving unit, configured to receive the running attribute value fed back by the Zookeeper, and obtain a preset running attribute identifier from the running attribute value A matching running attribute value is used as a monitoring attribute value; a sending unit is configured to send the monitoring attribute value to a monitoring server, so that the monitoring server monitors the according to the monitoring attribute value and a corresponding preset threshold condition The running status of Zookeeper.
  • the present application further provides a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor.
  • the processor is implemented when the computer program is executed.
  • the monitoring method of Zookeeper according to any one of the first aspect.
  • the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the first aspect.
  • the monitoring method of Zookeeper according to any one of the above.
  • This application provides a method, device, computer equipment, and storage medium for monitoring Zookeeper. This method can monitor the running status of Zookeeper, so that it can be found in time when Zookeeper is in an abnormal running state, to ensure that the monitored server equipped with Zookeeper can provide external services normally.
  • FIG. 1 is a schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of an application scenario of a Zookeeper monitoring method according to an embodiment of the present application
  • FIG. 3 is another schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application.
  • FIG. 4 is a specific schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application.
  • FIG. 5 is another schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application.
  • FIG. 6 is a specific schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application.
  • FIG. 7 is a schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • FIG. 8 is another schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • FIG. 9 is a specific schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • FIG. 10 is another schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • FIG. 11 is a specific schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • FIG. 12 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application.
  • the monitoring method of Zookeeper is applied to the monitored server 20.
  • the monitored server 20 may be a server in a distributed service platform.
  • Zookeeper is deployed in the monitored server 20, and the monitored server 20 sends the monitoring attribute value of Zookeeper to the monitoring server 10, so that the monitoring server 10
  • the running status of Zookeeper in the monitored server 20 can be monitored.
  • the monitoring server 10 can monitor the running status of Zookeeper among multiple monitored servers 20.
  • the monitoring method of Zookeeper includes steps S101 to S105.
  • FIG. 3 is another schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application. In this embodiment, steps S106 and S107 are further included before step S101.
  • the monitored server 20 needs to determine whether the nc command exists in the monitored server 20 through the first preset command before executing step S101.
  • the first preset command may be, for example, a "whereisnc" command.
  • the first preset command may also be other commands, as long as it can be determined whether the nc command exists in the monitored server 20, which is not specifically limited here.
  • FIG. 4 is a specific schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application.
  • This step 106 includes steps S1061 to S1064.
  • the monitored server 20 runs the first preset command, and then receives a command return value corresponding to the first preset command.
  • the return value of this command can be a null value or the storage directory of the nc command.
  • the command return value is the storage directory of the nc command; when the nc command is not stored in the monitored server 20, the command return value is a null value.
  • a preset correspondence relationship is stored in the monitored server 20.
  • the preset correspondence is used to store the correspondence between the command return value and the nccheck value.
  • the specific correspondence may be: when the command return value is null, the corresponding nccheck value is 0; when the command return value is the storage directory of the nc command, the corresponding nccheck value is 1.
  • the monitored server 20 After the monitored server 20 receives the command return value, it first obtains the preset correspondence relationship stored in advance, and then finds the nccheck value corresponding to the command return value according to the preset correspondence relationship.
  • nccheck value is 1, determine that the nc command exists.
  • the monitored server 20 After obtaining the nccheck value corresponding to the command return value, the monitored server 20 will determine whether the nccheck value is 1 or 0.
  • step S101 is executed at this time, that is, the nc command is called.
  • calling the nc command may be specifically: calling the nc command according to the command return value, that is, adjusting the nc command according to the storage directory of the nc command. Take the nc command.
  • step S107 will be executed at this time.
  • the monitored server 20 When the nc command does not exist in the monitored server 20, the monitored server 20 needs to send alarm information to the monitoring server 10 so that the monitoring server 10 can perform the corresponding prompt operation, and then prompt the staff to add the nc command to the monitored server 20 in time. .
  • the monitoring server 10 may perform corresponding prompting operations, for example, send an email, phone call, or short message to the monitoring server 10 with the nc command to the staff.
  • sending the alarm information that the nc command does not exist to the monitoring server may specifically include sending the nccheck value to Monitoring server. That is, the nccheck value is used as the alarm information. In this way, when the monitoring server 10 receives the nccheck value of 0, it can know that the nc command is missing from the monitored server 20.
  • the alarm information may also be other information, which is not specifically limited herein.
  • the monitored server 20 may also feed back the nccheck value to the monitoring server 10, so that the maintenance personnel can know the monitored server 20 through the monitoring server 10. Whether the nc command exists.
  • the monitoring method in the embodiment of the present application when deployed in the monitored server 20, it is often deployed automatically. Therefore, when monitoring is deployed in the early stage, it is difficult for the developer to know whether the monitored server 20 is The nc command is stored.
  • the developer can know whether the nc command exists in the monitored server 20 through the nccheck value received by the monitoring server 10, and it is convenient for the developer to know the storage situation of the nc command in the monitored server 20 in time.
  • the monitored server 20 After the monitored server 20 obtains the nc command, it will establish a connection with Zookeeper through the nc command. Specifically, a connection is established with the corresponding Zookeeper according to the service address and port number in the nc command.
  • FIG. 5 is another schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application. Before establishing a connection with Zookeeper by using the nc command, steps S108 and S109 are further included.
  • the second preset command may be, for example, an echo command
  • the monitored server 20 detects whether Zookeeper is started by running the second preset command.
  • FIG. 6 is a specific schematic flowchart of a Zookeeper monitoring method according to an embodiment of the present application.
  • This step S108 includes steps S1081 to S1083.
  • the monitored server 20 runs the second preset command, and then receives the checkstatus value corresponding to the second preset command.
  • step S102 will be executed at this time, that is, establishing a connection with Zookeeper through the nc command.
  • checkstatus value is down, it means that Zookeeper is not started, and step S109 will be executed at this time.
  • monitoring server 10 When detecting that Zookeeper is not started, send alarm information to monitoring server 10 to inform monitoring server 10 that Zookeeper in monitored server 20 is not started, so monitoring server 10 can perform corresponding operations to prompt maintenance personnel to start monitored server 20 Zookeeper.
  • the monitored server 20 After the monitored server 20 connects with Zookeeper through the nc command, it sends an attribute acquisition command to Zookeeper, so that Zookeeper can feedback the current running attribute value to the monitored server 20.
  • the attribute acquisition command may be an mntr command.
  • the running attribute value may include: zk_avg_latency (Chinese name: average extension), zk_num_alive_connections (Chinese name: number of surviving connections), zk_outstanding_requests (Chinese name: exception request), zk_server_state (Chinese name: node role), zk_znode_count (Chinese name: node Number), zk_watch_count (Chinese name: number of monitors), zk_ephemerals_count (Chinese name: number of temporary nodes), zk_open_file_descriptor_count (Chinese name: limit on the number of open file descriptors), zk_packets_received (Chinese name: number of received packets), zk_packets_sent (Chinese name: Number of packets sent), number of outstanding client requests, zk_server_state,
  • the monitored server 20 After the monitored server 20 receives the running attribute value fed back by Zookeeper, there may be some attribute values in the running attribute value that cannot be used to monitor the running status of Zookeeper. Therefore, the monitored server 20 needs to receive the running attribute value from the received The required attribute value is filtered out as the monitoring attribute value.
  • a preset operation attribute identifier is stored in the monitored server 20 in advance, and the monitored server 20 finds an operation attribute value that matches the preset operation attribute identifier from the received operation attribute values as the monitoring attribute value.
  • the preset running attribute identifier is zk_watch_count
  • the running attribute value returned by Zookeeper is as follows:
  • a matching zk_watch_count 9 can be found from the above three running attribute values as the monitoring attribute value.
  • the monitoring attribute values include: zk_avg_latency, zk_num_alive_connections, zk_outstanding_requests, zk_server_state, zk_znode_count, zk_watch_count, zk_ephemerals_count, and zk_open_file_descriptor_count. It should be noted that the monitoring attribute value can be adjusted and set according to actual needs, and the specific content of the monitoring attribute value is not limited here.
  • S105 Send the monitoring attribute value to a monitoring server, so that the monitoring server monitors the running status of the Zookeeper according to the monitoring attribute value and a corresponding preset threshold condition.
  • the monitored server 20 sends the monitoring attribute value to the monitoring server 10, so that the monitoring server 10 monitors the running status of Zookeeper according to the monitoring attribute value.
  • the monitoring server 10 stores a preset threshold condition corresponding to each monitoring attribute value. After receiving the monitoring attribute value, the monitoring server 10 may store the monitoring attribute value in a database.
  • the database stores monitoring attribute values sent by the monitoring server 20 each time.
  • the monitoring server 10 reads the latest stored monitoring attribute value from the database. It is then determined whether the monitored attribute value satisfies a corresponding preset threshold condition. If the monitoring attribute value satisfies the corresponding preset threshold condition, it is determined that Zookeeper is in a normal running state; if the monitoring attribute value does not meet the corresponding preset threshold condition, it is determined that Zookeeper is in an abnormal running state.
  • the monitoring server 10 may determine that the zk_znode_count does not meet the preset greater than 800. Threshold conditions. At this time, the running status of Zookeeper will be determined to be abnormal.
  • the monitoring server 10 may send a prompt message to prompt the maintenance personnel to handle it in time.
  • the monitoring server 10 may determine that the Zookeeper is in an abnormal working state only when it determines that the monitoring attribute value for two consecutive times does not satisfy the preset threshold condition.
  • the monitoring method of Zookeeper in this embodiment can monitor the running status of Zookeeper, so that it can be detected in time when Zookeeper is in an abnormal running state, so as to ensure that the managed server equipped with Zookeeper can provide external services normally.
  • the embodiment of the present application further provides a monitoring device for Zookeeper, and the monitoring device for Zookeeper is configured to execute the monitoring method for Zookeeper in the foregoing embodiment.
  • FIG. 7 is a schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • the monitoring device 300 of Zookeeper may be installed in a monitored server, and the monitored server may be a server in a distributed service platform. Zookeeper is deployed in the monitored server.
  • the monitoring device 300 of Zookeeper includes a command calling unit 301, a connecting unit 302, an attribute value obtaining unit 303, a receiving unit 304, and a sending unit 305.
  • the command calling unit 301 is configured to call an nc command.
  • FIG. 8 is another schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • the monitoring apparatus 300 of Zookeeper further includes a determining unit 306 and a first alarm sending unit 307.
  • the judging unit 306 is configured to judge whether an nc command exists by using a first preset command.
  • FIG. 9 is a specific schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • the determination unit 306 includes a first operation subunit 3061, an acquisition subunit 3062, and a first determination subunit 3063.
  • the first running subunit 3061 is configured to run a first preset command and receive a command return value corresponding to the first preset command.
  • the obtaining subunit 3062 is configured to obtain an nccheck value corresponding to the command return value according to a preset correspondence relationship.
  • a first determining subunit 3063 is configured to determine that the nc command exists if the nccheck value is 1, and determine that the nc command does not exist if the nccheck value is 0.
  • the first decision sub-unit 3063 When the first decision sub-unit 3063 determines that the nc command exists, the first decision sub-unit 3063 will send a first signal to the command call unit 301, so that the command call unit 301 executes the call nc command.
  • the command calling unit 301 when the command calling unit 301 receives the first signal sent by the first determination subunit 3063, the command calling unit 301 is specifically configured to call the nc command according to the command return value.
  • the first determining subunit 3063 determines that the nc command does not exist, it sends a second signal to the first alarm sending unit 307, so that the first alarm sending unit 307 performs a corresponding operation.
  • the first alarm sending unit 307 is configured to send alarm information that the nc command does not exist to the monitoring server if the nc command does not exist.
  • the first alarm sending unit 307 when the first alarm sending unit 307 receives the second signal sent by the first determination sub-unit 3063, it sends the monitoring information that the nc command does not exist to the monitoring server. Specifically, the first alarm sending unit 307 sends the nccheck value to a monitoring server.
  • the connection unit 302 is configured to establish a connection with Zookeeper by using the nc command.
  • FIG. 10 is another schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • the monitoring apparatus 300 of Zookeeper further includes a detecting unit 308 and a second alarm sending unit 309.
  • the detecting unit 308 is configured to detect whether Zookeeper is started by using a second preset command.
  • FIG. 11 is a specific schematic block diagram of a Zookeeper monitoring device according to an embodiment of the present application.
  • the detection unit 308 includes a second operation sub-unit 3081 and a second determination sub-unit 3082.
  • the second running subunit 3081 is configured to run a second preset command and receive a checkstatus value corresponding to the second preset command.
  • a second determining sub-unit 3082 is configured to determine that Zookeeper is started if the checkstatus value is OK; and determine that Zookeeper is not started if the checkstatus value is down.
  • the second determination subunit 3082 determines that Zookeeper is started, it sends a third signal to the connection unit 302, so that the connection unit 302 establishes a connection with Zookeeper through the nc command.
  • the second determination subunit 3082 determines that Zookeeper is not started, it sends a fourth signal to the second alarm sending unit 309, so that the second alarm sending unit 309 performs a corresponding operation.
  • the second alarm sending unit 309 is configured to send alarm information that the Zookeeper is not started to the monitoring server if it is detected that the Zookeeper is not started.
  • the second alarm sending unit 309 when the second alarm sending unit 309 receives the fourth signal, indicating that Zookeeper is not started at this time, the second alarm sending unit 309 sends the monitoring information that the Zookeeper is not started to the monitoring server.
  • the attribute value obtaining unit 303 is configured to send an attribute obtaining command to the Zookeeper to obtain a running attribute value of the Zookeeper.
  • the receiving unit 304 is configured to receive a running attribute value fed back by the Zookeeper, and obtain a running attribute value that matches a preset running attribute identifier from the running attribute value as a monitoring attribute value.
  • the sending unit 305 is configured to send the monitoring attribute value to a monitoring server, so that the monitoring server monitors the running status of the Zookeeper according to the monitoring attribute value and a corresponding preset threshold condition.
  • the monitoring apparatus 300 of Zookeeper in this embodiment can monitor the running status of Zookeeper, so that it can be detected in time when Zookeeper is in an abnormal running state, so as to ensure that the managed server equipped with Zookeeper can provide external services normally.
  • the above Zookeeper monitoring device can be implemented in the form of a computer program, which can be run on a computer device as shown in FIG. 12.
  • FIG. 12 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • the computer device 500 device may be a server.
  • the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501.
  • the memory may include a non-volatile storage medium 503 and an internal memory 504.
  • the non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032.
  • the computer program 5032 includes program instructions. When the program instructions are executed, the processor 502 can execute a Zookeeper monitoring method.
  • the processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.
  • the internal memory 504 provides an environment for running the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a Zookeeper monitoring method.
  • the network interface 505 is used for network communication, such as sending assigned tasks.
  • the specific computer equipment 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
  • the processor 502 is configured to run a computer program 5032 stored in a memory to implement the following functions: call the nc command; establish a connection with Zookeeper through the nc command; send an attribute acquisition command to the Zookeeper to obtain all The operation attribute value of Zookeeper; receiving the operation attribute value fed back by Zookeeper, and obtaining the operation attribute value matching the preset operation attribute identifier from the operation attribute value as the monitoring attribute value; and using the monitoring attribute value Sending to the monitoring server, so that the monitoring server monitors the running status of the Zookeeper according to the monitoring attribute value and the corresponding preset threshold condition.
  • the processor 502 before executing the call nc command, the processor 502 also implements the following function: judging whether a nc command exists through a first preset command; and if the nc command exists, performing the step of calling the nc command; And if the nc command does not exist, sending alarm information that the nc command does not exist to a monitoring server.
  • the processor 502 when executing the first preset command to determine whether the nc command exists, specifically implements the following functions: running the first preset command and receiving a command return value corresponding to the first preset command; An nccheck value corresponding to the command return value is obtained according to a preset correspondence relationship; if the nccheck value is 1, it is determined that the nc command exists; and if the nccheck value is 0, it is determined that the nc command does not exist.
  • the processor 502 executes the call nc command
  • the processor 502 specifically implements the following function: call the nc command according to the command return value.
  • the processor 502 before executing the connection establishment with Zookeeper through the nc command, the processor 502 also implements the following functions: detecting whether Zookeeper is started by using a second preset command; if it is detected that Zookeeper is started, executing the pass The step of establishing the connection between the nc command and Zookeeper; and if it is detected that the Zookeeper is not started, sending a warning message that the Zookeeper is not started to the monitoring server.
  • the processor 502 when the processor 502 detects whether Zookeeper is started through the second preset command, the processor 502 specifically implements the following functions: running the second preset command and receiving a checkstatus value corresponding to the second preset command; If the checkstatus value is OK, it is determined that Zookeeper is started; and if the checkstatus value is down, it is determined that Zookeeper is not started.
  • the processor 502 when the processor 502 executes sending the alarm information that the nc command does not exist to the monitoring server, the processor 502 specifically implements the following function: sending the nccheck value to the monitoring server.
  • the processor 502 may be a central processing unit, or may be other general-purpose processors, digital signal processors, application specific integrated circuits, ready-made programmable gate arrays or other programmable logic devices, and discrete gates. Or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor, or the processor may be any conventional processor.
  • the computer program may be stored in a computer-readable storage medium.
  • the computer-readable storage medium includes a non-volatile computer-readable storage medium, and the computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment including the monitoring methods of Zookeeper as described above.
  • the storage medium may be various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk, or an optical disk.
  • program codes such as a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk, or an optical disk.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium.
  • the technical solution of this application is essentially a part that contributes to the existing technology, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a storage medium. Included are instructions for causing a computer device (which may be a personal computer, a terminal, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请公开了Zookeeper的监控方法、装置、计算机设备及存储介质。该方法通过nc命令与Zookeeper建立连接;向Zookeeper发送属性获取命令以获取Zookeeper的运行属性值;从运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;发送监控属性值至监控服务器以使得监控服务器根据监控属性值和对应的预设阈值条件监控Zookeeper的运行状态。

Description

Zookeeper的监控方法、装置、计算机设备及存储介质
本申请要求于2018年6月13日提交中国专利局、申请号为201810607112.1、发明名称为“Zookeeper的监控方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种Zookeeper的监控方法、装置、计算机设备及存储介质。
背景技术
Zookeeper是一个分布式的、开源的分布式应用程序协调服务。目前广泛应用在各类分布式服务平台中,提供配置维护、域名服务、分布式同步、组服务等功能,为分布式服务平台能够更好地向用户提供服务提供保障。正是由于Zookeeper的重要性,使得Zookeeper一旦出现异常,就会影响分布式服务平台的正常工作。因此,如何监控Zookeeper的运行状态成为亟待解决的技术问题。
发明内容
本申请提供了一种Zookeeper的监控方法、装置、计算机设备及存储介质,以监控Zookeeper的运行状态。
第一方面,本申请提供了一种方Zookeeper的监控法,其包括:调取nc命令;通过所述nc命令与Zookeeper建立连接;向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值;接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;以及将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
第二方面,本申请提供了一种Zookeeper的监控装置,其包括:命令调取单 元,用于调取nc命令;连接单元,用于通过所述nc命令与Zookeeper建立连接;属性值获取单元,用于向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值;接收单元,用于接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;发送单元,用于将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
第三方面,本申请又提供了一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现第一方面提供的任一项所述的Zookeeper的监控方法。
第四方面,本申请还提供了一种计算机可读存储介质,其中所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行第一方面提供的任一项所述的Zookeeper的监控方法。
本申请提供一种Zookeeper的监控方法、装置、计算机设备及存储介质。该方法可以对Zookeeper的运行状态进行监控,以在Zookeeper处于异常运行状态时可以被及时发现,保证搭载Zookeeper的被监控服务器可以正常对外提供服务。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种Zookeeper的监控方法的示意流程图;
图2为本申请实施例中Zookeeper的监控方法的应用场景示意图;
图3为本申请实施例提供的一种Zookeeper的监控方法的另一示意流程图;
图4为本申请实施例提供的一种Zookeeper的监控方法的具体示意流程图;
图5为本申请实施例提供的一种Zookeeper的监控方法的另一示意流程图;
图6为本申请实施例提供的一种Zookeeper的监控方法的具体示意流程图;
图7为本申请实施例提供的一种Zookeeper的监控装置的示意性框图;
图8为本申请实施例提供的一种Zookeeper的监控装置的另一示意性框图;
图9为本申请实施例提供的一种Zookeeper的监控装置的具体示意性框图;
图10为本申请实施例提供的一种Zookeeper的监控装置的另一示意性框图;
图11为本申请实施例提供的一种Zookeeper的监控装置的具体示意性框图;
图12为本申请实施例提供的一种计算机设备的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
请参阅图1和图2,图1是本申请实施例提供的一种Zookeeper的监控方法的示意流程图,图2是本申请实施例中Zookeeper的监控方法的应用场景示意图。该Zookeeper的监控方法应用于被监控服务器20中。该被监控服务器20可以为分布式服务平台中的一台服务器,该被监控服务器20中部署有Zookeeper,该被监控服务器20将Zookeeper的监控属性值发送至监控服务器10中,以使得监控服务器10可以对被监控服务器20中的Zookeeper的运行状态进行监控。
需要说明的是,图2中仅仅示意出一台被监控服务器20,在实际操作过程中,监控服务器10可以对多个被监控服务器20中的Zookeeper的运行状态进行监控。
如图1所示,该Zookeeper的监控方法包括步骤S101~S105。
S101、调取nc命令。
在本实施例中,被监控服务器20调取nc(英文全称:netcat)命令,以便于通过nc命令与被监控服务器20内的Zookeeper建立连接。在一实施例中,如图3所示,图3为本申请实施例提供的一种Zookeeper的监控方法的另一示意流程图。在该实施例中,在步骤S101之前,还包括步骤S106和S107。
S106、通过第一预设命令判断是否存在nc命令。
在图3所示的监控方法中,为了确保被监控服务器20内预先存储有nc命令,被监控服务器20在执行步骤S101之前,需要通过第一预设命令判断被监控服务器20中是否存在nc命令。其中,该第一预设命令可例如为“whereisnc” 命令。当然,该第一预设命令还可以为其他命令,只要可以判断出被监控服务器20内是否存在nc命令即可,在此不做具体限制。
具体地,在一实施例中,如图4所示,图4为本申请实施例提供的一种Zookeeper的监控方法的具体示意流程图。该步骤106包括步骤S1061至S1064。
S1061、运行第一预设命令并接收所述第一预设命令对应的命令返回值。
被监控服务器20运行第一预设命令,然后会接收到第一预设命令对应的命令返回值。其中,该命令返回值可以为空值或nc命令的存储目录。当被监控服务器20中存储有nc命令时,命令返回值为nc命令的存储目录;当被监控服务器20中未存储有nc命令时,命令返回值为空值。
S1062、根据预设对应关系获取所述命令返回值对应的nccheck值。
在该实施例中,被监控服务器20中存储有预设对应关系。该预设对应关系用来存储命令返回值与nccheck值之间的对应关系。具体的对应关系可以为:当命令返回值为空值时,对应的nccheck的值为0;当命令返回值为nc命令的存储目录时,对应的nccheck的值为1。
在被监控服务器20收到命令返回值后,先获取预先存储的预设对应关系,然后根据预设对应关系找到命令返回值对应的nccheck值。
S1063、若所述nccheck值为1,则判定存在所述nc命令。
被监控服务器20在获取到命令返回值对应的nccheck值后,将判断该nccheck值是为1,还是为0。
若判断出该nccheck值为1,则判定被监控服务器20中存在nc命令,此时将执行步骤S101,即调取nc命令。
当判断出存在nc命令时,该命令返回值为nc命令的存储目录,此时调取nc命令可以具体为:根据所述命令返回值调取所述nc命令,即根据nc命令的存储目录调取nc命令。
S1064、若所述nccheck值为0,则判定不存在所述nc命令。
若判断出该nccheck值为0,则判定被监控服务器20中不存在nc命令,此时将执行步骤S107。
S107、向监控服务器发送所述nc命令不存在的告警信息。
当被监控服务器20内不存在nc命令时,被监控服务器20需要向监控服务器10发送告警信息,以使得监控服务器10可以执行相应提示操作,进而提示 工作人员及时在被监控服务器20中添加nc命令。其中,监控服务器10执行相应提示操作可以例如为监控服务器10向工作人员发送添加nc命令的邮件、电话或短信等。
在一实施例中,当通过nccheck值为0判断出被监控服务器20中不存在nc命令时,向监控服务器发送所述nc命令不存在的告警信息,具体可以为:将所述nccheck值发送至监控服务器中。即将nccheck值作为告警信息,这样监控服务器10在接收到nccheck值为0时,可以得知被监控服务器20中缺失nc命令。
当然,在其他实施例中,告警信息也可以为其他信息,在此不做具体限制。另外,在其他实施例中,当通过nccheck值为1判定存在nc命令时,被监控服务器20也可以将nccheck值反馈给监控服务器10,以使得维护人员可以通过监控服务器10得知被监控服务器20中是否存在nc命令。
在该实施例中,由于在被监控服务器20中部署本申请实施例中的监控方法时,往往是采用自动化部署的,这样在前期部署监控的时候,开发人员很难得知被监控服务器20中是否存储有nc命令。通过引入nccheck值,使得开发人员可以通过监控服务器10接收到的nccheck值就可以得知被监控服务器20中是否存在nc命令,方便开发人员及时了解被监控服务器20中nc命令的存储情况。
S102、通过所述nc命令与Zookeeper建立连接。
在被监控服务器20获取到nc命令后,将通过nc命令与Zookeeper建立连接。具体地,根据nc命令中的服务地址和端口号与相应的Zookeeper建立连接。
在一实施例中,如图5所示,图5为本申请实施例提供的一种Zookeeper的监控方法的另一示意流程图。在通过所述nc命令与Zookeeper建立连接之前,还包括步骤S108和S109。
S108、通过第二预设命令检测Zookeeper是否启动。
在一实施例中,该第二预设命令可例如为:echo ruok|nc192.168.229.161 2181命令,其中,192.168.229.161是被监控服务器20中Zookeeper的互联网协议地址(以下简称IP地址),2181是Zookeeper的服务端口。被监控服务器20通过运行该第二预设命令来检测Zookeeper是否启动。
具体地,在一实施例中,如图6所示,图6为本申请实施例提供的一种Zookeeper的监控方法的具体示意流程图。该步骤S108包括步骤S1081至S1083。
S1081、运行第二预设命令并接收所述第二预设命令对应的checkstatus值。
被监控服务器20运行该第二预设命令,然后会接收到第二预设命令对应的checkstatus值。
S1082、若所述checkstatus值为OK,则判定Zookeeper已启动。
若该checkstatus值为OK,则说明Zookeeper已经启动,此时将执行步骤S102,即通过所述nc命令与Zookeeper建立连接。
S1083、若所述checkstatus值为down,则判定Zookeeper未启动。
若该checkstatus值为down,则说明Zookeeper没有启动,此时将执行步骤S109。
S109、向监控服务器发送所述Zookeeper未启动的告警信息。
当检测到Zookeeper未启动时,向监控服务器10发送告警信息,以告知监控服务器10被监控服务器20中的Zookeeper未启动,这样监控服务器10就可以执行相应操作,以提示维护人员开启被监控服务器20中的Zookeeper。
S103、向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值。
在被监控服务器20通过nc命令与Zookeeper连接后,向Zookeeper发送属性获取命令,从而使得Zookeeper可以将当前的运行属性值反馈给被监控服务器20。
其中,该属性获取命令可以为mntr命令。该运行属性值可以包括:zk_avg_latency(中文名称:平均延长)、zk_num_alive_connections(中文名称:存活连接数)、zk_outstanding_requests(中文名称:异常请求)、zk_server_state(中文名称:节点角色)、zk_znode_count(中文名称:节点数)、zk_watch_count(中文名称:监听数)、zk_ephemerals_count(中文名称:临时节点数)、zk_open_file_descriptor_count(中文名称:打开文件描述符数量限制)、zk_packets_received(中文名称:收包数)、zk_packets_sent(中文名称:发包数)、未完成客户端请求数、zk_server_state、临时节点数、zk_approximate_data_size(中文名称:近似数据大小应该是一个总和的值)、zk_max_file_descriptor_count(最大文件描述符数)等。
S104、接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值。
被监控服务器20接收Zookeeper反馈的运行属性值后,由于在该运行属性 值中可能会存在一些不能用于监控Zookeeper的运行状态的属性值,因此,被监控服务器20需要从接收到的运行属性值中筛选出所需的属性值作为监控属性值。
具体地,在被监控服务器20中预先存储有预设运行属性标识,被监控服务器20从接收到的运行属性值中找到与预设运行属性标识相匹配的运行属性值作为监控属性值。
譬如,预设运行属性标识为zk_watch_count,Zookeeper反馈的运行属性值如下所示:
zk_znode_count 75
zk_watch_count 9
zk_ephemerals_count 17
这样,就可以根据预设运行属性标识zk_watch_count从上述三个运行属性值中找到相匹配的zk_watch_count 9作为监控属性值。
在本方案中,该监控属性值包括:zk_avg_latency、zk_num_alive_connections、zk_outstanding_requests、zk_server_state、zk_znode_count、zk_watch_count、zk_ephemerals_count和zk_open_file_descriptor_count。需要说明的是,该监控属性值可根据实际需求进行调整和设置,在此不对监控属性值的具体内容做限制。
S105、将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
在本实施例中,被监控服务器20将监控属性值发送至监控服务器10中,以便于监控服务器10根据监控属性值监控Zookeeper的运行状态。
具体地,监控服务器10中存储有每个监控属性值对应的预设阈值条件。监控服务器10接收到监控属性值后,可以将监控属性值存储在数据库中。该数据库中存储每次被监控服务器20发送的监控属性值。监控服务器10从数据库中读取最新存储的监控属性值。然后判断该监控属性值是否满足对应的预设阈值条件。若监控属性值满足对应的预设阈值条件,则判定Zookeeper处于正常运行状态;若监控属性值不满足对应的预设阈值条件,则判定Zookeeper处于异常运行状态。
譬如,对于zk_znode_count这个监控属性值来说,假设设置其预设阈值条件为大于800,那么当监控服务器10接收到的zk_znode_count值为789时,监 控服务器10可以判定出zk_znode_count不满足大于800的预设阈值条件,此时将判定Zookeeper的运行状态异常。
在一实施例中,当判定出Zookeeper处于异常运行状态时,监控服务器10可以发出提示信息以提示维护人员及时处理。当然,在其他实施例中,监控服务器10也可以在判断出连续两次监控属性值不满足预设阈值条件时,才判定Zookeeper处于异常工作状态。
本实施例中的Zookeeper的监控方法,可以对Zookeeper的运行状态进行监控,以在Zookeeper处于异常运行状态时可以及时被发现,保证搭载Zookeeper的被管理服务器可以正常对外提供服务。
本申请实施例还提供一种Zookeeper的监控装置,该Zookeeper的监控装置用于执行前述实施例中Zookeeper的监控方法。具体地,请参阅图7,图7是本申请实施例提供的一种Zookeeper的监控装置的示意性框图。Zookeeper的监控装置300可以安装于被监控服务器中,该被监控服务器可以为分布式服务平台中的一台服务器。该被监控服务器中部署有Zookeeper。
如图7所示,Zookeeper的监控装置300包括命令调取单元301、连接单元302、属性值获取单元303、接收单元304和发送单元305。
命令调取单元301,用于调取nc命令。
在一实施例中,如图8所示,图8为本申请实施例提供的一种Zookeeper的监控装置的另一示意性框图。在该实施例中,Zookeeper的监控装置300还包括判断单元306和第一告警发送单元307。
判断单元306,用于通过第一预设命令判断是否存在nc命令。
具体地,在一实施例中,如图9所示,图9为本申请实施例提供的一种Zookeeper的监控装置的具体示意性框图。该判断单元306包括第一运行子单元3061、获取子单元3062和第一判定子单元3063。
第一运行子单元3061,用于运行第一预设命令并接收所述第一预设命令对应的命令返回值。
获取子单元3062,用于根据预设对应关系获取所述命令返回值对应的nccheck值。
第一判定子单元3063,用于若所述nccheck值为1,则判定存在所述nc命 令;以及若所述nccheck值为0,则判定不存在所述nc命令。
当第一判定子单元3063判定出存在nc命令时,第一判定子单元3063将向命令调取单元301发送第一信号,以使得命令调取单元301执行调用nc命令。
进一步地,当该命令调取单元301接收到第一判定子单元3063发送的第一信号时,该命令调取单元301具体用于根据所述命令返回值调取所述nc命令。
当第一判定子单元3063判定出不存在所述nc命令时,则向第一告警发送单元307发送第二信号,以使得第一告警发送单元307执行相应操作。
第一告警发送单元307,用于若不存在所述nc命令,则向监控服务器发送所述nc命令不存在的告警信息。
在一实施例中,当第一告警发送单元307接收到第一判定子单元3063发送的第二信号时,将向监控服务器发送所述nc命令不存在的告警信息。具体地,第一告警发送单元307将所述nccheck值发送至监控服务器中。
连接单元302,用于通过所述nc命令与Zookeeper建立连接。
在一实施例中,如图10所示,图10为本申请实施例提供的一种Zookeeper的监控装置的另一示意性框图。该Zookeeper的监控装置300还包括检测单元308和第二告警发送单元309。
检测单元308,用于通过第二预设命令检测Zookeeper是否启动。
具体地,在一实施例中,如图11所示,图11为本申请实施例提供的一种Zookeeper的监控装置的具体示意性框图。该检测单元308包括第二运行子单元3081和第二判定子单元3082。
第二运行子单元3081,用于运行第二预设命令并接收所述第二预设命令对应的checkstatus值。
第二判定子单元3082,用于若所述checkstatus值为OK,则判定Zookeeper已启动;以及若所述checkstatus值为down,则判定Zookeeper未启动。
若第二判定子单元3082判定Zookeeper已启动,则向连接单元302发送第三信号,以使得连接单元302通过所述nc命令与Zookeeper建立连接。
若第二判定子单元3082判定Zookeeper未启动,则向第二告警发送单元309发送第四信号,以使得第二告警发送单元309执行相应操作。
第二告警发送单元309,用于若检测到所述Zookeeper未启动,则向监控服务器发送所述Zookeeper未启动的告警信息。
在一实施例中,当第二告警发送单元309接收到第四信号时,说明此时Zookeeper未启动,则第二告警发送单元309向监控服务器发送所述Zookeeper未启动的告警信息。
属性值获取单元303,用于向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值。
接收单元304,用于接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值。
发送单元305,用于将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
本实施例中的Zookeeper的监控装置300,可以对Zookeeper的运行状态进行监控,以在Zookeeper处于异常运行状态时可以及时被发现,保证搭载Zookeeper的被管理服务器可以正常对外提供服务。
上述Zookeeper的监控装置可以实现为一种计算机程序的形式,该计算机程序可以在如图12所示的计算机设备上运行。
请参阅图12,图12是本申请实施例提供的一种计算机设备的示意性框图。该计算机设备500设备可以是服务器。
参阅图12,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032包括程序指令,该程序指令被执行时,可使得处理器502执行一种Zookeeper的监控方法。该处理器502用于提供计算和控制能力,支撑整个计算机设备500的运行。该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,可使得处理器502执行一种Zookeeper的监控方法。该网络接口505用于进行网络通信,如发送分配的任务等。本领域技术人员可以理解,图12中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的 部件,或者组合某些部件,或者具有不同的部件布置。
其中,所述处理器502用于运行存储在存储器中的计算机程序5032,以实现如下功能:调取nc命令;通过所述nc命令与Zookeeper建立连接;向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值;接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;以及将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
在一实施例中,处理器502在执行调取nc命令之前,还实现如下功能:通过第一预设命令判断是否存在nc命令;若存在所述nc命令,则执行调取nc命令的步骤;以及若不存在所述nc命令,则向监控服务器发送所述nc命令不存在的告警信息。
在一实施例中,处理器502在执行通过第一预设命令判断是否存在nc命令时,具体实现如下功能:运行第一预设命令并接收所述第一预设命令对应的命令返回值;根据预设对应关系获取所述命令返回值对应的nccheck值;若所述nccheck值为1,则判定存在所述nc命令;以及若所述nccheck值为0,则判定不存在所述nc命令。
进一步地,处理器502在执行调取nc命令时,具体实现如下功能:根据所述命令返回值调取所述nc命令。
在一实施例中,处理器502在执行通过所述nc命令与Zookeeper建立连接之前,还实现如下功能:通过第二预设命令检测Zookeeper是否启动;若检测到所述Zookeeper已启动,则执行通过所述nc命令与Zookeeper建立连接的步骤;以及若检测到所述Zookeeper未启动,则向监控服务器发送所述Zookeeper未启动的告警信息。
在一实施例中,处理器502在执行通过第二预设命令检测Zookeeper是否启动时,具体实现如下功能:运行第二预设命令并接收所述第二预设命令对应的checkstatus值;若所述checkstatus值为OK,则判定Zookeeper已启动;以及若所述checkstatus值为down,则判定Zookeeper未启动。
在一实施例中,处理器502在执行向监控服务器发送所述nc命令不存在的告警信息时,具体实现如下功能:将所述nccheck值发送至监控服务器中。
应当理解,在本申请实施例中,处理器502可以是中央处理单元,还可以是其他通用处理器、数字信号处理器、专用集成电路、现成可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
本领域普通技术人员可以理解的是实现上述Zookeeper的监控方法实施例中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成。该计算机程序可存储于一计算机可读存储介质中。计算机可读存储介质包括非易失性计算机可读存储介质,该计算机程序被该计算机系统中的至少一个处理器执行,以实现包括如上述各Zookeeper的监控方法的实施例的流程步骤。
该存储介质可以是U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现。在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的。各个单元的划分仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。本申请实施例装置中的单元可以根据实际需要进行合并、划分和删减。在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,终端,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种Zookeeper的监控方法,其包括:
    调取nc命令;
    通过所述nc命令与Zookeeper建立连接;
    向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值;
    接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;以及
    将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
  2. 根据权利要求1所述的Zookeeper的监控方法,其中,在所述调取nc命令之前,还包括:
    通过第一预设命令判断是否存在nc命令;
    若存在所述nc命令,则执行调取nc命令的步骤;以及
    若不存在所述nc命令,则向监控服务器发送所述nc命令不存在的告警信息。
  3. 根据权利要求2所述的Zookeeper的监控方法,其中,所述通过第一预设命令判断是否存在nc命令,包括:
    运行第一预设命令并接收所述第一预设命令对应的命令返回值;
    根据预设对应关系获取所述命令返回值对应的nccheck值;
    若所述nccheck值为1,则判定存在所述nc命令;以及
    若所述nccheck值为0,则判定不存在所述nc命令。
  4. 根据权利要求3所述的Zookeeper的监控方法,其中,所述调取nc命令,包括:根据所述命令返回值调取所述nc命令。
  5. 根据权利要求1所述的Zookeeper的监控方法,其中,在所述通过所述nc命令与Zookeeper建立连接之前,还包括:
    通过第二预设命令检测Zookeeper是否启动;
    若检测到所述Zookeeper已启动,则执行通过所述nc命令与Zookeeper建立连接的步骤;以及
    若检测到所述Zookeeper未启动,则向监控服务器发送所述Zookeeper未启动的告警信息。
  6. 根据权利要求5所述的Zookeeper的监控方法,其中,所述通过第二预设命令检测Zookeeper是否启动,包括:
    运行第二预设命令并接收所述第二预设命令对应的checkstatus值;
    若所述checkstatus值为OK,则判定Zookeeper已启动;以及
    若所述checkstatus值为down,则判定Zookeeper未启动。
  7. 根据权利要求3所述的Zookeeper的监控方法,其中,所述向监控服务器发送所述nc命令不存在的告警信息,包括:将所述nccheck值发送至监控服务器中。
  8. 一种Zookeeper的监控装置,其包括:
    命令调取单元,用于调取nc命令;
    连接单元,用于通过所述nc命令与Zookeeper建立连接;
    属性值获取单元,用于向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值;
    接收单元,用于接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;
    发送单元,用于将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
  9. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如下步骤:调取nc命令;通过所述nc命令与Zookeeper建立连接;向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值;接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;以及将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
  10. 根据权利要求9所述的计算机设备,其中,所述处理器执行调取nc命令之前,还实现如下步骤:通过第一预设命令判断是否存在nc命令;若存在所述nc命令,则执行调取nc命令的步骤;以及若不存在所述nc命令,则向监控服务器发送所述nc命令不存在的告警信息。
  11. 根据权利要求10所述的计算机设备,其中,所述处理器执行通过第一预设命令判断是否存在nc命令时实现如下步骤:运行第一预设命令并接收所述第一预设命令对应的命令返回值;根据预设对应关系获取所述命令返回值对应的nccheck值;若所述nccheck值为1,则判定存在所述nc命令;以及若所述nccheck值为0,则判定不存在所述nc命令。
  12. 根据权利要求11所述的计算机设备,其中,所述处理器执行调取nc命令时实现如下步骤:根据所述命令返回值调取所述nc命令。
  13. 根据权利要求9所述的计算机设备,其中,所述处理器执行通过所述nc命令与Zookeeper建立连接之前,还实现如下步骤:通过第二预设命令检测Zookeeper是否启动;若检测到所述Zookeeper已启动,则执行通过所述nc命令与Zookeeper建立连接的步骤;以及若检测到所述Zookeeper未启动,则向监控服务器发送所述Zookeeper未启动的告警信息。
  14. 根据权利要求13所述的计算机设备,其中,所述处理器执行通过第二预设命令检测Zookeeper是否启动时实现如下步骤:运行第二预设命令并接收所述第二预设命令对应的checkstatus值;若所述checkstatus值为OK,则判定Zookeeper已启动;以及若所述checkstatus值为down,则判定Zookeeper未启动。
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行如下步骤:调取nc命令;通过所述nc命令与Zookeeper建立连接;向所述Zookeeper发送属性获取命令以获取所述Zookeeper的运行属性值;接收所述Zookeeper反馈的运行属性值,并从所述运行属性值中获取与预设运行属性标识相匹配的运行属性值作为监控属性值;以及将所述监控属性值发送至监控服务器中,以使得所述监控服务器根据所述监控属性值以及对应的预设阈值条件监控所述Zookeeper的运行状态。
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述计算机程序被处理器执行调取nc命令之前,还实现如下步骤:通过第一预设命令判断是否存在nc命令;若存在所述nc命令,则执行调取nc命令的步骤;以及若不存在所述nc命令,则向监控服务器发送所述nc命令不存在的告警信息。
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述计算机程序被处理器执行通过第一预设命令判断是否存在nc命令时可实现如下步骤:运行 第一预设命令并接收所述第一预设命令对应的命令返回值;根据预设对应关系获取所述命令返回值对应的nccheck值;若所述nccheck值为1,则判定存在所述nc命令;以及若所述nccheck值为0,则判定不存在所述nc命令。
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述计算机程序被处理器执行调取nc命令时实现如下步骤:根据所述命令返回值调取所述nc命令。
  19. 根据权利要求15所述的计算机可读存储介质,其中,所述计算机程序被处理器执行通过所述nc命令与Zookeeper建立连接之前,还实现如下步骤:通过第二预设命令检测Zookeeper是否启动;若检测到所述Zookeeper已启动,则执行通过所述nc命令与Zookeeper建立连接的步骤;以及若检测到所述Zookeeper未启动,则向监控服务器发送所述Zookeeper未启动的告警信息。
  20. 根据权利要求19所述的计算机可读存储介质,其中,所述计算机程序被处理器执行通过第二预设命令检测Zookeeper是否启动时实现如下步骤:运行第二预设命令并接收所述第二预设命令对应的checkstatus值;若所述checkstatus值为OK,则判定Zookeeper已启动;以及若所述checkstatus值为down,则判定Zookeeper未启动。
PCT/CN2018/109321 2018-06-13 2018-10-08 Zookeeper的监控方法、装置、计算机设备及存储介质 WO2019237585A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810607112.1A CN108810142A (zh) 2018-06-13 2018-06-13 Zookeeper的监控方法、装置、计算机设备及存储介质
CN201810607112.1 2018-06-13

Publications (1)

Publication Number Publication Date
WO2019237585A1 true WO2019237585A1 (zh) 2019-12-19

Family

ID=64087018

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/109321 WO2019237585A1 (zh) 2018-06-13 2018-10-08 Zookeeper的监控方法、装置、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN108810142A (zh)
WO (1) WO2019237585A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080337A (zh) * 2021-03-16 2022-09-20 网联清算有限公司 数据监控方法、装置、系统、服务器及可读存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102932210A (zh) * 2012-11-23 2013-02-13 北京搜狐新媒体信息技术有限公司 一种PaaS云平台的节点监控方法和系统
CN104615526A (zh) * 2014-12-05 2015-05-13 北京航空航天大学 一种大数据平台的监控系统
US20160301587A1 (en) * 2015-04-09 2016-10-13 Alibaba Group Holding Limited Apparatus, system and method for fast leader election by coordination service
CN106713458A (zh) * 2016-12-23 2017-05-24 智者四海(北京)技术有限公司 Zookeeper集群及Zookeeper实例的部署方法、装置以及管理平台
US20180046565A1 (en) * 2016-08-12 2018-02-15 Futurewei Technologies, Inc. Automatically detecting distributed concurrency errors in cloud systems
CN107832200A (zh) * 2017-10-24 2018-03-23 平安科技(深圳)有限公司 告警处理方法、装置、计算机设备及存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103618644A (zh) * 2013-11-26 2014-03-05 曙光信息产业股份有限公司 一种基于hadoop集群的分布式监控系统及其方法
CN106961352B (zh) * 2017-03-29 2020-09-25 康朝红 监控系统及监控方法
CN107257289A (zh) * 2017-04-24 2017-10-17 努比亚技术有限公司 一种风险分析设备、监控系统和监控方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102932210A (zh) * 2012-11-23 2013-02-13 北京搜狐新媒体信息技术有限公司 一种PaaS云平台的节点监控方法和系统
CN104615526A (zh) * 2014-12-05 2015-05-13 北京航空航天大学 一种大数据平台的监控系统
US20160301587A1 (en) * 2015-04-09 2016-10-13 Alibaba Group Holding Limited Apparatus, system and method for fast leader election by coordination service
US20180046565A1 (en) * 2016-08-12 2018-02-15 Futurewei Technologies, Inc. Automatically detecting distributed concurrency errors in cloud systems
CN106713458A (zh) * 2016-12-23 2017-05-24 智者四海(北京)技术有限公司 Zookeeper集群及Zookeeper实例的部署方法、装置以及管理平台
CN107832200A (zh) * 2017-10-24 2018-03-23 平安科技(深圳)有限公司 告警处理方法、装置、计算机设备及存储介质

Also Published As

Publication number Publication date
CN108810142A (zh) 2018-11-13

Similar Documents

Publication Publication Date Title
WO2021184586A1 (zh) 基于非扁平网络的私有云监控方法、装置、计算机设备及存储介质
CN109379337B (zh) 一种安卓平台下应用进程的保活方法
US8707386B2 (en) Policy processing system, method, and program
WO2021012568A1 (zh) 一种数据处理方法及相关设备
WO2019184680A1 (zh) 一种策略控制的方法、网元及系统
CN108989352B (zh) 防火墙实现方法、装置、计算机设备及存储介质
CN108183950B (zh) 一种网络设备建立连接的方法及装置
US10389801B2 (en) Service request processing method, related apparatus, and system
CN108616429B (zh) 一种推送服务的重连方法及设备
WO2021184587A1 (zh) 基于Prometheus的私有云监控方法、装置、计算机设备及存储介质
WO2019061720A1 (zh) 一种数据同步的方法和系统
WO2019223140A1 (zh) 设备监控管理方法、装置、计算机设备及存储介质
CN108206764B (zh) 网络设备配置信息的配置方法、服务器和计算机可读介质
US7450568B2 (en) System and method for managing a VolP network
CN111984561B (zh) 一种bmc的ipmi命令处理方法、系统、设备以及介质
US20130346513A1 (en) Migrating a chat message service provided by a chat server to a new chat server
CN107241242A (zh) 一种数据处理方法和装置
CN110674028A (zh) 故障注入方法及其装置、业务服务系统
WO2020114059A1 (zh) 一种报警信息的发送方法、装置及电子设备
US11057475B2 (en) Methods, apparatus and systems for resuming transmission link
EP3832960A1 (en) Establishment of fast forwarding table
CN110661717A (zh) 一种限流方法、装置及电子设备
WO2019237585A1 (zh) Zookeeper的监控方法、装置、计算机设备及存储介质
CN112448987A (zh) 一种熔断降级的触发方法、系统和存储介质
WO2007059667A1 (fr) Procede d'obtention de donnees d'alarme des elements de reseau

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18922407

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18922407

Country of ref document: EP

Kind code of ref document: A1